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