Editable tags on details

stable
Jesús Espino 2014-10-15 11:35:04 +02:00 committed by David Barragán Merino
parent 9cf3ca18f2
commit 242216bdd9
4 changed files with 12 additions and 5 deletions

View File

@ -91,7 +91,7 @@ module.directive("tgColorizeTags", ColorizeTagsDirective)
## TagLine (possible should be moved as generic directive) ## TagLine (possible should be moved as generic directive)
############################################################################# #############################################################################
TagLineDirective = ($log, $rs) -> TagLineDirective = ($log, $rs, $tgrepo) ->
# Main directive template (rendered by angular) # Main directive template (rendered by angular)
template = """ template = """
<div class="tags-container"></div> <div class="tags-container"></div>
@ -125,6 +125,7 @@ TagLineDirective = ($log, $rs) ->
link = ($scope, $el, $attrs, $model) -> link = ($scope, $el, $attrs, $model) ->
editable = if $attrs.editable == "true" then true else false editable = if $attrs.editable == "true" then true else false
$el.addClass("tags-block") $el.addClass("tags-block")
addValue = (value) -> addValue = (value) ->
@ -137,6 +138,9 @@ TagLineDirective = ($log, $rs) ->
$scope.$apply -> $scope.$apply ->
$model.$setViewValue(normalizeTags(tags)) $model.$setViewValue(normalizeTags(tags))
autosaveModel = $scope.$eval($attrs.autosaveModel)
if autosaveModel
$tgrepo.save(autosaveModel)
saveInputTag = () -> saveInputTag = () ->
input = $el.find('input') input = $el.find('input')
@ -204,6 +208,9 @@ TagLineDirective = ($log, $rs) ->
$scope.$apply -> $scope.$apply ->
$model.$setViewValue(normalizeTags(tags)) $model.$setViewValue(normalizeTags(tags))
autosaveModel = $scope.$eval($attrs.autosaveModel)
if autosaveModel
$tgrepo.save(autosaveModel)
return { return {
link:link, link:link,
@ -211,4 +218,4 @@ TagLineDirective = ($log, $rs) ->
template: template template: template
} }
module.directive("tgTagLine", ["$log", "$tgResources", TagLineDirective]) module.directive("tgTagLine", ["$log", "$tgResources", "$tgRepo", TagLineDirective])

View File

@ -31,7 +31,7 @@ block content
a.icon.icon-arrow-left(ng-show="previousUrl",href="{{ previousUrl }}", title="previous issue") a.icon.icon-arrow-left(ng-show="previousUrl",href="{{ previousUrl }}", title="previous issue")
a.icon.icon-arrow-right(ng-show="nextUrl", href="{{ nextUrl }}", title="next issue") a.icon.icon-arrow-right(ng-show="nextUrl", href="{{ nextUrl }}", title="next issue")
div(tg-tag-line, ng-model="issue.tags", ng-show="issue.tags") div(tg-tag-line, editable="true", autosave-model="issue", ng-model="issue.tags")
section.us-content.wysiwyg(tg-bind-html="issue.description_html") section.us-content.wysiwyg(tg-bind-html="issue.description_html")

View File

@ -34,7 +34,7 @@ block content
a.icon.icon-arrow-left(ng-show="previousUrl",href="{{ previousUrl }}", title="previous task") a.icon.icon-arrow-left(ng-show="previousUrl",href="{{ previousUrl }}", title="previous task")
a.icon.icon-arrow-right(ng-show="nextUrl", href="{{ nextUrl }}", title="next task") a.icon.icon-arrow-right(ng-show="nextUrl", href="{{ nextUrl }}", title="next task")
div(tg-tag-line, ng-model="task.tags", ng-show="task.tags") div(tg-tag-line, editable="true", autosave-model="task", ng-model="task.tags")
section.us-content.wysiwyg(tg-bind-html="task.description_html") section.us-content.wysiwyg(tg-bind-html="task.description_html")

View File

@ -36,7 +36,7 @@ block content
title="previous user story") title="previous user story")
a.icon.icon-arrow-right(ng-show="nextUrl", href="{{ nextUrl }}", title="next user story") a.icon.icon-arrow-right(ng-show="nextUrl", href="{{ nextUrl }}", title="next user story")
div(tg-tag-line, ng-model="us.tags", ng-show="us.tags") div(tg-tag-line, editable="true", autosave-model="us", ng-model="us.tags")
section.us-content.wysiwyg(tg-bind-html="us.description_html") section.us-content.wysiwyg(tg-bind-html="us.description_html")