Edit styles when no description but editable is available
parent
d6f202a199
commit
03dbcbb4c8
|
@ -524,7 +524,7 @@ EditableDescriptionDirective = ($rootscope, $repo, $confirm, $compile, $loading)
|
||||||
</div>
|
</div>
|
||||||
""" # TODO: i18n
|
""" # TODO: i18n
|
||||||
noDescriptionMegEditMode = """
|
noDescriptionMegEditMode = """
|
||||||
<p class="no-description">
|
<p class="no-description editable">
|
||||||
No description yet, why don't you add a good one clicking here?
|
No description yet, why don't you add a good one clicking here?
|
||||||
</p>
|
</p>
|
||||||
""" # TODO: i18n
|
""" # TODO: i18n
|
||||||
|
@ -535,8 +535,8 @@ EditableDescriptionDirective = ($rootscope, $repo, $confirm, $compile, $loading)
|
||||||
""" # TODO: i18n
|
""" # TODO: i18n
|
||||||
|
|
||||||
link = ($scope, $el, $attrs, $model) ->
|
link = ($scope, $el, $attrs, $model) ->
|
||||||
$el.find('div.edit-description').hide()
|
$el.find('.edit-description').hide()
|
||||||
$el.find('div.view-description span.edit').hide()
|
$el.find('.view-description .edit').hide()
|
||||||
|
|
||||||
isEditable = ->
|
isEditable = ->
|
||||||
return $scope.project.my_permissions.indexOf($attrs.requiredPerm) != -1
|
return $scope.project.my_permissions.indexOf($attrs.requiredPerm) != -1
|
||||||
|
@ -547,8 +547,8 @@ EditableDescriptionDirective = ($rootscope, $repo, $confirm, $compile, $loading)
|
||||||
return if not isEditable()
|
return if not isEditable()
|
||||||
target = angular.element(event.target)
|
target = angular.element(event.target)
|
||||||
if not target.is('a')
|
if not target.is('a')
|
||||||
$el.find('div.edit-description').show()
|
$el.find('.edit-description').show()
|
||||||
$el.find('div.view-description').hide()
|
$el.find('.view-description').hide()
|
||||||
$el.find('textarea').focus()
|
$el.find('textarea').focus()
|
||||||
|
|
||||||
$el.on "click", ".save", ->
|
$el.on "click", ".save", ->
|
||||||
|
@ -559,8 +559,8 @@ EditableDescriptionDirective = ($rootscope, $repo, $confirm, $compile, $loading)
|
||||||
promise.then ->
|
promise.then ->
|
||||||
$confirm.notify("success")
|
$confirm.notify("success")
|
||||||
$rootscope.$broadcast("history:reload")
|
$rootscope.$broadcast("history:reload")
|
||||||
$el.find('div.edit-description').hide()
|
$el.find('.edit-description').hide()
|
||||||
$el.find('div.view-description').show()
|
$el.find('.view-description').show()
|
||||||
promise.then null, ->
|
promise.then null, ->
|
||||||
$confirm.notify("error")
|
$confirm.notify("error")
|
||||||
promise.finally ->
|
promise.finally ->
|
||||||
|
@ -569,17 +569,17 @@ EditableDescriptionDirective = ($rootscope, $repo, $confirm, $compile, $loading)
|
||||||
$el.on "keyup", "textarea", ->
|
$el.on "keyup", "textarea", ->
|
||||||
if event.keyCode == 27
|
if event.keyCode == 27
|
||||||
$scope.item.revert()
|
$scope.item.revert()
|
||||||
$el.find('div.edit-description').hide()
|
$el.find('.edit-description').hide()
|
||||||
$el.find('div.view-description').show()
|
$el.find('.view-description').show()
|
||||||
|
|
||||||
$scope.$watch $attrs.ngModel, (value) ->
|
$scope.$watch $attrs.ngModel, (value) ->
|
||||||
return if not value
|
return if not value
|
||||||
$scope.item = value
|
$scope.item = value
|
||||||
|
|
||||||
if isEditable()
|
if isEditable()
|
||||||
$el.find('div.view-description span.edit').show()
|
$el.find('.view-description .edit').show()
|
||||||
$scope.noDescriptionMsg = noDescriptionMegEditMode
|
|
||||||
$el.find('.view-description p').addClass('editable')
|
$el.find('.view-description p').addClass('editable')
|
||||||
|
$scope.noDescriptionMsg = noDescriptionMegEditMode
|
||||||
else
|
else
|
||||||
$scope.noDescriptionMsg = noDescriptionMegReadMode
|
$scope.noDescriptionMsg = noDescriptionMegReadMode
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue