-
Notifications
You must be signed in to change notification settings - Fork 821
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
This adds the ability to toggle a field description #4094
This adds the ability to toggle a field description #4094
Conversation
Interesting! When developing the help text I think we deliberately decided to show it by default. It would be good to make the "info" icons opt-in though (globally and per field), as an easier way to show longer help text. Please have a read through historical discussions to get context: Make sure the styling works correctly with different field layout combos, like in |
@@ -138,6 +138,8 @@ public static function name_to_label($fieldName) { | |||
* @return string | |||
*/ | |||
public static function create_tag($tag, $attributes, $content = null) { | |||
Requirements::javascript(FRAMEWORK_DIR . '/javascript/FieldToggleDescription.js'); |
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.
This should be in the FormField() function, which is where all other formfields require their javascript. It should also only be included if necessary.
Alternatively, if you don't want to include this check, then you can put it in one of the existing framework/admin/javascript files; likely LeftAndMain.FieldHelp.js, which already has similar field helpers.
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.
Also make sure that's included in the main Requirements::combine_files()
call in CMSMain
, we don't want to cause more asset loads to slow down the CMS
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, I'll move it :)
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.
I think if it's in LeftAndMain we should remove it from here. This is a CMS specific feature not a field specific one?
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, yup that was an oversight on my part, i forgot to remove it.
The naming convention is now more consistent with FieldHelp / Tooltip. And there are some docs. @chillu @tractorcow what are your thoughts on this approach? |
The initial styling is there now. Here's a screenshot of the styles applied in the files area. There are a lot of image file changes as a result of adding an icon to the buttons sprite ( I'm going to do some testing on other field types as @chillu suggested, and as a result probably push up another commit :) |
Here are some screenshots of various field types. @chillu @tractorcow If you're happy with this, I'll squash the commits... |
Hey @flashbackzoo you may have already tested but just wondering if this works for a
as chillu pointed out, and also on individual fields nested within a |
Hey @jonom - Yup it works on For a The |
This adds the ability to toggle a field description
Thanks @flashbackzoo :D |
If a field requires a long description it can be useful have it hidden until the user needs to read it.
Description hidden:
Description show:
I'm looking for feedback on the technical approach here, so I have only pushed the initial show/hide logic at this stage. There is additional styling required to get the layout looking like the screenshots.