From 2ffeea9e038413bbece2f65b55ec7f5860501afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Wed, 8 Oct 2014 22:22:15 +0200 Subject: [PATCH 1/5] US #675: Task #1241: Create the button to promote issue to US --- app/partials/issues-detail-edit.jade | 1 - app/partials/issues-detail.jade | 25 +++++++++++++++++++++++++ app/partials/us-detail.jade | 9 +++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/app/partials/issues-detail-edit.jade b/app/partials/issues-detail-edit.jade index 32e2aca0..4bcc146b 100644 --- a/app/partials/issues-detail-edit.jade +++ b/app/partials/issues-detail-edit.jade @@ -37,7 +37,6 @@ block content section.watchers(tg-watchers, ng-model="issue", editable="true") section.us-detail-settings - a.button.button-green.clickable() Promote to User Story a.button.button-gray.clickable(title="Click to block the issue", ng-show="!issue.is_blocked", ng-click="ctrl.block()") Block a.button.button-red(title="Click to delete the issue", tg-check-permission="delete_issue", ng-click="ctrl.delete()", href="") Delete diff --git a/app/partials/issues-detail.jade b/app/partials/issues-detail.jade index dfd6acc3..d003fe38 100644 --- a/app/partials/issues-detail.jade +++ b/app/partials/issues-detail.jade @@ -17,9 +17,26 @@ block content h2.us-title-text span.us-number(tg-bo-ref="issue.ref") span.us-name(ng-bind="issue.subject") + //- TODO: FIX ME + h3.us-related-task(ng-if="issue.generated_user_stories") + | From this issue have been generated the user stories + //- a(tg-check-permission="view_us", href="", title="Go to user story", + //- tg-nav="project-userstories-detail:project=project.slug, ref=us.ref", + //- ng-if="us") + //- span(tg-bo-ref="us.ref") + //- span(tg-bo-bind="us.subject") + ul + li(ng-repeat="us in issue.generated_user_stories") + a(tg-check-permission="view_us", href="", title="Go to user story", + tg-nav="project-userstories-detail:project=project.slug, ref=us.ref") + span(tg-bo-ref="us.ref") + span(tg-bo-bind="us.subject") + //- END TODO + p.block-desc-container(ng-show="issue.is_blocked") span.block-description-title Blocked span.block-description(tg-bind-html="issue.blocked_note || 'This issue is blocked'") + div.issue-nav a.icon.icon-arrow-left(ng-show="previousUrl",href="{{ previousUrl }}", title="previous issue") a.icon.icon-arrow-right(ng-show="nextUrl", href="{{ nextUrl }}", title="next issue") @@ -35,3 +52,11 @@ block content section.us-status(tg-issue-status, ng-model="issue") section.us-assigned-to(tg-assigned-to, ng-model="issue") section.watchers(tg-watchers, ng-model="issue") + + section.us-detail-settings + a.button.button-green.clickable(tg-check-permission="add_us", ng-click="ctrl.promoteToUs()", + href="") + Promote to User Story + + div.lightbox.lightbox-generic-form.lb-create-edit-userstory(tg-lb-create-edit-userstory) + include views/modules/lightbox-us-create-edit diff --git a/app/partials/us-detail.jade b/app/partials/us-detail.jade index 235021ea..b865c047 100644 --- a/app/partials/us-detail.jade +++ b/app/partials/us-detail.jade @@ -26,6 +26,15 @@ block content span.us-number(tg-bo-ref="us.ref") span.us-name(ng-bind="us.subject") + //- TODO: FIX ME + h3.us-related-task(ng-if="us.origin_issue") + | This user story comes from the issue + a(tg-check-permission="view_us", href="", title="Go to issue", + tg-nav="project-issues-detail:project=project.slug, ref=us.origin_issue.ref") + span(tg-bo-ref="us.origin_issue.ref") + span(tg-bo-bind="us.origin_issue.subject") + //- END TODO + p.block-desc-container(ng-show="us.is_blocked") span.block-description-title Blocked span.block-description(tg-bind-html="us.blocked_note || 'This user story is blocked'") From 000bde19d52510147b680ff43910ac4680680fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20Juli=C3=A1n?= Date: Thu, 9 Oct 2014 13:10:06 +0200 Subject: [PATCH 2/5] US #675: Task #1242: Add references to US in Issue --- app/partials/issues-detail.jade | 25 +++++++------------------ app/partials/issues.jade | 2 +- app/styles/layout/us-detail.scss | 21 +++++++++++++++++---- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/app/partials/issues-detail.jade b/app/partials/issues-detail.jade index d003fe38..19ffe3c9 100644 --- a/app/partials/issues-detail.jade +++ b/app/partials/issues-detail.jade @@ -17,21 +17,11 @@ block content h2.us-title-text span.us-number(tg-bo-ref="issue.ref") span.us-name(ng-bind="issue.subject") - //- TODO: FIX ME - h3.us-related-task(ng-if="issue.generated_user_stories") - | From this issue have been generated the user stories - //- a(tg-check-permission="view_us", href="", title="Go to user story", - //- tg-nav="project-userstories-detail:project=project.slug, ref=us.ref", - //- ng-if="us") - //- span(tg-bo-ref="us.ref") - //- span(tg-bo-bind="us.subject") - ul - li(ng-repeat="us in issue.generated_user_stories") - a(tg-check-permission="view_us", href="", title="Go to user story", - tg-nav="project-userstories-detail:project=project.slug, ref=us.ref") - span(tg-bo-ref="us.ref") - span(tg-bo-bind="us.subject") - //- END TODO + + p.us-related-task(ng-if="issue.generated_user_stories") This issue has been promoted to US: + a(ng-repeat="us in issue.generated_user_stories", tg-check-permission="view_us", href="", + tg-bo-title="us.subject", tg-nav="project-userstories-detail:project=project.slug, ref=us.ref") + span(tg-bo-ref="us.ref") p.block-desc-container(ng-show="issue.is_blocked") span.block-description-title Blocked @@ -54,9 +44,8 @@ block content section.watchers(tg-watchers, ng-model="issue") section.us-detail-settings - a.button.button-green.clickable(tg-check-permission="add_us", ng-click="ctrl.promoteToUs()", - href="") - Promote to User Story + a.button.button-gray.clickable(tg-check-permission="add_us", + ng-click="ctrl.promoteToUs()", href="") Promote to User Story div.lightbox.lightbox-generic-form.lb-create-edit-userstory(tg-lb-create-edit-userstory) include views/modules/lightbox-us-create-edit diff --git a/app/partials/issues.jade b/app/partials/issues.jade index 4b3552d7..a233c230 100644 --- a/app/partials/issues.jade +++ b/app/partials/issues.jade @@ -15,7 +15,7 @@ block content include views/modules/list-filters include views/modules/issues-table - // Paginator is rended using js. + // Paginator is rendered using js. div.paginator.issues-paginator div.lightbox.lightbox-select-user(tg-lb-assignedto) diff --git a/app/styles/layout/us-detail.scss b/app/styles/layout/us-detail.scss index 85dae2a5..98bebef4 100644 --- a/app/styles/layout/us-detail.scss +++ b/app/styles/layout/us-detail.scss @@ -17,8 +17,16 @@ margin-bottom: .5rem; } .us-number, - .us-name { + .us-name, + .us-related-task { color: $white; + a { + @include transition(color .3s linear); + color: $white; + &:hover { + color: $red-light; + } + } } .unblock { @extend %bold; @@ -35,6 +43,9 @@ } } } + p { + margin-bottom: 0; + } .us-edit-name-inner { @include table-flex(); } @@ -68,16 +79,18 @@ margin-top: .5rem; a { @include transition(color .3s linear); - color: lighten($grayer, 30%); - margin-left: .2rem; + border-left: 1px solid $gray-light; + padding: 0 .2rem; &:hover { color: $green-taiga; } + &:first-child { + border: 0; + } } } .block-desc-container { @extend %small; - margin: 0 0 1.2rem; } .block-description-title { @extend %bold; From 7958774361ebfbdf583f773f809fa629d25721be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20Juli=C3=A1n?= Date: Thu, 9 Oct 2014 13:13:44 +0200 Subject: [PATCH 3/5] US #675: Task #1243: Add reference from issue in US detail --- app/partials/us-detail.jade | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/partials/us-detail.jade b/app/partials/us-detail.jade index b865c047..afe78cac 100644 --- a/app/partials/us-detail.jade +++ b/app/partials/us-detail.jade @@ -26,14 +26,11 @@ block content span.us-number(tg-bo-ref="us.ref") span.us-name(ng-bind="us.subject") - //- TODO: FIX ME - h3.us-related-task(ng-if="us.origin_issue") - | This user story comes from the issue + p.us-related-task(ng-if="us.origin_issue") This US has been promoted from Issue a(tg-check-permission="view_us", href="", title="Go to issue", - tg-nav="project-issues-detail:project=project.slug, ref=us.origin_issue.ref") + tg-nav="project-issues-detail:project=project.slug, ref=us.origin_issue.ref" + tg-bo-title="us.origin_issue.subject") span(tg-bo-ref="us.origin_issue.ref") - span(tg-bo-bind="us.origin_issue.subject") - //- END TODO p.block-desc-container(ng-show="us.is_blocked") span.block-description-title Blocked From 22ec3ca70e6e007fa3d2bd750d1ddf647d25f178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Thu, 9 Oct 2014 18:01:08 +0200 Subject: [PATCH 4/5] US #675: Task #1247: Create the button action to call the api --- app/coffee/modules/common/confirm.coffee | 5 +- app/coffee/modules/issues/detail.coffee | 65 ++++++++++++++++++++++-- app/partials/issues-detail.jade | 6 +-- 3 files changed, 67 insertions(+), 9 deletions(-) diff --git a/app/coffee/modules/common/confirm.coffee b/app/coffee/modules/common/confirm.coffee index a0da50ac..8834066e 100644 --- a/app/coffee/modules/common/confirm.coffee +++ b/app/coffee/modules/common/confirm.coffee @@ -50,12 +50,15 @@ class ConfirmService extends taiga.Service el.off(".confirm-dialog") - ask: (title, subtitle, lightboxSelector=".lightbox_confirm-delete") -> + ask: (title, subtitle, message=null, lightboxSelector=".lightbox_confirm-delete") -> el = angular.element(lightboxSelector) # Render content el.find("h2.title").html(title) el.find("span.subtitle").html(subtitle) + if message + el.find("span.delete-question").html(message) + defered = @q.defer() # Assign event handlers diff --git a/app/coffee/modules/issues/detail.coffee b/app/coffee/modules/issues/detail.coffee index 2d9ae266..78c19e90 100644 --- a/app/coffee/modules/issues/detail.coffee +++ b/app/coffee/modules/issues/detail.coffee @@ -65,9 +65,12 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin) @location.replace() return @q.reject(xhr) - @scope.$on("attachment:create", => @rootscope.$broadcast("history:reload")) - @scope.$on("attachment:edit", => @rootscope.$broadcast("history:reload")) - @scope.$on("attachment:delete", => @rootscope.$broadcast("history:reload")) + @scope.$on "attachment:create", => @rootscope.$broadcast("history:reload") + @scope.$on "attachment:edit", => @rootscope.$broadcast("history:reload") + @scope.$on "attachment:delete", => @rootscope.$broadcast("history:reload") + @scope.$on "promote-issue-to-us:success", => + @rootscope.$broadcast("history:reload") + @.loadIssue() loadProject: -> return @rs.projects.get(@scope.projectId).then (project) => @@ -362,3 +365,59 @@ IssueStatusDirective = () -> return {link:link, require:"ngModel"} module.directive("tgIssueStatus", IssueStatusDirective) + + +############################################################################# +## Promote Issue to US button directive +############################################################################# + +PromoteIssueToUsButtonDirective = ($rootScope, $repo, $confirm) -> + template = _.template(""" + + Promote to User Story + + """) # TODO: i18n + + link = ($scope, $el, $attrs, $model) -> + $el.on "click", "a", (event) -> + event.preventDefault() + issue = $model.$modelValue + + title = "Promote this issue to a new user story" # TODO: i18n + message = "Are you sure you want to create a new US from this Issue?" # TODO: i18n + subtitle = issue.subject + + $confirm.ask(title, subtitle, message).then (finish) => + data = { + generated_from_issue: issue.id + project: issue.project, + subject: issue.subject + description: issue.description + tags: issue.tags + is_blocked: issue.is_blocked + blocked_note: issue.blocked_note + } + + onSuccess = -> + finish() + $confirm.notify("success") + $rootScope.$broadcast("promote-issue-to-us:success") + + onError = -> + finish(false) + $confirm.notify("error") + + $repo.create("userstories", data).then(onSuccess, onError) + + $scope.$on "$destroy", -> + $el.off() + + return { + restrict: "AE" + require: "ngModel" + template: template + link: link + } + +module.directive("tgPromoteIssueToUsButton", ["$rootScope", "$tgRepo", "$tgConfirm", + PromoteIssueToUsButtonDirective]) diff --git a/app/partials/issues-detail.jade b/app/partials/issues-detail.jade index 19ffe3c9..fba6c3dc 100644 --- a/app/partials/issues-detail.jade +++ b/app/partials/issues-detail.jade @@ -44,8 +44,4 @@ block content section.watchers(tg-watchers, ng-model="issue") section.us-detail-settings - a.button.button-gray.clickable(tg-check-permission="add_us", - ng-click="ctrl.promoteToUs()", href="") Promote to User Story - - div.lightbox.lightbox-generic-form.lb-create-edit-userstory(tg-lb-create-edit-userstory) - include views/modules/lightbox-us-create-edit + tg-promote-issue-to-us-button(ng-model="issue") From 805fd25f8f258211a35d9a950c7703cd5fda60a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Thu, 9 Oct 2014 18:12:43 +0200 Subject: [PATCH 5/5] US #675: Task #1269: Update changelog --- CHANGELOG.md | 6 ++++++ app/partials/issues-detail.jade | 6 ++++-- app/partials/us-detail.jade | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0c1b890..2434d416 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog # +## 1.1.0 (2014-10-19) + +### Features +- Promote an issue to a user story + + ## 1.0.0 (2014-10-07) ### Misc diff --git a/app/partials/issues-detail.jade b/app/partials/issues-detail.jade index fba6c3dc..15075c3a 100644 --- a/app/partials/issues-detail.jade +++ b/app/partials/issues-detail.jade @@ -19,8 +19,10 @@ block content span.us-name(ng-bind="issue.subject") p.us-related-task(ng-if="issue.generated_user_stories") This issue has been promoted to US: - a(ng-repeat="us in issue.generated_user_stories", tg-check-permission="view_us", href="", - tg-bo-title="us.subject", tg-nav="project-userstories-detail:project=project.slug, ref=us.ref") + a(ng-repeat="us in issue.generated_user_stories", + tg-check-permission="view_us", href="", + tg-bo-title="'#' + us.ref + ' ' + us.subject", + tg-nav="project-userstories-detail:project=project.slug, ref=us.ref") span(tg-bo-ref="us.ref") p.block-desc-container(ng-show="issue.is_blocked") diff --git a/app/partials/us-detail.jade b/app/partials/us-detail.jade index afe78cac..2553c7f4 100644 --- a/app/partials/us-detail.jade +++ b/app/partials/us-detail.jade @@ -29,7 +29,7 @@ block content p.us-related-task(ng-if="us.origin_issue") This US has been promoted from Issue a(tg-check-permission="view_us", href="", title="Go to issue", tg-nav="project-issues-detail:project=project.slug, ref=us.origin_issue.ref" - tg-bo-title="us.origin_issue.subject") + tg-bo-title="'#' + us.origin_issue.ref + ' ' + us.origin_issue.subject") span(tg-bo-ref="us.origin_issue.ref") p.block-desc-container(ng-show="us.is_blocked")