Add votes counter to issues list and to the backlog

stable
Alejandro 2015-10-23 16:54:25 +02:00 committed by David Barragán Merino
parent 331b14f13f
commit 9d218fc2cb
5 changed files with 60 additions and 17 deletions

View File

@ -643,7 +643,7 @@ BacklogDirective = ($repo, $rootscope, $translate) ->
checkSelected = (target) -> checkSelected = (target) ->
lastChecked = target.closest(".us-item-row") lastChecked = target.closest(".us-item-row")
moveToCurrentSprintDom = $el.find("#move-to-current-sprint") moveToCurrentSprintDom = $el.find("#move-to-current-sprint")
selectedUsDom = $el.find(".backlog-table-body .user-stories input:checkbox:checked") selectedUsDom = $el.find(".backlog-table-body input:checkbox:checked")
if selectedUsDom.length > 0 and $scope.sprints.length > 0 if selectedUsDom.length > 0 and $scope.sprints.length > 0
moveToCurrentSprintDom.show() moveToCurrentSprintDom.show()
@ -658,7 +658,7 @@ BacklogDirective = ($repo, $rootscope, $translate) ->
return true return true
# Enable move to current sprint only when there are selected us's # Enable move to current sprint only when there are selected us's
$el.on "change", ".backlog-table-body .user-stories input:checkbox", (event) -> $el.on "change", ".backlog-table-body input:checkbox", (event) ->
# check elements between the last two if shift is pressed # check elements between the last two if shift is pressed
if lastChecked && shiftPressed if lastChecked && shiftPressed
elements = [] elements = []
@ -677,11 +677,12 @@ BacklogDirective = ($repo, $rootscope, $translate) ->
checkSelected(input) checkSelected(input)
target = angular.element(event.currentTarget) target = angular.element(event.currentTarget)
target.closest(".us-item-row").toggleClass('is-checked')
checkSelected(target) checkSelected(target)
$el.on "click", "#move-to-current-sprint", (event) => $el.on "click", "#move-to-current-sprint", (event) =>
# Calculating the us's to be modified # Calculating the us's to be modified
ussDom = $el.find(".backlog-table-body .user-stories input:checkbox:checked") ussDom = $el.find(".backlog-table-body input:checkbox:checked")
ussToMove = _.map ussDom, (item) -> ussToMove = _.map ussDom, (item) ->
item = $(item).closest('.tg-scope') item = $(item).closest('.tg-scope')

View File

@ -407,7 +407,7 @@ IssuesDirective = ($log, $location, $template, $compile) ->
# Draw the arrow the first time # Draw the arrow the first time
currentOrder = $ctrl.getUrlFilter("orderBy") or "created_date" currentOrder = $ctrl.getUrlFilter("orderBy") or "created_date"
if currentOrder if currentOrder
icon = if startswith(currentOrder, "-") then "icon-caret-up" else "icon-caret-down" icon = if startswith(currentOrder, "-") then "icon-arrow-up" else "icon-arrow-bottom"
colHeadElement = $el.find(".row.title > div[data-fieldname='#{trim(currentOrder, "-")}']") colHeadElement = $el.find(".row.title > div[data-fieldname='#{trim(currentOrder, "-")}']")
colHeadElement.html("#{colHeadElement.html()}<span class='icon #{icon}'></span>") colHeadElement.html("#{colHeadElement.html()}<span class='icon #{icon}'></span>")
@ -425,7 +425,7 @@ IssuesDirective = ($log, $location, $template, $compile) ->
$ctrl.loadIssues().then -> $ctrl.loadIssues().then ->
# Update the arrow # Update the arrow
$el.find(".row.title > div > span.icon").remove() $el.find(".row.title > div > span.icon").remove()
icon = if startswith(finalOrder, "-") then "icon-caret-up" else "icon-caret-down" icon = if startswith(finalOrder, "-") then "icon-arrow-up" else "icon-arrow-bottom"
target.html("#{target.html()}<span class='icon #{icon}'></span>") target.html("#{target.html()}<span class='icon #{icon}'></span>")
## Issues Link ## Issues Link

View File

@ -1,18 +1,44 @@
div.row.us-item-row(ng-repeat="us in userstories track by us.id", tg-bind-scope, ng-class="{blocked: us.is_blocked}", tg-class-permission="{'readonly': '!modify_us'}") div.row.us-item-row(
ng-repeat="us in userstories track by us.id"
tg-bind-scope
ng-class="{blocked: us.is_blocked}"
tg-class-permission="{'readonly': '!modify_us'}"
)
div.input
input(type="checkbox"
name=""
tg-check-permission="modify_us"
)
div.votes(
ng-class="{'inactive': !us.total_voters, 'is-voted': us.is_voter}"
title="{{ 'COMMON.VOTE_BUTTON.COUNTER_TITLE'|translate:{total:us.total_voters||0}:'messageformat' }}"
)
span.icon.icon-caret-up
span {{ ::us.total_voters }}
div.user-stories div.user-stories
div.tags-block(tg-colorize-tags="us.tags", tg-colorize-tags-type="backlog") div.tags-block(tg-colorize-tags="us.tags", tg-colorize-tags-type="backlog")
div.user-story-name div.user-story-name
input(tg-check-permission="modify_us", type="checkbox", name="") a.clickable(
a.clickable(tg-nav="project-userstories-detail:project=project.slug,ref=us.ref", href=""
tg-nav-get-params="{\"no-milestone\": 1}", tg-nav="project-userstories-detail:project=project.slug,ref=us.ref"
title="#{{ us.ref }} {{ us.subject }}") tg-nav-get-params="{\"no-milestone\": 1}"
title="#{{ us.ref }} {{ us.subject }}"
)
span(tg-bo-ref="us.ref") span(tg-bo-ref="us.ref")
span(ng-bind="us.subject") span(ng-bind="us.subject")
div.us-settings div.us-settings
a.icon.icon-edit(tg-check-permission="modify_us", href="", a.icon.icon-edit(
ng-click="ctrl.editUserStory(us.project, us.ref, $event)", title="{{'COMMON.EDIT' | translate}}") href=""
a.icon.icon-delete(tg-check-permission="delete_us", href="", tg-check-permission="modify_us"
ng-click="ctrl.deleteUserStory(us)", title="{{'COMMON.DELETE' | translate}}") ng-click="ctrl.editUserStory(us.project, us.ref, $event)"
title="{{'COMMON.EDIT' | translate}}"
)
a.icon.icon-delete(
href=""
tg-check-permission="delete_us"
ng-click="ctrl.deleteUserStory(us)"
title="{{'COMMON.DELETE' | translate}}"
)
div.status(tg-us-status="us" on-update="ctrl.updateUserStoryStatus()") div.status(tg-us-status="us" on-update="ctrl.updateUserStoryStatus()")
a.us-status(href="", title="{{'BACKLOG.STATUS_NAME' | translate}}") a.us-status(href="", title="{{'BACKLOG.STATUS_NAME' | translate}}")

View File

@ -1,5 +1,7 @@
div.backlog-table-header div.backlog-table-header
div.row.backlog-table-title div.row.backlog-table-title
div.input
div.votes(translate="COMMON.FIELDS.VOTES")
div.user-stories(translate="BACKLOG.TABLE.COLUMN_US") div.user-stories(translate="BACKLOG.TABLE.COLUMN_US")
div.status(translate="COMMON.FIELDS.STATUS") div.status(translate="COMMON.FIELDS.STATUS")
div.points(tg-us-role-points-selector, title="{{'BACKLOG.TABLE.TITLE_COLUMN_POINTS' | translate}}") div.points(tg-us-role-points-selector, title="{{'BACKLOG.TABLE.TITLE_COLUMN_POINTS' | translate}}")

View File

@ -3,6 +3,7 @@ section.issues-table.basic-table(ng-class="{empty: !issues.length}")
div.level-field(data-fieldname="type", translate="ISSUES.TABLE.COLUMNS.TYPE") div.level-field(data-fieldname="type", translate="ISSUES.TABLE.COLUMNS.TYPE")
div.level-field(data-fieldname="severity", translate="ISSUES.TABLE.COLUMNS.SEVERITY") div.level-field(data-fieldname="severity", translate="ISSUES.TABLE.COLUMNS.SEVERITY")
div.level-field(data-fieldname="priority", translate="ISSUES.TABLE.COLUMNS.PRIORITY") div.level-field(data-fieldname="priority", translate="ISSUES.TABLE.COLUMNS.PRIORITY")
div.votes(data-fieldname="total_voters", translate="ISSUES.TABLE.COLUMNS.VOTES")
div.subject(data-fieldname="subject", translate="ISSUES.TABLE.COLUMNS.SUBJECT") div.subject(data-fieldname="subject", translate="ISSUES.TABLE.COLUMNS.SUBJECT")
div.issue-field(data-fieldname="status", translate="ISSUES.TABLE.COLUMNS.STATUS") div.issue-field(data-fieldname="status", translate="ISSUES.TABLE.COLUMNS.STATUS")
div.created-field(data-fieldname="created_date", translate="ISSUES.TABLE.COLUMNS.CREATED") div.created-field(data-fieldname="created_date", translate="ISSUES.TABLE.COLUMNS.CREATED")
@ -15,9 +16,18 @@ section.issues-table.basic-table(ng-class="{empty: !issues.length}")
div.level-field(tg-listitem-type="issue") div.level-field(tg-listitem-type="issue")
div.level-field(tg-listitem-severity="issue") div.level-field(tg-listitem-severity="issue")
div.level-field(tg-listitem-priority="issue") div.level-field(tg-listitem-priority="issue")
div.votes(
ng-class="{'inactive': !issue.total_voters, 'is-voted': issue.is_voter}"
title="{{ 'COMMON.VOTE_BUTTON.COUNTER_TITLE'|translate:{total:issue.total_voters||0}:'messageformat' }}"
)
span.icon.icon-caret-up
span {{ ::issue.total_voters }}
div.subject div.subject
a(href="", tg-nav="project-issues-detail:project=project.slug,ref=issue.ref", a(
title="#{{ ::issue.ref }} {{ ::issue.subject }}") href=""
tg-nav="project-issues-detail:project=project.slug,ref=issue.ref"
title="#{{ ::issue.ref }} {{ ::issue.subject }}"
)
span(tg-bo-ref="issue.ref") span(tg-bo-ref="issue.ref")
span.blocked-text( span.blocked-text(
ng-if="issue.is_blocked" ng-if="issue.is_blocked"
@ -25,8 +35,12 @@ section.issues-table.basic-table(ng-class="{empty: !issues.length}")
) {{'ISSUES.TABLE.BLOCKED' | translate}} ) {{'ISSUES.TABLE.BLOCKED' | translate}}
span(ng-bind="issue.subject") span(ng-bind="issue.subject")
div.issue-field(tg-issue-status-inline-edition="issue") div.issue-field(tg-issue-status-inline-edition="issue")
a.issue-status(href="", title="{{'ISSUES.TABLE.TITLE_ACTION_CHANGE_STATUS' | translate}}") a.issue-status(
href=""
title="{{'ISSUES.TABLE.TITLE_ACTION_CHANGE_STATUS' | translate}}"
)
span.issue-status-bind span.issue-status-bind
span.icon.icon-arrow-bottom(tg-check-permission="modify_issue") span.icon.icon-arrow-bottom(tg-check-permission="modify_issue")