Add filtered sections to project settings

stable
Álex Hermida 2018-09-21 15:50:26 +02:00 committed by Alex Hermida
parent 417f9e97c7
commit 2fe9321fd3
3 changed files with 15 additions and 8 deletions

View File

@ -27,13 +27,14 @@ module = angular.module("taigaCommon")
SECTIONS = {
1: {id: 1, title: 'TIMELINE', path:'timeline'}
2: {id: 2, title: 'SEARCH', path:'search'}
3: {id: 3, title: 'BACKLOG', path:'backlog'}
4: {id: 4, title: 'KANBAN', path:'kanban'}
5: {id: 5, title: 'ISSUES', path:'issues'}
6: {id: 6, title: 'WIKI', path:'wiki'}
7: {id: 7, title: 'TEAM', path:'team'}
8: {id: 8, title: 'MEETUP', path:'meetup'}
9: {id: 9, title: 'ADMIN', path:'admin'}
3: {id: 3, title: 'EPICS', path:'epics'}
4: {id: 4, title: 'BACKLOG', path:'backlog'}
5: {id: 5, title: 'KANBAN', path:'kanban'}
6: {id: 6, title: 'ISSUES', path:'issues'}
7: {id: 7, title: 'WIKI', path:'wiki'}
8: {id: 8, title: 'TEAM', path:'team'}
9: {id: 9, title: 'MEETUP', path:'meetup'}
10: {id: 10, title: 'ADMIN', path:'admin'}
}
class SectionsService extends taiga.Service

View File

@ -44,6 +44,7 @@ class UserProjectSettingsController extends mixOf(taiga.Controller, taiga.PageMi
constructor: (@scope, @tgSections, @rs, @repo, @confirm) ->
@scope.sections = @tgSections.list()
promise = @.loadInitialData()
promise.then null, @.onInitialDataError.bind(@)
@ -60,4 +61,9 @@ class UserProjectSettingsController extends mixOf(taiga.Controller, taiga.PageMi
@repo.save(projectSettings).then(onSuccess, onError)
filteredSections: (projectSettings) ->
return _.filter @scope.sections, (section) ->
section.id in projectSettings.allowed_sections
module.controller("UserProjectSettingsController", UserProjectSettingsController)

View File

@ -28,6 +28,6 @@ div.wrapper(
select(
id="projects-settings-{{projectSettings.id}}-homepage-dropdown"
ng-model="projectSettings.homepage"
ng-options="section.id as section.title for section in sections"
ng-options="section.id as section.title for section in ctrl.filteredSections(projectSettings)"
ng-change="ctrl.updateCustomHomePage(projectSettings)"
)