Improving placeholders

stable
Alejandro Alonso 2015-09-16 14:51:34 +02:00
parent c0048dc845
commit b8cbd1e3d5
11 changed files with 49 additions and 23 deletions

View File

@ -61,6 +61,7 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
@scope.sectionName = @translate.instant("BACKLOG.SECTION_NAME") @scope.sectionName = @translate.instant("BACKLOG.SECTION_NAME")
@showTags = false @showTags = false
@activeFilters = false @activeFilters = false
@scope.showGraphPlaceholder = null
@.initializeEventHandlers() @.initializeEventHandlers()
@ -146,12 +147,14 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
loadProjectStats: -> loadProjectStats: ->
return @rs.projects.stats(@scope.projectId).then (stats) => return @rs.projects.stats(@scope.projectId).then (stats) =>
@scope.stats = stats @scope.stats = stats
totalPoints = if stats.total_points then stats.total_points else stats.defined_points
if stats.total_points if totalPoints
@scope.stats.completedPercentage = Math.round(100 * stats.closed_points / stats.total_points) @scope.stats.completedPercentage = Math.round(100 * stats.closed_points / totalPoints)
else else
@scope.stats.completedPercentage = 0 @scope.stats.completedPercentage = 0
@scope.showGraphPlaceholder = !(stats.total_points? && stats.total_milestones?)
return stats return stats
unloadClosedSprints: -> unloadClosedSprints: ->
@ -180,6 +183,8 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F
sprints = result.milestones sprints = result.milestones
@scope.totalClosedMilestones = result.closed @scope.totalClosedMilestones = result.closed
@scope.totalOpenMilestones = result.open
@scope.totalMilestones = @scope.totalOpenMilestones + @scope.totalClosedMilestones
# NOTE: Fix order of USs because the filter orderBy does not work propertly in partials files # NOTE: Fix order of USs because the filter orderBy does not work propertly in partials files
for sprint in sprints for sprint in sprints
@ -931,6 +936,8 @@ module.directive("tgBacklogUsPoints", ["$tgEstimationsService", "$tgRepo", "$tgT
ToggleBurndownVisibility = ($storage) -> ToggleBurndownVisibility = ($storage) ->
link = ($scope, $el, $attrs) -> link = ($scope, $el, $attrs) ->
hash = generateHash(["is-burndown-grpahs-collapsed"]) hash = generateHash(["is-burndown-grpahs-collapsed"])
$scope.isBurndownGraphCollapsed = $storage.get(hash) or false
toggleGraph = -> toggleGraph = ->
if $scope.isBurndownGraphCollapsed if $scope.isBurndownGraphCollapsed
$(".js-toggle-burndown-visibility-button").removeClass("active") $(".js-toggle-burndown-visibility-button").removeClass("active")
@ -939,7 +946,9 @@ ToggleBurndownVisibility = ($storage) ->
$(".js-toggle-burndown-visibility-button").addClass("active") $(".js-toggle-burndown-visibility-button").addClass("active")
$(".js-burndown-graph").addClass("open") $(".js-burndown-graph").addClass("open")
$scope.isBurndownGraphCollapsed = $storage.get(hash) or false $scope.$watch "showGraphPlaceholder", () ->
if $scope.showGraphPlaceholder?
$scope.isBurndownGraphCollapsed = $scope.isBurndownGraphCollapsed || $scope.showGraphPlaceholder
toggleGraph() toggleGraph()
$el.on "click", ".js-toggle-burndown-visibility-button", -> $el.on "click", ".js-toggle-burndown-visibility-button", ->
@ -951,7 +960,6 @@ ToggleBurndownVisibility = ($storage) ->
$el.off() $el.off()
return { return {
scope: {}
link: link link: link
} }
@ -1110,7 +1118,7 @@ TgBacklogProgressBarDirective = ($template, $compile) ->
$scope.$watch $attrs.tgBacklogProgressBar, (stats) -> $scope.$watch $attrs.tgBacklogProgressBar, (stats) ->
if stats? if stats?
totalPoints = stats.total_points totalPoints = if stats.total_points then stats.total_points else stats.defined_points
definedPoints = stats.defined_points definedPoints = stats.defined_points
closedPoints = stats.closed_points closedPoints = stats.closed_points
if definedPoints > totalPoints if definedPoints > totalPoints

View File

@ -157,6 +157,10 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
usByStatus[status.id] = _.sortBy(usByStatus[status.id], "kanban_order") usByStatus[status.id] = _.sortBy(usByStatus[status.id], "kanban_order")
if userstories.length == 0
status = @scope.usStatusList[0]
usByStatus[status.id].push({isPlaceholder: true})
@scope.usByStatus = usByStatus @scope.usByStatus = usByStatus
# The broadcast must be executed when the DOM has been fully reloaded. # The broadcast must be executed when the DOM has been fully reloaded.

View File

@ -74,10 +74,7 @@ CreateProject = ($rootscope, $repo, $confirm, $location, $navurls, $rs, $project
promise.then(onSuccessSubmit, onErrorSubmit) promise.then(onSuccessSubmit, onErrorSubmit)
openLightbox = -> openLightbox = ->
$scope.data = { $scope.data = {}
total_story_points: 100
total_milestones: 5
}
if !$scope.templates.length if !$scope.templates.length
$rs.projects.templates().then (result) => $rs.projects.templates().then (result) =>

View File

@ -184,6 +184,14 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin)
if @scope.usTasks[task.user_story]? and @scope.usTasks[task.user_story][task.status]? if @scope.usTasks[task.user_story]? and @scope.usTasks[task.user_story][task.status]?
@scope.usTasks[task.user_story][task.status].push(task) @scope.usTasks[task.user_story][task.status].push(task)
if tasks.length == 0
if @scope.userstories.length > 0
usId = @scope.userstories[0].id
else
usId = null
@scope.usTasks[usId][@scope.taskStatusList[0].id].push({isPlaceholder: true})
return tasks return tasks
loadTaskboard: -> loadTaskboard: ->

View File

@ -420,8 +420,8 @@
"PROJECT_DETAILS": "Project details", "PROJECT_DETAILS": "Project details",
"PROJECT_NAME": "Project name", "PROJECT_NAME": "Project name",
"PROJECT_SLUG": "Project slug", "PROJECT_SLUG": "Project slug",
"NUMBER_SPRINTS": "Number of sprints", "NUMBER_SPRINTS": "Number of sprints (0 for an undetermined quantity)",
"NUMBER_US_POINTS": "Number of US points", "NUMBER_US_POINTS": "Number of US points (0 for an undetermined quantity)",
"TAGS": "Tags", "TAGS": "Tags",
"DESCRIPTION": "Description", "DESCRIPTION": "Description",
"PUBLIC_PROJECT": "Public project", "PUBLIC_PROJECT": "Public project",

View File

@ -29,7 +29,7 @@ div.wrapper(tg-project-profile, ng-controller="ProjectProfileController as ctrl"
label(for="total-story-points", translate="ADMIN.PROJECT_PROFILE.NUMBER_US_POINTS") label(for="total-story-points", translate="ADMIN.PROJECT_PROFILE.NUMBER_US_POINTS")
input(type="number", name="total_story_points", min="0", placeholder="{{'ADMIN.PROJECT_PROFILE.NUMBER_US_POINTS' | translate}}", input(type="number", name="total_story_points", min="0", placeholder="{{'ADMIN.PROJECT_PROFILE.NUMBER_US_POINTS' | translate}}",
id="total-story-points", ng-model="project.total_story_points", id="total-story-points", ng-model="project.total_story_points",
data-type="digits", data-required="true") data-type="digits")
fieldset fieldset
label(for="tags", translate="ADMIN.PROJECT_PROFILE.TAGS") label(for="tags", translate="ADMIN.PROJECT_PROFILE.TAGS")

View File

@ -11,6 +11,8 @@ div.wrapper(tg-backlog, ng-controller="BacklogController as ctrl",
div.backlog-summary(tg-toggle-burndown-visibility) div.backlog-summary(tg-toggle-burndown-visibility)
include ../includes/components/summary include ../includes/components/summary
div(ng-if="showGraphPlaceholder") TODO PLACEHOLDER
div.graphics-container.burndown-container.js-burndown-graph div.graphics-container.burndown-container.js-burndown-graph
div.burndown(tg-burndown-backlog-graph) div.burndown(tg-burndown-backlog-graph)
include ../includes/modules/burndown include ../includes/modules/burndown

View File

@ -4,7 +4,7 @@ div.summary
div.data div.data
span.number(ng-bind="stats.completedPercentage + '%'") span.number(ng-bind="stats.completedPercentage + '%'")
div.summary-stats div.summary-stats(ng-if="stats.total_points")
span.number(ng-bind="stats.total_points") -- span.number(ng-bind="stats.total_points") --
span.description(translate="BACKLOG.SUMMARY.PROJECT_POINTS") span.description(translate="BACKLOG.SUMMARY.PROJECT_POINTS")
div.summary-stats div.summary-stats
@ -18,5 +18,8 @@ div.summary
span.description(translate="BACKLOG.SUMMARY.POINTS_PER_SPRINT") span.description(translate="BACKLOG.SUMMARY.POINTS_PER_SPRINT")
div.stats.js-toggle-burndown-visibility-button(title="{{'BACKLOG.SPRINT_SUMMARY.TOGGLE_BAKLOG_GRAPH' | translate}}") div.stats.js-toggle-burndown-visibility-button(
title="{{'BACKLOG.SPRINT_SUMMARY.TOGGLE_BAKLOG_GRAPH' | translate}}",
ng-if="!showGraphPlaceholder"
)
include ../../../svg/graph.svg include ../../../svg/graph.svg

View File

@ -1,5 +1,7 @@
div.taskboard-tagline(tg-colorize-tags="task.tags", tg-colorize-tags-type="taskboard") div(ng-show="task.isPlaceholder") TODO PLACEHOLDER
div.taskboard-task-inner
div.taskboard-tagline(ng-show="!task.isPlaceholder", tg-colorize-tags="task.tags", tg-colorize-tags-type="taskboard")
div.taskboard-task-inner(ng-show="!task.isPlaceholder")
div.taskboard-user-avatar(tg-taskboard-user-avatar, users="usersById", task="task", project="project", ng-class="{iocaine: task.is_iocaine}") div.taskboard-user-avatar(tg-taskboard-user-avatar, users="usersById", task="task", project="project", ng-class="{iocaine: task.is_iocaine}")
span.icon.icon-iocaine(ng-if="task.is_iocaine", title="{{'COMMON.IOCAINE_TEXT' | translate}}") span.icon.icon-iocaine(ng-if="task.is_iocaine", title="{{'COMMON.IOCAINE_TEXT' | translate}}")
p.taskboard-text p.taskboard-text

View File

@ -3,7 +3,7 @@ section.sprints
h1(translate="BACKLOG.SPRINTS.TITLE") h1(translate="BACKLOG.SPRINTS.TITLE")
div.summary div.summary
div.total-sprints div.total-sprints
span.number(ng-bind="project.total_milestones") -- span.number(ng-bind="totalMilestones") --
span.description(translate="BACKLOG.SPRINTS.NUMBER_SPRINTS") span.description(translate="BACKLOG.SPRINTS.NUMBER_SPRINTS")
a.button-green.add-sprint(href="", title="{{ 'BACKLOG.SPRINTS.TITLE_ACTION_NEW_SPRINT' | translate }}", a.button-green.add-sprint(href="", title="{{ 'BACKLOG.SPRINTS.TITLE_ACTION_NEW_SPRINT' | translate }}",
ng-click="ctrl.addNewSprint()", tg-check-permission="add_milestone") ng-click="ctrl.addNewSprint()", tg-check-permission="add_milestone")
@ -15,7 +15,7 @@ section.sprints
include sprint include sprint
a.filter-closed-sprints(href="", tg-backlog-toggle-closed-sprints-visualization, a.filter-closed-sprints(href="", tg-backlog-toggle-closed-sprints-visualization,
ng-show="totalClosedMilestones") ng-if="totalClosedMilestones")
span.icon.icon-archive span.icon.icon-archive
span.text(translate="BACKLOG.SPRINTS.ACTION_SHOW_CLOSED_SPRINTS") span.text(translate="BACKLOG.SPRINTS.ACTION_SHOW_CLOSED_SPRINTS")

View File

@ -1,5 +1,7 @@
div.kanban-tagline(tg-colorize-tags="us.tags", tg-colorize-tags-type="kanban", ng-hide="us.isArchived") div(ng-show="us.isPlaceholder") TODO PLACEHOLDER
div.kanban-task-inner(ng-class="{'task-archived': us.isArchived}")
div.kanban-tagline(ng-show="!us.isPlaceholder", tg-colorize-tags="us.tags", tg-colorize-tags-type="kanban", ng-hide="us.isArchived")
div.kanban-task-inner(ng-show="!us.isPlaceholder", ng-class="{'task-archived': us.isArchived}")
div.avatar-wrapper(tg-kanban-user-avatar="us.assigned_to", ng-model="us", ng-hide="us.isArchived") div.avatar-wrapper(tg-kanban-user-avatar="us.assigned_to", ng-model="us", ng-hide="us.isArchived")
div.task-text(ng-hide="us.isArchived") div.task-text(ng-hide="us.isArchived")
a.task-assigned(href="", title="{{'US.ASSIGN' | translate}}") a.task-assigned(href="", title="{{'US.ASSIGN' | translate}}")