fix #1397 - rename role
parent
4035766a70
commit
a3d1c4bc65
|
@ -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) ->
|
||||||
|
|
|
@ -17,9 +17,16 @@ 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
|
||||||
|
|
||||||
p.total
|
|
||||||
| {{ role.name }}
|
div(tg-edit-role)
|
||||||
span ({{ role.members_count }} members with this role)
|
.edit-role.hidden
|
||||||
|
input(type="text", value="{{ role.name }}")
|
||||||
|
a.save.icon.icon-floppy(href="", title="Save")
|
||||||
|
|
||||||
|
p.total
|
||||||
|
| {{ role.name }}
|
||||||
|
a.edit-value.icon.icon-edit
|
||||||
|
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
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue