Issue 4827; ordering of tags

stable
Alejandro Alonso 2016-12-14 09:49:23 +01:00 committed by David Barragán Merino
parent d4c6e9069b
commit de4ab50e6d
2 changed files with 18 additions and 32 deletions

View File

@ -58,47 +58,33 @@ TagsDirective = ->
module.directive("tgTags", TagsDirective)
ColorizeTagsDirective = ->
templates = {
backlog: _.template("""
ColorizeTagsBacklogDirective = ->
template = _.template("""
<% _.each(tags, function(tag) { %>
<% if (tag[1] !== null) { %>
<span class="tag"
<% if (tag[1] !== null) { %>
style="border-left: 5px solid <%- tag[1] %>"
<% } %>
title="<%- tag[0] %>"><%- tag[0] %></span>
style="border-left: 5px solid <%- tag[1] %>"
title="<%- tag[0] %>">
<%- tag[0] %>
</span>
<% } %>
<% }) %>
""")
kanban: _.template("""
<% _.each(tags, function(tag) { %>
<a class="kanban-tag"
href=""
<% if (tag[1] !== null) { %>
style="border-color: <%- tag[1] %>"
<% } %>
title="<%- tag[0] %>" />
<% if (tag[1] === null) { %>
<span class="tag"
title="<%- tag[0] %>">
<%- tag[0] %>
</span>
<% } %>
<% }) %>
""")
taskboard: _.template("""
<% _.each(tags, function(tag) { %>
<a class="taskboard-tag"
href=""
<% if (tag[1] !== null) { %>
style="border-color: <%- tag[1] %>"
<% } %>
title="<%- tag[0] %>" />
<% }) %>
""")
}
""")
link = ($scope, $el, $attrs, $ctrl) ->
render = (tags) ->
template = templates[$attrs.tgColorizeTagsType]
html = template({tags: tags})
$el.html(html)
$scope.$watch $attrs.tgColorizeTags, (tags) ->
$scope.$watch $attrs.tgColorizeBacklogTags, (tags) ->
render(tags) if tags?
$scope.$on "$destroy", ->
@ -106,7 +92,7 @@ ColorizeTagsDirective = ->
return {link: link}
module.directive("tgColorizeTags", ColorizeTagsDirective)
module.directive("tgColorizeBacklogTags", ColorizeTagsBacklogDirective)
#############################################################################

View File

@ -17,7 +17,7 @@
tg-svg(svg-icon="icon-upvote")
span {{ ::us.total_voters }}
.user-stories
.tags-block(tg-colorize-tags="us.tags", tg-colorize-tags-type="backlog")
.tags-block(tg-colorize-backlog-tags="us.tags")
.user-story-name
a.clickable(
href=""