summaryrefslogtreecommitdiff
path: root/web-ui/app/js/tags/ui/tag_shortcut.js
diff options
context:
space:
mode:
Diffstat (limited to 'web-ui/app/js/tags/ui/tag_shortcut.js')
-rw-r--r--web-ui/app/js/tags/ui/tag_shortcut.js35
1 files changed, 9 insertions, 26 deletions
diff --git a/web-ui/app/js/tags/ui/tag_shortcut.js b/web-ui/app/js/tags/ui/tag_shortcut.js
index 0fe92550..b5b76825 100644
--- a/web-ui/app/js/tags/ui/tag_shortcut.js
+++ b/web-ui/app/js/tags/ui/tag_shortcut.js
@@ -38,24 +38,25 @@ define(
function tagShortcut() {
- this.renderTemplate = function (linkTo) {
+ this.renderTemplate = function (tag, currentTag) {
var model = {
- tagName: linkTo.name,
- displayBadge: this.displayBadge(linkTo),
- badgeType: this.badgeType(linkTo),
- count: this.badgeType(linkTo) === 'total' ? linkTo.counts.total : (linkTo.counts.total - linkTo.counts.read),
- icon: iconFor[linkTo.name]
+ tagName: tag.name,
+ displayBadge: this.displayBadge(tag),
+ badgeType: this.badgeType(tag),
+ count: this.badgeType(tag) === 'total' ? tag.counts.total : (tag.counts.total - tag.counts.read),
+ icon: iconFor[tag.name],
+ selected: tag.name === currentTag ? 'selected' : ''
};
return templates.tags.shortcut(model);
};
this.renderAndAttach = function (parent, options) {
- parent.append(this.renderTemplate(options.linkTo));
+ parent.append(this.renderTemplate(options.tag, options.currentTag));
this.initialize(parent.children().last(), options);
};
this.reRender = function () {
- this.$node.html(this.renderTemplate(this.attr.linkTo));
+ this.$node.html(this.renderTemplate(this.attr.tag, this.attr.currentTag));
};
var iconFor = {
@@ -66,23 +67,6 @@ define(
'all': 'archive'
};
- this.selectTag = function (ev, data) {
- if (data.tag === this.attr.linkTo.name) {
- this.doSelect();
- }
- else {
- this.doUnselect();
- }
- };
-
- this.doUnselect = function () {
- this.$node.removeClass('selected');
- };
-
- this.doSelect = function () {
- this.$node.addClass('selected');
- };
-
this.doTeardown = function () {
if (!jQuery.contains(document, this.$node[0])) {
this.teardown();
@@ -93,7 +77,6 @@ define(
this.on('click', function () {
this.attr.trigger.triggerSelect();
});
- this.on(document, events.ui.tag.select, this.selectTag);
this.on(document, events.tags.shortcuts.teardown, this.doTeardown);
});