-
-
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?
Changes from 15 commits
8381449
bc0ab50
38d8f97
c54d463
b4205eb
d6c8fa0
50548b2
d85e48f
9f7c059
e6e1304
68639a6
79fc276
a88f48d
9b503b3
3cd61d7
8501c6a
069e949
1bcb011
1d2c7d7
45a7315
375bb2c
112f9f7
61c387b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* See the NOTICE file distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
package org.xwiki.rendering.internal.renderer; | ||
|
||
import javax.inject.Inject; | ||
import javax.inject.Named; | ||
import javax.inject.Singleton; | ||
|
||
import org.xwiki.component.annotation.Component; | ||
import org.xwiki.model.reference.DocumentReference; | ||
import org.xwiki.model.reference.DocumentReferenceResolver; | ||
import org.xwiki.rendering.listener.reference.ResourceReference; | ||
import org.xwiki.localization.ContextualLocalizationManager; | ||
import org.xwiki.rendering.renderer.reference.link.URITitleGenerator; | ||
|
||
/** | ||
* Generate link titles for document URIs. | ||
* | ||
* @version $Id$ | ||
* @since 15.3RC1 | ||
*/ | ||
@Component(hints = {"doc", "page"}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed. |
||
@Singleton | ||
public class XWikiDocumentURITitleGenerator implements URITitleGenerator | ||
{ | ||
@Inject | ||
private ContextualLocalizationManager contextLocalization; | ||
|
||
/** | ||
* Used to extract the document name part in a document reference. | ||
*/ | ||
@Inject | ||
@Named("current") | ||
private DocumentReferenceResolver<String> currentDocumentReferenceResolver; | ||
|
||
@Override | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. This will only work for |
||
return this.contextLocalization.getTranslationPlain("core.create.inline.label", | ||
documentReference.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.
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