Save fold unfold status on storage

stable
Xavier Julián 2014-11-17 12:30:16 +01:00
parent 38bb85bdf0
commit 53745273e6
2 changed files with 18 additions and 7 deletions

View File

@ -359,22 +359,22 @@ module.directive("tgKanbanUserstory", ["$rootScope", KanbanUserstoryDirective])
## Kanban Squish Column Directive
#############################################################################
KanbanSquishColumnDirective = ->
KanbanSquishColumnDirective = (rs) ->
#TODO: Only header is folding/unfolding so
# 1. Save folded/unfolded column status.
# 2. Recalculate container width.
# 1. Recalculate container width.
link = ($scope, $el, $attrs) ->
$scope.folds = []
$scope.$on "project:loaded", (event, project) ->
$scope.folds = rs.kanban.getStatusColumnModes(project.id)
$scope.foldStatus = (status) ->
$scope.folds[status.id] = !!!$scope.folds[status.id]
if $scope.folds[status.id]
fold()
rs.kanban.storeStatusColumnModes($scope.projectId, $scope.folds)
return {link: link}
module.directive("tgKanbanSquishColumn", KanbanSquishColumnDirective)
module.directive("tgKanbanSquishColumn", ["$tgResources", KanbanSquishColumnDirective])
#############################################################################
## Kaban WIP Limit Directive

View File

@ -27,6 +27,7 @@ generateHash = taiga.generateHash
resourceProvider = ($storage) ->
service = {}
hashSuffixStatusViewModes = "kanban-statusviewmodels"
hashSuffixStatusColumnModes = "kanban-statuscolumnmodels"
service.storeStatusViewModes = (projectId, params) ->
ns = "#{projectId}:#{hashSuffixStatusViewModes}"
@ -38,6 +39,16 @@ resourceProvider = ($storage) ->
hash = generateHash([projectId, ns])
return $storage.get(hash) or {}
service.storeStatusColumnModes = (projectId, params) ->
ns = "#{projectId}:#{hashSuffixStatusColumnModes}"
hash = generateHash([projectId, ns])
$storage.set(hash, params)
service.getStatusColumnModes = (projectId) ->
ns = "#{projectId}:#{hashSuffixStatusColumnModes}"
hash = generateHash([projectId, ns])
return $storage.get(hash) or {}
return (instance) ->
instance.kanban = service