-
-
Notifications
You must be signed in to change notification settings - Fork 553
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-19383: Display a title on createlink #2104
base: master
Are you sure you want to change the base?
Conversation
* Changed generation in the class editor on the platform
* Added an extension for rendering default behavior.
* Fixed wrong version tag
* Fixed wrong version tag
* Changed generation in the class editor on the platform
* Added an extension for rendering default behavior.
* Fixed wrong version tag
* Added an hint on the URITitleGenerator component
* Fixed the hint of the URITitleGenerator implementation
PR Changes:
NOTE: This commit needs to be merged with/after xwiki/xwiki-rendering#256 |
* Refactored name and fixed hint to match DocumentXHTMLLinkTypeRenderer in xwiki-render.
<span class="wikicreatelink"><a href="$pageDoc.getURL('create')" | ||
title="$services.localization.render('core.create.inline.label', [$title])">$title</a></span> |
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.
Wrong formatting + escaping missing.
<span class="wikicreatelink"><a href="$pageDoc.getURL('create')" | |
title="$services.localization.render('core.create.inline.label', [$title])">$title</a></span> | |
<span class="wikicreatelink"> | |
<a href="$pageDoc.getURL('create')" title="$services.localization.render('core.create.inline.label', [$title])">$title</a> | |
</span> |
* Fixed escaping on title. * Properly formatted changes.
PR Changes:
|
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 PR looks unfinished.
...es/xwiki-platform-appwithinminutes-ui/src/main/resources/AppWithinMinutes/ClassEditSheet.xml
Outdated
Show resolved
Hide resolved
title="$services.localization.render('platform.', | ||
['#pageLink($translationsReference)']" |
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 looks wrong. The translation key is incomplete and there's a bracket missing.
import org.xwiki.rendering.renderer.reference.link.URITitleGenerator; | ||
|
||
/** | ||
* Generate link titles for ATTACH URIs. |
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 doesn't match the class name. Is this about pages or attachments?
* Generate link titles for ATTACH URIs. | ||
* | ||
* @version $Id$ | ||
* @since 15.2RC1 |
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 needs to be updated.
return this.contextLocalization.getTranslationPlain("core.create.inline.label", | ||
attachmentReference.getName()); |
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 don't understand, you're returning "Create page: attachmentName"? Doesn't make any sense. Also bad formatting.
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.
@@ -55,9 +55,14 @@ | |||
## The view displayer generates HTML so we need to escape the XML special characters from the page reference. | |||
$escapetool.xml($pageReference) | |||
#else | |||
#set ($title = $escapetool.xml($pageDoc.plainTitle)) | |||
#set ($title = $escapetool.velocity($pageDoc.plainTitle)) |
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 is wrong. You need XML escaping because you're printing the value below in HTML.
* Fixed indents * Fixed documentation * Fixed the ClassEditSheet.xml call.
Please add to the jira issue the exact WCAG problem (link to it) + mention if it's auto detected by Axe core or not, and if not, do we need to define a best practice for developers to avoid regressing on this (or other use cases) in the future. |
* @version $Id$ | ||
* @since 15.3RC1 | ||
*/ | ||
@Component(hints = {"doc", "page"}) |
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.
Not needed.
public String generateCreateTitle(ResourceReference reference) | ||
{ | ||
DocumentReference documentReference = | ||
this.currentDocumentReferenceResolver.resolve(reference.getReference()); |
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 will only work for DocumentResourceReference
and for other types, it'll cause a bug. For example SpaceResourceReference
references won't be resolved correctly. Same problem for a page
ResourceReference.
* Added implementations for other resource reference types. * Changed the l10n key names to be more specific TODO: * Fix tests
* Fixed the title on the wrong object in ClassEditSheet.xml * Took care of different cases in XWikiAttachmentWantedLinkTitleGenerator and XWikiDocumentWantedLinkTitleGenerator
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.
There is one missing escaping (see comment). I'm not 100% sure regarding the different resolver implementations but it looks good.
@@ -256,9 +256,13 @@ xcontext.put('propertyCustomDisplayer', new PropertyCustomDisplayer(xcontext)) | |||
#set ($class = 'wikicreatelink') | |||
#set ($action = 'create') | |||
#set ($discard = $params.put('parent', $doc.fullName)) | |||
#set ($title = $services.localization.render('core.create.inline.label',[$reference.name])) |
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.
Missing escaping (either here or where it is used).
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.
Addressed in 45a7315
* Escaped properly a title
* Updated since versions
Jira: https://jira.xwiki.org/browse/XWIKI-19383
See xwiki/xwiki-rendering#256 for the changes on xwiki-rendering.
PR Changes:
URITitleGenerator