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
XWiki 7783 - Add hints for class properties in the class editor #141
Conversation
…he hint metadata).
*/ | ||
public String getHint() | ||
{ | ||
return getBasePropertyClass().getTranslatedHint(context); |
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.
API methods are supposed to be simple wrappers for the protected classes. As such, it's not quite right that an API method calls a different method (getHint
doesn't call the equivalent getHint
, but getTranslatedHint
).
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.
OK. I'll change it.
…ehaviour: display the raw value only if there is no translation key following the convention. It is more consistent with the pretty name behaviour).
…y hints in the object editor).
@@ -36,6 +36,7 @@ | |||
#end | |||
#foreach ($prop in $properties) | |||
<dt class="label#if($prop.isDisabled()) disabled#end"><label for="${escapetool.xml($class.name)}_${obj.number}_${escapetool.xml($prop.name)}">${escapetool.xml($prop.translatedPrettyName)}</label></dt> | |||
#if($prop.translatedHint!='')<span class="xHint">($prop.translatedHint)</span>#end |
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.
Definition lists must contain (dt|dd)+
so the hint span should be put inside the definition term as the vertical form standard recommends.
Conflicts: xwiki-platform-core/xwiki-platform-web/src/main/webapp/templates/editobject.vm
* Use "_hint" suffix instead of ".hint" to be consistent with the "tooltip" property.
@@ -36,7 +36,7 @@ | |||
#end | |||
#foreach ($prop in $properties) | |||
<dt class="label#if($prop.isDisabled()) disabled#end"><label for="${escapetool.xml($class.name)}_${obj.number}_${escapetool.xml($prop.name)}">${escapetool.xml($prop.translatedPrettyName)}</label></dt> | |||
<dd#if ($prop.isDisabled()) class="disabled"#end>$doc.display($prop.name, "edit", $obj)</dd> | |||
<dd#if ($prop.isDisabled()) class="disabled"#end>#if ("$!prop.hint" != '')<p><span class="xHint">$prop.hint</span></p>#end$doc.display($prop.name, "edit", $obj)</dd> |
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.
Should we escape the HTML from the hint?
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.
+1
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.
Indeed, fixed in dc6655f.
I have added a new metadata called "hint" in the PropertyMetaClass.
Then, we can edit the content of the hint in the class editor.
I have also added a PropertyClass#getHint(), that:
I hope you like it.
Louis-Marie