From 354d840ef66675953b6f31dc1ebf392441545450 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Mon, 25 Aug 2014 11:21:32 +0200 Subject: [PATCH] Improving sprint creation, now the date is the last one used --- app/coffee/modules/backlog/lightboxes.coffee | 15 ++++++++------- app/coffee/modules/backlog/main.coffee | 3 ++- app/coffee/modules/common/components.coffee | 11 +++++++++-- .../views/modules/invitation-login-form.jade | 2 +- app/partials/views/modules/login-form.jade | 2 +- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/app/coffee/modules/backlog/lightboxes.coffee b/app/coffee/modules/backlog/lightboxes.coffee index c787203a..e8b26f7c 100644 --- a/app/coffee/modules/backlog/lightboxes.coffee +++ b/app/coffee/modules/backlog/lightboxes.coffee @@ -31,7 +31,12 @@ module = angular.module("taigaBacklog") CreateEditSprint = ($repo, $confirm, $rs, $rootscope, lightboxService) -> link = ($scope, $el, attrs) -> createSprint = true - + $scope.sprint = { + project: null + name: null + estimated_start: null + estimated_finish: null + } # FIXME: form should be initialized once and used in # each submit... submit = -> @@ -70,12 +75,8 @@ CreateEditSprint = ($repo, $confirm, $rs, $rootscope, lightboxService) -> $scope.$on "sprintform:create", (event, projectId) -> createSprint = true - $scope.sprint = { - project: projectId - name: null - estimated_start: null - estimated_finish: null - } + $scope.sprint.project = projectId + $scope.sprint.name = null lastSprintNameDom = $el.find(".last-sprint-name") sprintName = $scope.sprints?[0].name diff --git a/app/coffee/modules/backlog/main.coffee b/app/coffee/modules/backlog/main.coffee index 3db8739c..beb51fbd 100644 --- a/app/coffee/modules/backlog/main.coffee +++ b/app/coffee/modules/backlog/main.coffee @@ -98,6 +98,7 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F @scope.sprints = sprints @scope.sprintsCounter = sprints.length @scope.sprintsById = groupBy(sprints, (x) -> x.id) + @rootscope.$broadcast("sprints:loaded", sprints) return sprints resetFilters: -> @@ -377,7 +378,7 @@ class BacklogController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.F obj.selected = true if isSelected("statuses", obj.id) return obj - + return @scope.filters ## Template actions diff --git a/app/coffee/modules/common/components.coffee b/app/coffee/modules/common/components.coffee index f7bd3dd2..85045aa1 100644 --- a/app/coffee/modules/common/components.coffee +++ b/app/coffee/modules/common/components.coffee @@ -82,14 +82,21 @@ module.directive("tgSprintProgressbar", SprintProgressBarDirective) DateSelectorDirective =-> link = ($scope, $el, $attrs, $model) -> $.selectedDate = null - $.picker = new Pikaday({ + $el.picker = new Pikaday({ field: $el[0] onSelect: (date) => $.selectedDate = date onOpen: => - $.picker.setDate($.selectedDate) if $.selectedDate? + $el.picker.setDate($.selectedDate) if $.selectedDate? }) + $scope.$on "sprints:loaded", (ctx, sprints) => + if sprints.length > 0 + estimatedStart = sprints[0].estimated_finish + $.selectedDate = estimatedStart + $el.val(estimatedStart) + $el.picker.setDate(estimatedStart) + return { link: link require: "ngModel" diff --git a/app/partials/views/modules/invitation-login-form.jade b/app/partials/views/modules/invitation-login-form.jade index b346ca02..949f97f7 100644 --- a/app/partials/views/modules/invitation-login-form.jade +++ b/app/partials/views/modules/invitation-login-form.jade @@ -1,7 +1,7 @@ form.login-form fieldset input(type="text", name="username", ng-model="dataLogin.username", data-required="true", - placeholder="Username or email") + placeholder="Username or email (case sensitive)") fieldset.login-password input(type="password", name="password", ng-model="dataLogin.password", data-required="true", placeholder="Password") diff --git a/app/partials/views/modules/login-form.jade b/app/partials/views/modules/login-form.jade index a3473ff7..fdd420f5 100644 --- a/app/partials/views/modules/login-form.jade +++ b/app/partials/views/modules/login-form.jade @@ -2,7 +2,7 @@ div.login-form-container(tg-login) form.login-form fieldset input(type="text", name="username", ng-model="data.username", data-required="true", - placeholder="Username or Email") + placeholder="Username or Email (case sensitive)") fieldset.login-password input(type="password", name="password", ng-model="data.password", data-required="true", placeholder="Password")