Merge pull request #1187 from taigaio/issue-4827-ordering-of-tags

Issue 4827; ordering of tags
stable
David Barragán Merino 2017-01-10 18:32:12 +01:00 committed by GitHub
commit 4d88daa6c6
2 changed files with 18 additions and 32 deletions

View File

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

View File

@ -17,7 +17,7 @@
tg-svg(svg-icon="icon-upvote") tg-svg(svg-icon="icon-upvote")
span {{ ::us.total_voters }} span {{ ::us.total_voters }}
.user-stories .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 .user-story-name
a.clickable( a.clickable(
href="" href=""