Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] EZP-27293: Add content and edit views #31

Conversation

jacek-foremski
Copy link
Contributor

Documentation changes reflecting code changes from #30.

JIRA: EZP-27293
This PR aims at adding the content and edit views for creating/editing/viewing EzTweet Content Items.
As I am not a YUI expert it was mostly developed by copying and editing views from core field types.

Copy link
Contributor

@DominikaK DominikaK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor language fixes

# Add content and edit views

To able to add and edit Content Item with our Field Type using PlatformUI, we need to create an edit view.
The content view will also be needed to display correct information when viewing Content Item in "Content structure" tab in PlatformUI.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The content view will also be needed to display correct information when viewing the Content item in the "Content structure" tab in PlatformUI.


### Template file

First, we need to add template file that will be responsible for displaying an edit form:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, we need to add a template file that will be responsible for displaying an edit form:

path: bundles/ezsystemstweetfieldtype/js/views/fields/ez-tweet-editview.js
```

We need to prepend this configuration, analogically like we did with our template. To do this, we have to edit dependency injection extension:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to prepend this configuration, like we did with our template. To do this, we have to edit dependency injection extension:

```

Remember to dump your assets before trying to run this code for the first time.
After this is done, we should be able to edit Content Item containing our Tweet Field Type.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this is done, we should be able to edit the Content Item containing our Tweet Field Type.


### Template file

First, we need to add template file that will be responsible for displaying content of our Field Type:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, we need to add a template file that will be responsible for displaying the content of our Field Type:


### Registering the view

We also need to add to the already created configuration information about our freshly created files. To achieve this, let's add the following snippet to the `yui.yml` file:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to add information about our freshly created files to the already created configuration.

```

After these steps you should see correct information when viewing Content Item in "Content structure" tab in PlatformUI.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth repeating the warning about dumping assets (if it applies here as well)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this is just necessary after creating the first file Resources/public directory. After the first dump, the symlink is created, so it is no longer necessary.
The above is true unless someone is installing assets as hard copies instead of symlinks, but then he/she should be already aware that he/she should dump the assets every time any file from the Resources/public directory is changed or added.

@jacek-foremski
Copy link
Contributor Author

I have added your fixes. Thanks @DominikaK!

@jacek-foremski jacek-foremski force-pushed the EZP-27293_add_content_edit_views_doc branch 2 times, most recently from 1984d98 to d9c14d2 Compare October 12, 2017 06:46

### Registering the view

We also have to create the YML file where we will tell the system to use our files. The example configuration looks like this:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the YAML file (with an A)

path: bundles/ezsystemstweetfieldtype/js/views/fields/ez-tweet-editview.js
```

We need to prepend this configuration, like we did with our template. To do this, we have to edit dependency injection extension:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding some link to this topic from our Documentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't documented in our documentation since it's a Symfony feature. Also, it was already done in the previous step, here we are just adding next config file.
I will update the code snippet to include the whole class so it's more clear what is edited.


### Javascript view file

Next, we need to implement Javascript file that will be responsible for hendling the template:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo here: "handling" with an a

@jacek-foremski
Copy link
Contributor Author

@mere-teresa thanks for the review. I have added the fixes you requested.

@jacek-foremski jacek-foremski force-pushed the EZP-27293_add_content_edit_views_doc branch from a0f7bf8 to bb7da07 Compare December 12, 2017 08:50
@jacek-foremski jacek-foremski merged commit 5365bd4 into ezsystems:documentation Dec 12, 2017
@jacek-foremski jacek-foremski deleted the EZP-27293_add_content_edit_views_doc branch December 12, 2017 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants