fix #1397 - rename role

stable
Juanfran 2014-10-22 08:54:38 +02:00 committed by Xavier Julián
parent 4035766a70
commit a3d1c4bc65
3 changed files with 61 additions and 3 deletions

View File

@ -123,6 +123,43 @@ class RolesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fil
module.controller("RolesController", RolesController) module.controller("RolesController", RolesController)
EditRoleDirective = ($repo, $confirm) ->
link = ($scope, $el, $attrs) ->
toggleView = ->
$el.find('.total').toggle()
$el.find('.edit-role').toggle()
submit = () ->
$scope.role.name = $el.find("input").val()
promise = $repo.save($scope.role)
promise.then ->
$confirm.notify("success")
promise.then null, (data) ->
$confirm.notify("error")
toggleView()
$el.on "click", "a.icon-edit", ->
toggleView()
$el.find("input").focus()
$el.on "click", "a.save", submit
$el.on "keyup", "input", ->
if event.keyCode == 13 # Enter key
submit()
else if event.keyCode == 27 # ESC key
toggleView()
$scope.$on "$destroy", ->
$el.off()
return {link:link}
module.directive("tgEditRole", ["$tgRepo", "$tgConfirm", EditRoleDirective])
RolesDirective = -> RolesDirective = ->
link = ($scope, $el, $attrs) -> link = ($scope, $el, $attrs) ->

View File

@ -17,8 +17,15 @@ block content
.action-buttons .action-buttons
a.button.button-red.delete-role(href="", title="Delete", ng-click="ctrl.delete()") Delete a.button.button-red.delete-role(href="", title="Delete", ng-click="ctrl.delete()") Delete
div(tg-edit-role)
.edit-role.hidden
input(type="text", value="{{ role.name }}")
a.save.icon.icon-floppy(href="", title="Save")
p.total p.total
| {{ role.name }} | {{ role.name }}
a.edit-value.icon.icon-edit
span ({{ role.members_count }} members with this role) span ({{ role.members_count }} members with this role)
div.any-computable-role(ng-hide="anyComputableRole") Be careful, no role in your project will be able to estimate the point value for user stories div.any-computable-role(ng-hide="anyComputableRole") Be careful, no role in your project will be able to estimate the point value for user stories

View File

@ -1,4 +1,18 @@
.admin-roles { .admin-roles {
.edit-value {
cursor: pointer;
margin-left: .5rem;
}
.edit-role {
@include table-flex(stretch, left, center, row, wrap);
margin-bottom: 1rem;
input {
width: auto;
}
.icon-floppy {
margin-left: .5rem;
}
}
.total { .total {
@extend %large; @extend %large;
@extend %title; @extend %title;