Add a border to items in the filters of issues-list and backlog

stable
David Barragán Merino 2014-08-01 12:24:04 +02:00
parent 51eb587844
commit dfe4b81d5c
3 changed files with 82 additions and 27 deletions

View File

@ -42,14 +42,18 @@ BacklogFiltersDirective = ($log, $location) ->
<a class="single-filter active"
data-type="<%= f.type %>"
data-id="<%= f.id %>">
<span class="name"><%- f.name %></span>
<span class="name" <% if (f.color){ %>style="border-left: 3px solid <%= f.color %>;"<% } %>>
<%- f.name %>
</span>
<span class="number"><%- f.count %></span>
</a>
<% } else { %>
<a class="single-filter"
data-type="<%= f.type %>"
data-id="<%= f.id %>">
<span class="name"><%- f.name %></span>
<span class="name" <% if (f.color){ %>style="border-left: 3px solid <%= f.color %>;"<% } %>>
<%- f.name %>
</span>
<span class="number"><%- f.count %></span>
</a>
<% } %>
@ -61,7 +65,8 @@ BacklogFiltersDirective = ($log, $location) ->
<a class="single-filter selected"
data-type="<%= f.type %>"
data-id="<%= f.id %>">
<span class="name"><%- f.name %></span>
<span class="name" <% if (f.color){ %>style="border-left: 3px solid <%= f.color %>;"<% } %>>
<%- f.name %></span>
<span class="icon icon-delete"></span>
</a>
<% }) %>
@ -156,7 +161,6 @@ BacklogFiltersDirective = ($log, $location) ->
target = angular.element(event.currentTarget)
if target.hasClass("active")
target.removeClass("active")
# target.css("background-color")
else
target.addClass("active")

View File

@ -309,13 +309,24 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
plainTags = _.flatten(_.map(@scope.userstories, "tags"))
@scope.filters.tags = _.map _.countBy(plainTags), (v, k) ->
obj = {id:k, type:"tags", name: k, count:v}
obj = {
id: k,
type: "tags",
name: k,
count: v
}
obj.selected = true if isSelected("tags", obj.id)
return obj
plainStatuses = _.map(@scope.userstories, "status")
@scope.filters.statuses = _.map _.countBy(plainStatuses), (v, k) =>
obj = {id:k, type:"statuses", name: @scope.usStatusById[k].name, count:v}
obj = {
id: k,
type: "statuses",
name: @scope.usStatusById[k].name,
color: @scope.usStatusById[k].color,
count:v
}
obj.selected = true if isSelected("statuses", obj.id)
return obj
@ -340,8 +351,10 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
addNewUs: (type) ->
switch type
when "standard" then @rootscope.$broadcast("usform:new", @scope.projectId, @scope.project.default_us_status)
when "bulk" then @rootscope.$broadcast("usform:bulk", @scope.projectId, @scope.project.default_us_status)
when "standard" then @rootscope.$broadcast("usform:new", @scope.projectId,
@scope.project.default_us_status)
when "bulk" then @rootscope.$broadcast("usform:bulk", @scope.projectId,
@scope.project.default_us_status)
addNewSprint: () ->
@rootscope.$broadcast("sprintform:create")
@ -585,7 +598,9 @@ UsPointsDirective = ($repo) ->
showPopPoints = () ->
$el.find(".pop-points-open").remove()
$el.append(pointsTemplate({ "points": $scope.project.points }))
$el.find(".pop-points-open a[data-point-id='#{us.points[updatingSelectedRoleId]}']").addClass("active")
dataPointId = us.points[updatingSelectedRoleId]
$el.find(".pop-points-open a[data-point-id='#{dataPointId}']").addClass("active")
# If not showing role selection let's move to the left
if not $el.find(".pop-role:visible").css('left')?
$el.find(".pop-points-open").css('left', '110px')
@ -600,7 +615,8 @@ UsPointsDirective = ($repo) ->
return "?" if not val?
return val
_.map(rolePoints, (v, k) -> v.points = undefinedToQuestion($scope.pointsById[us.points[v.id]].value))
_.map rolePoints, (v, k) ->
v.points = undefinedToQuestion($scope.pointsById[us.points[v.id]].value)
$el.append(selectionTemplate({ "rolePoints": rolePoints }))
$el.find(".pop-role").show()
@ -728,7 +744,8 @@ tgBacklogGraphDirective = ->
lines:
fillColor : "rgba(153,51,51,0.3)"
})
client_increment_line = _.map(dataToDraw.milestones, (ml) -> -ml['team-increment']-ml['client-increment'])
client_increment_line = _.map dataToDraw.milestones, (ml) ->
-ml['team-increment'] - ml['client-increment']
data.push({
data: _.zip(milestonesRange, client_increment_line)
lines:

View File

@ -115,23 +115,44 @@ class IssuesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
return false
# Build filters data structure
@scope.filters.tags = _.map data.tags, (t) =>
obj = {id:t[0], name:t[0], count: t[1], type:"tags"}
obj.selected = true if isSelected("tags", obj.id)
return obj
@scope.filters.priorities = _.map data.priorities, (t) =>
obj = {id:t[0], name:@scope.priorityById[t[0]].name, count:t[1], type:"priorities"}
obj.selected = true if isSelected("priorities", obj.id)
@scope.filters.statuses = _.map data.statuses, (t) =>
obj = {
id: t[0],
name: @scope.issueStatusById[t[0]].name,
color: @scope.issueStatusById[t[0]].color,
count: t[1],
type: "statuses"}
obj.selected = true if isSelected("statuses", obj.id)
return obj
@scope.filters.severities = _.map data.severities, (t) =>
obj = {id:t[0], name:@scope.severityById[t[0]].name, count:t[1], type:"severities"}
obj = {
id: t[0],
name: @scope.severityById[t[0]].name,
color: @scope.severityById[t[0]].color,
count: t[1],
type: "severities"
}
obj.selected = true if isSelected("severities", obj.id)
return obj
@scope.filters.priorities = _.map data.priorities, (t) =>
obj = {
id: t[0],
name: @scope.priorityById[t[0]].name,
color: @scope.priorityById[t[0]].color
count: t[1],
type: "priorities"
}
obj.selected = true if isSelected("priorities", obj.id)
return obj
@scope.filters.assignedTo = _.map data.assigned_to, (t) =>
obj = {id:t[0], count:t[1], type:"assignedTo"}
obj = {
id:t[0],
count:t[1],
type:"assignedTo"
}
if t[0]
obj.name = @scope.usersById[t[0]].full_name_display
else
@ -140,11 +161,17 @@ class IssuesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
obj.selected = true if isSelected("assignedTo", obj.id)
return obj
@scope.filters.statuses = _.map data.statuses, (t) =>
obj = {id:t[0], name:@scope.issueStatusById[t[0]].name, count:t[1], type:"statuses"}
obj.selected = true if isSelected("statuses", obj.id)
@scope.filters.tags = _.map data.tags, (t) =>
obj = {
id: t[0],
name: t[0],
count: t[1],
type: "tags"
}
obj.selected = true if isSelected("tags", obj.id)
return obj
@rootscope.$broadcast("filters:loaded", @scope.filters)
return data
@ -371,14 +398,18 @@ IssuesFiltersDirective = ($log, $location) ->
<a class="single-filter active"
data-type="<%= f.type %>"
data-id="<%= f.id %>">
<span class="name"><%- f.name %></span>
<span class="name">
<%- f.name %>
</span>
<span class="number"><%- f.count %></span>
</a>
<% } else { %>
<a class="single-filter"
data-type="<%= f.type %>"
data-id="<%= f.id %>">
<span class="name"><%- f.name %></span>
<span class="name" <% if (f.color){ %>style="border-left: 3px solid <%- f.color %>;"<% } %>>
<%- f.name %>
</span>
<span class="number"><%- f.count %></span>
</a>
<% } %>
@ -390,7 +421,9 @@ IssuesFiltersDirective = ($log, $location) ->
<a class="single-filter selected"
data-type="<%= f.type %>"
data-id="<%= f.id %>">
<span class="name"><%- f.name %></span>
<span class="name" <% if (f.color){ %>style="border-left: 3px solid <%= f.color %>;"<% } %>>
<%- f.name %>
</span>
<span class="icon icon-delete"></span>
</a>
<% }) %>
@ -454,6 +487,7 @@ IssuesFiltersDirective = ($log, $location) ->
# Angular Watchers
$scope.$on "filters:loaded", (ctx, filters) ->
console.log filters
initializeSelectedFilters(filters)
selectSubjectFilter = debounce 400, (value) ->