Adding lock/unlock to issue detail

stable
Alejandro Alonso 2014-07-04 10:00:45 +02:00
parent 34250f7779
commit bb52653c29
6 changed files with 76 additions and 17 deletions

View File

@ -91,6 +91,7 @@ modules = [
"taigaIssues",
"taigaSearch",
"taigaAdmin",
"taigaLightboxes",
# Vendor modules
"ngRoute",

View File

@ -86,6 +86,12 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
.then(=> @.loadUsersAndRoles())
.then(=> @.loadIssue())
block: ->
@rootscope.$broadcast("block", @scope.issue)
unblock: ->
@rootscope.$broadcast("unblock", @scope.issue)
module.controller("IssueDetailController", IssueDetailController)

View File

@ -0,0 +1,55 @@
###
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino Garcia <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán Merino <bameda@dbarragan.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# File: modules/lightboxes.coffee
###
module = angular.module("taigaLightboxes", [])
BlockDirective = () ->
link = ($scope, $el, $attrs, $model) ->
title = $attrs.title
$el.find("h2.title").text(title)
$scope.$on "block", ->
$el.removeClass("hidden")
$scope.$on "unblock", ->
$model.$modelValue.is_blocked = false
$model.$modelValue.blocked_note_html = ""
$scope.$on "$destroy", ->
$el.off()
$el.on "click", ".close", (event) ->
event.preventDefault()
$el.addClass("hidden")
$el.on "click", ".button-green", (event) ->
event.preventDefault()
target = angular.element(event.currentTarget)
$scope.$apply ->
$model.$modelValue.is_blocked = true
$model.$modelValue.blocked_note_html = $el.find(".reason").val()
$el.addClass("hidden")
return {link:link, require:"ngModel"}
module.directive("tgLbBlock", BlockDirective)

View File

@ -15,11 +15,11 @@ block content
div.us-title
input(type="text", ng-model="issue.subject")
// div.blocked-warning
// span.icon.icon-warning
// p.blocked Blocked!
// p We need Pilar to make a prototype out of this or we are not sure
// a.button.button-red.button-block(href="", title="Unblock US") Unblock
div.blocked-warning(ng-hide="!issue.is_blocked")
span.icon.icon-warning
p.blocked Blocked!
p(tg-bind-html="issue.blocked_note_html")
a.button.button-red.button-block.unblock(ng-click="ctrl.unblock()", href="", title="Unblock US") Unblock
div.user-story-tags(tg-tag-line, editable="true", ng-model="issue.tags")
@ -54,13 +54,11 @@ block content
//fieldset
// label.clickable.button.button-green(for="team-requirement", ng-class="{true:'active', false:''}[issue.team_requirement]") Team requirement
// input(ng-model="issue.team_requirement", type="checkbox", id="team-requirement", name="team-requirement")
fieldset
label.clickable.button.button-gray(for="blocked", ng-class="issue.is_blocked ? 'active' : ''") Block
input(ng-model="issue.is_blocked", type="checkbox", id="blocked", name="blocked")
a.button.button-gray.clickable(ng-hide="issue.is_blocked", ng-click="ctrl.block()") Block
a.button.button-red(href="") Delete
div.lightbox.lightbox_block.hidden
div.lightbox.lightbox_block.hidden(tg-lb-block, title="Blocking issue", ng-model="issue")
include views/modules/lightbox_block
div.lightbox.lightbox_select_user.hidden(tg-lb-add-assigned-to)

View File

@ -20,11 +20,10 @@ block content
a.icon.icon-arrow-left(href="", title="next issue")
a.icon.icon-arrow-right(href="", title="previous issue")
// div.blocked-warning
// span.icon.icon-warning
// p.blocked Blocked!
// p We need Pilar to make a prototype out of this or we are not sure
// a.button.button-red.button-block(href="", title="Unblock US") Unblock
div.blocked-warning(ng-hide="!issue.is_blocked")
span.icon.icon-warning
p.blocked Blocked!
p(tg-bind-html="issue.blocked_note_html")
div.user-story-tags(tg-tag-line, ng-model="issue.tags")
@ -53,7 +52,6 @@ block content
//TODO: remove commented from issues-detail when copied to user-story-detail
//span.button.button-gray Client requirement
//span.button.button-gray Team requirement
span.button.button-gray Block
div.lightbox.lightbox_block.hidden
include views/modules/lightbox_block

View File

@ -1,8 +1,9 @@
a.close(href="", title="close")
span.icon.icon-delete
form
h2.title Story blocked
h2.title
fieldset
textarea(placeholder="Please explain the reason")
textarea.reason(placeholder="Please explain the reason")
a.button.button-green(href="")
span Save