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

XWiki 7783 - Add hints for class properties in the class editor #141

Merged
merged 11 commits into from Nov 27, 2017

Conversation

gdelhumeau
Copy link
Member

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:

  • display the hint if the metadata exists
  • fall back to a default translation key convention if not.

I hope you like it.

Louis-Marie

*/
public String getHint()
{
return getBasePropertyClass().getTranslatedHint(context);
Copy link
Member

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).

Copy link
Member Author

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).
@@ -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
Copy link
Member

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.
@gdelhumeau gdelhumeau merged commit b8cb5c7 into xwiki:master Nov 27, 2017
@@ -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>
Copy link
Member

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?

Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed, fixed in dc6655f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants