-
-
Notifications
You must be signed in to change notification settings - Fork 314
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
Add content editor data attributes based on name/id and css_classes presenter method #1761
Add content editor data attributes based on name/id and css_classes presenter method #1761
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution. I like the idea, but think we can achieve the same with either
a. Using the content name as css class in the editor. Maybe also add the element name to the element editor? This should be a good enough selector, right?
b. If we still want to support adding additional classes to the editor. Why not use the settings
hash we already have for these things? I do not want to add additional attributes to the Model. Also we already have a presenter class, that would be a great home for this method.
Thanks again for the contribution.
6d9dd8c
to
91fb6df
Compare
a) Added default element name and content name classes to editor. Opinion/question: If i read here. It seems that global configuration should go in the top level conf and "individual" settings go into |
I think I cannot follow? Content and Essence have a one-to-one relationship there is no "global" and "individual" config for either of them, they are the same. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes.
But thinking about this again I think we should add the element.name
to a data-element-name
attribute and the content.name
to a data-content-name
attribute.
With that you can do crazy things like:
[data-element-name="blog_settings"] [data-content-name="author_name"] {
font-weight: bold;
color: red;
}
or
document.querySelectorAll('[data-element-name="video_header"] [data-content-name="embed_type"]').addEventListener('change', (evt) => {
evt.target.value
...
})
Should be fixing you need (flexibility in the content editors) and ours (less maintenance burden)
WDYT?
From: https://guides.alchemy-cms.com/essences.html#overview
From that it seems that |
This might be poorly worded, but my comment is still valid. But since we want to implement this differently this discussion is not necessary any more ;) |
91fb6df
to
a92b04b
Compare
Thanks for good comments. I think i fixed it now. I did however use separate Because i saw that there were already a few
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, just one little thing. Thanks for the contribution 🙏
Np i'll clean that up. But I think i want to create a
Ok? |
a92b04b
to
b0cc24f
Compare
Yes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice. One last change and we are ready to go. Thank you for working on this.
b0cc24f
to
513d273
Compare
Added data_content_name, data_content_id for all
513d273
to
5c2e70b
Compare
What is this pull request for?
To enable more unique targetable classes for styling and manipulating contents in backend forms.
Notable changes (remove if none)
Enable users to specify classes in content definition:
Added
classes
method tocontent.rb
and injected it to all essences + generator template wrapper classes.Added test for:
classes
incontent_spec.rb
page_editing_feature_spec.rb
Checklist