Skip to content

Commit

Permalink
Add rel and target attributes to link tag
Browse files Browse the repository at this point in the history
  • Loading branch information
shred committed Oct 6, 2018
1 parent 4222e30 commit 8164422
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cilla-web/src/main/java/org/shredzone/cilla/web/tag/LinkTag.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public class LinkTag extends BodyTagSupport implements Parameterizable {
private String styleClass; private String styleClass;
private String style; private String style;
private String title; private String title;
private String rel;
private String target;


private String view; private String view;
private String qualifier; private String qualifier;
Expand Down Expand Up @@ -111,6 +113,12 @@ public class LinkTag extends BodyTagSupport implements Parameterizable {
@TagParameter @TagParameter
public void setTitle(String title) { this.title = title; } public void setTitle(String title) { this.title = title; }


@TagParameter
public void setRel(String rel) { this.rel = rel; }

@TagParameter
public void setTarget(String target) { this.target = target; }

@TagParameter @TagParameter
public void setView(String view) { this.view = view; } public void setView(String view) { this.view = view; }


Expand Down Expand Up @@ -214,6 +222,14 @@ public int doEndTag() throws JspException {
linktag.append(" id=\"").append(HtmlUtils.htmlEscape(id)).append('"'); linktag.append(" id=\"").append(HtmlUtils.htmlEscape(id)).append('"');
} }


if (target != null) {
linktag.append(" target=\"").append(HtmlUtils.htmlEscape(target)).append('"');
}

if (rel != null) {
linktag.append(" rel=\"").append(HtmlUtils.htmlEscape(rel)).append('"');
}

if (onclick != null) { if (onclick != null) {
linktag.append(" onclick=\"").append(HtmlUtils.htmlEscape(onclick)).append('"'); linktag.append(" onclick=\"").append(HtmlUtils.htmlEscape(onclick)).append('"');
} }
Expand Down
2 changes: 2 additions & 0 deletions src/site/markdown/taglib/link.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ These parameters are optional:


* `anchor`: An anchor to append to the generated URL * `anchor`: An anchor to append to the generated URL
* `id`: `id` attribute of the generated `<a>` tag * `id`: `id` attribute of the generated `<a>` tag
* `target`: `target` attribute of the generated `<a>` tag
* `rel`: `rel` attribute of the generated `<a>` tag
* `title`: `title` attribute of the generated `<a>` tag * `title`: `title` attribute of the generated `<a>` tag
* `styleClass`: `class` attribute of the generated `<a>` tag * `styleClass`: `class` attribute of the generated `<a>` tag
* `style`: `style` attribute of the generated `<a>` tag * `style`: `style` attribute of the generated `<a>` tag
Expand Down

0 comments on commit 8164422

Please sign in to comment.