Fix some errors in the admin tag panel

stable
David Barragán Merino 2016-08-23 13:58:27 +02:00
parent 36e4c2e650
commit c583dd15b6
3 changed files with 15 additions and 12 deletions

View File

@ -716,7 +716,8 @@ class ProjectTagsController extends taiga.Controller
loadTags: => loadTags: =>
return @rs.projects.tagsColors(@scope.projectId).then (tags) => return @rs.projects.tagsColors(@scope.projectId).then (tags) =>
@scope.projectTagsAll = _.map(tags.getAttrs(), (color, name) => @model.make_model('tag', {name: name, color: color})) @scope.projectTagsAll = _.map(tags.getAttrs(), (color, name) =>
@model.make_model('tag', {name: name, color: color}))
@.filterAndSortTags() @.filterAndSortTags()
@.loading = false @.loading = false
@ -782,7 +783,7 @@ ProjectTagsDirective = ($log, $repo, $confirm, $location, animationFrame, $trans
initializeNewValue = -> initializeNewValue = ->
$scope.newValue = { $scope.newValue = {
"name": "" "tag": ""
"color": "" "color": ""
} }
@ -827,13 +828,13 @@ ProjectTagsDirective = ($log, $repo, $confirm, $location, animationFrame, $trans
promise = $ctrl.editTag(originalTag.name, tag.name, tag.color) promise = $ctrl.editTag(originalTag.name, tag.name, tag.color)
promise.then => promise.then =>
$ctrl.loadTags()
row = target.parents(".row.table-main") row = target.parents(".row.table-main")
row.addClass("hidden") row.addClass("hidden")
row.siblings(".visualization").removeClass('hidden') row.siblings(".visualization").removeClass('hidden')
$ctrl.loadTags()
promise.then null, (data) -> promise.then null, (response) ->
form.setErrors(data) form.setErrors(response.data)
saveNewValue = (target) -> saveNewValue = (target) ->
formEl = target.parents("form") formEl = target.parents("form")
@ -841,14 +842,14 @@ ProjectTagsDirective = ($log, $repo, $confirm, $location, animationFrame, $trans
form = formEl.checksley() form = formEl.checksley()
return if not form.validate() return if not form.validate()
promise = $ctrl.createTag($scope.newValue.name, $scope.newValue.color) promise = $ctrl.createTag($scope.newValue.tag, $scope.newValue.color)
promise.then (data) => promise.then (data) =>
target.addClass("hidden") target.addClass("hidden")
$ctrl.loadTags() $ctrl.loadTags()
initializeNewValue() initializeNewValue()
promise.then null, (data) -> promise.then null, (response) ->
form.setErrors(data) form.setErrors(response.data)
cancel = (target) -> cancel = (target) ->
row = target.parents(".row.table-main") row = target.parents(".row.table-main")
@ -964,4 +965,5 @@ ProjectTagsDirective = ($log, $repo, $confirm, $location, animationFrame, $trans
return {link:link} return {link:link}
module.directive("tgProjectTags", ["$log", "$tgRepo", "$tgConfirm", "$tgLocation", "animationFrame", "$translate", "$rootScope", ProjectTagsDirective]) module.directive("tgProjectTags", ["$log", "$tgRepo", "$tgConfirm", "$tgLocation", "animationFrame",
"$translate", "$rootScope", ProjectTagsDirective])

View File

@ -22,10 +22,10 @@ section
.tag-name .tag-name
input( input(
name="name" name="tag"
type="text" type="text"
placeholder="{{'ADMIN.TYPES.PLACEHOLDER_WRITE_NAME' | translate}}", placeholder="{{'ADMIN.TYPES.PLACEHOLDER_WRITE_NAME' | translate}}",
ng-model="newValue.name" ng-model="newValue.tag"
data-required="true" data-required="true"
data-maxlength="255" data-maxlength="255"
) )
@ -118,7 +118,7 @@ section
.status-name .status-name
input( input(
name="name" name="to_tag"
type="text" type="text"
placeholder="{{'ADMIN.TYPES.PLACEHOLDER_WRITE_NAME' | translate}}", placeholder="{{'ADMIN.TYPES.PLACEHOLDER_WRITE_NAME' | translate}}",
ng-model="tag.name" ng-model="tag.name"

View File

@ -46,6 +46,7 @@
} }
.row { .row {
&.header-tag-row { &.header-tag-row {
cursor: default;
padding-left: 1rem; padding-left: 1rem;
} }
} }