Save homepage
parent
2dc9835913
commit
417f9e97c7
|
@ -37,6 +37,11 @@ SECTIONS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
class SectionsService extends taiga.Service
|
class SectionsService extends taiga.Service
|
||||||
|
@.$inject = ["$translate"]
|
||||||
|
|
||||||
|
constructor: (@translate) ->
|
||||||
|
super()
|
||||||
|
_.map(SECTIONS, (x) => x.title = @translate.instant("PROJECT.SECTION.#{x.title}"))
|
||||||
list: () ->
|
list: () ->
|
||||||
return SECTIONS
|
return SECTIONS
|
||||||
|
|
||||||
|
|
|
@ -43,23 +43,21 @@ class UserProjectSettingsController extends mixOf(taiga.Controller, taiga.PageMi
|
||||||
]
|
]
|
||||||
|
|
||||||
constructor: (@scope, @tgSections, @rs, @repo, @confirm) ->
|
constructor: (@scope, @tgSections, @rs, @repo, @confirm) ->
|
||||||
|
@scope.sections = @tgSections.list()
|
||||||
promise = @.loadInitialData()
|
promise = @.loadInitialData()
|
||||||
promise.then null, @.onInitialDataError.bind(@)
|
promise.then null, @.onInitialDataError.bind(@)
|
||||||
@scope.sections = @tgSections.list()
|
|
||||||
|
|
||||||
loadInitialData: ->
|
loadInitialData: ->
|
||||||
return @rs.userProjectSettings.list().then (userProjectSettings) =>
|
return @rs.userProjectSettings.list().then (userProjectSettings) =>
|
||||||
@scope.userProjectSettings = userProjectSettings
|
@scope.userProjectSettings = userProjectSettings
|
||||||
return userProjectSettings
|
|
||||||
|
|
||||||
updateCustomHomePage: (project, customHomePage) ->
|
updateCustomHomePage: (projectSettings) ->
|
||||||
onSuccess = =>
|
onSuccess = =>
|
||||||
@confirm.notify("success")
|
@confirm.notify("success")
|
||||||
|
|
||||||
onError = =>
|
onError = =>
|
||||||
@confirm.notify("error")
|
@confirm.notify("error")
|
||||||
|
|
||||||
# @repo.save(project).then(onSuccess, onError)
|
@repo.save(projectSettings).then(onSuccess, onError)
|
||||||
|
|
||||||
|
|
||||||
module.controller("UserProjectSettingsController", UserProjectSettingsController)
|
module.controller("UserProjectSettingsController", UserProjectSettingsController)
|
||||||
|
|
|
@ -27,11 +27,7 @@ div.wrapper(
|
||||||
.project-settings-table-homepage
|
.project-settings-table-homepage
|
||||||
select(
|
select(
|
||||||
id="projects-settings-{{projectSettings.id}}-homepage-dropdown"
|
id="projects-settings-{{projectSettings.id}}-homepage-dropdown"
|
||||||
)
|
ng-model="projectSettings.homepage"
|
||||||
option(
|
ng-options="section.id as section.title for section in sections"
|
||||||
ng-value="null"
|
ng-change="ctrl.updateCustomHomePage(projectSettings)"
|
||||||
) {{ 'USER_SETTINGS.PROJECT_SETTINGS.DEFAULT_VALUE' | translate }}
|
)
|
||||||
option(
|
|
||||||
ng-repeat="section in sections"
|
|
||||||
value="{{ section.id }}"
|
|
||||||
) {{ 'PROJECT.SECTION.' + section.title | translate }}
|
|
Loading…
Reference in New Issue