Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

#tag_icons: added HtmlFragments.miniTagIconClass(Tag)

  • Loading branch information...
commit d7b618071503be566dc5ce2d4eb4342d94ae2f64 1 parent e5278bf
Daisuke Morita authored
2  src/main/java/marubinotto/piggydb/model/Tag.java
View
@@ -43,4 +43,6 @@ public int compare(Tag o1, Tag o2) {
public boolean isTrashTag();
public Long getFragmentId();
+
+ public boolean isTagFragment();
}
4 src/main/java/marubinotto/piggydb/model/entity/RawTag.java
View
@@ -119,6 +119,10 @@ public Long getFragmentId() {
public void setFragmentId(Long fragmentId) {
this.fragmentId = fragmentId;
}
+
+ public boolean isTagFragment() {
+ return this.fragmentId != null;
+ }
@Override
public int hashCode() {
14 src/main/java/marubinotto/piggydb/ui/page/common/HtmlFragments.java
View
@@ -3,6 +3,7 @@
import java.util.Map;
import marubinotto.piggydb.model.Fragment;
+import marubinotto.piggydb.model.Tag;
import marubinotto.piggydb.model.auth.User;
import marubinotto.piggydb.model.predicate.Preformatted;
import marubinotto.piggydb.ui.wiki.WikiParser;
@@ -194,6 +195,19 @@ public String miniTagIconClass(String tagName) {
return c;
}
+ public String miniTagIconClass(Tag tag) {
+ Assert.Arg.notNull(tag, "tag");
+
+ String c = "miniTagIcon";
+ if (tag.getName().startsWith("#")) {
+ c += " miniTagIcon-" + WebUtils.escapeHtml(tag.getName().substring(1));
+ }
+ else {
+ c += " miniTagIcon-" + (tag.isTagFragment() ? "fragment" : "plain");
+ }
+ return c;
+ }
+
public String fragmentsViewSwitch(String selectedMode, String pageIndexName, PageUrl pageUrl) {
Assert.Arg.notNull(selectedMode, "selectedMode");
Assert.Arg.notNull(pageIndexName, "pageIndexName");
2  src/main/webapp/macro/tag.vm
View
@@ -122,7 +122,7 @@ onclick="${jsPaletteRef}.onViewSwitchClick(this, '$type')"
<span class="tag-palette-draggable droppable-to-fragment">
<span class="tag">
- <span class="$html.miniTagIconClass($tag.name)"
+ <span class="$html.miniTagIconClass($tag)"
><img src="$context/images/empty.png" border="0" alt=""/></span>
<a class="tag" href="#" title="$tag.name"
onclick="${jsPaletteRef}.onTagSelect(this, ${tag.id}, '$utils.escapeJs($tag.name)', ${jsPaletteRef}); return false;">$tag.name</a>
8 src/main/webapp/style/piggydb-shared.css
View
@@ -524,6 +524,14 @@ span.miniTagIcon {
padding-right: 2px;
}
+span.miniTagIcon-plain {
+ background: url(images/mini-tag-plain.png) 0 50% no-repeat;
+}
+
+span.miniTagIcon-fragment {
+ background: url(images/mini-tag-fragment.png) 0 50% no-repeat;
+}
+
span.tagIcon-trash {
background: url(images/tag-trash.png) 0 50% no-repeat;
}
Please sign in to comment.
Something went wrong with that request. Please try again.