From 91bc269538e7093a2559fb8795d2e4463cd459a3 Mon Sep 17 00:00:00 2001 From: Juanfran Date: Fri, 11 Nov 2016 13:48:48 +0100 Subject: [PATCH] [Backport] fix issue #4673 - local storage epics column settings --- .../epics-table/epics-table.controller.coffee | 16 +++++++++++----- .../epics/dashboard/epics-table/epics-table.jade | 7 ++++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/modules/epics/dashboard/epics-table/epics-table.controller.coffee b/app/modules/epics/dashboard/epics-table/epics-table.controller.coffee index 57967021..ea993e71 100644 --- a/app/modules/epics/dashboard/epics-table/epics-table.controller.coffee +++ b/app/modules/epics/dashboard/epics-table/epics-table.controller.coffee @@ -18,19 +18,22 @@ ### taiga = @.taiga - +generateHash = @.taiga.generateHash class EpicsTableController @.$inject = [ "$tgConfirm", "tgEpicsService", - "$timeout" + "$timeout", + "$tgStorage", + "tgProjectService" ] - constructor: (@confirm, @epicsService, @timeout) -> + constructor: (@confirm, @epicsService, @timeout, @storage, @projectService) -> + @.hash = generateHash([@projectService.project.get('id'), 'epics']) @.displayOptions = false @.displayVotes = true - @.column = { + @.column = @storage.get(@.hash, { votes: true, name: true, project: true, @@ -38,7 +41,7 @@ class EpicsTableController assigned: true, status: true, progress: true - } + }) taiga.defineImmutableProperty @, 'epics', () => return @epicsService.epics taiga.defineImmutableProperty @, 'disabledEpicsPagination', () => return @epicsService._disablePagination @@ -62,4 +65,7 @@ class EpicsTableController hideEpicTableOption: () -> return @.timer = @timeout (=> @.displayOptions = false), 400 + updateViewOptions: () -> + @storage.set(@.hash, @.column) + angular.module("taigaEpics").controller("EpicsTableCtrl", EpicsTableController) diff --git a/app/modules/epics/dashboard/epics-table/epics-table.jade b/app/modules/epics/dashboard/epics-table/epics-table.jade index d9c0dfd4..90e4fa4a 100644 --- a/app/modules/epics/dashboard/epics-table/epics-table.jade +++ b/app/modules/epics/dashboard/epics-table/epics-table.jade @@ -6,6 +6,7 @@ mixin epicSwitch(name, model) type="checkbox" ng-checked= model ng-model= model + ng-change="vm.updateViewOptions()" ) div span.check-text.check-yes(translate="COMMON.YES") @@ -46,7 +47,7 @@ mixin epicSwitch(name, model) button.epics-table-option-button.e2e-epics-column-button(ng-click="vm.displayOptions = true") span(translate="EPICS.TABLE.VIEW_OPTIONS") tg-svg(svg-icon="icon-arrow-down") - form.epics-table-dropdown.e2e-epics-column-dropdown( + form.epics-table-dropdown.e2e-epics-column-dropdown.ng-hide( ng-show="vm.displayOptions" ng-mouseenter="vm.keepEpicTableOption()" ) @@ -86,7 +87,7 @@ mixin epicSwitch(name, model) for="switch-progress" ) +epicSwitch('switch-progress', 'vm.column.progress') - + .epics-table-body( tg-epics-sortable="vm.reorderEpic(epic, newIndex)" infinite-scroll="vm.nextPage()" @@ -101,5 +102,5 @@ mixin epicSwitch(name, model) epic="epic" column="vm.column" ) - + div(tg-loading="vm.loadingEpics")