Send option request for config page just once (Fixes #1813)
Add permission check in config template.
This commit is contained in:
parent
48781b95ba
commit
4d6aade16a
@ -281,11 +281,20 @@ angular.module('OpenSlidesApp.core', [
|
|||||||
])
|
])
|
||||||
|
|
||||||
.factory('Config', [
|
.factory('Config', [
|
||||||
|
'$http',
|
||||||
'DS',
|
'DS',
|
||||||
function(DS) {
|
function($http, DS) {
|
||||||
|
var configOptions;
|
||||||
return DS.defineResource({
|
return DS.defineResource({
|
||||||
name: 'core/config',
|
name: 'core/config',
|
||||||
idAttribute: 'key',
|
idAttribute: 'key',
|
||||||
|
configOptions: configOptions,
|
||||||
|
getConfigOptions: function () {
|
||||||
|
if (!this.configOptions) {
|
||||||
|
this.configOptions = $http({ 'method': 'OPTIONS', 'url': '/rest/core/config/' });
|
||||||
|
}
|
||||||
|
return this.configOptions;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -219,8 +219,8 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
url: '/config',
|
url: '/config',
|
||||||
controller: 'ConfigCtrl',
|
controller: 'ConfigCtrl',
|
||||||
resolve: {
|
resolve: {
|
||||||
configOption: function($http) {
|
configOptions: function(Config) {
|
||||||
return $http({ 'method': 'OPTIONS', 'url': '/rest/core/config/' });
|
return Config.getConfigOptions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -436,10 +436,10 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
.controller('ConfigCtrl', [
|
.controller('ConfigCtrl', [
|
||||||
'$scope',
|
'$scope',
|
||||||
'Config',
|
'Config',
|
||||||
'configOption',
|
'configOptions',
|
||||||
function($scope, Config, configOption) {
|
function($scope, Config, configOptions) {
|
||||||
Config.bindAll({}, $scope, 'configs');
|
Config.bindAll({}, $scope, 'configs');
|
||||||
$scope.configGroups = configOption.data.config_groups;
|
$scope.configGroups = configOptions.data.config_groups;
|
||||||
|
|
||||||
// save changed config value
|
// save changed config value
|
||||||
$scope.save = function(key, value) {
|
$scope.save = function(key, value) {
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="details">
|
<div class="details">
|
||||||
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
|
<div os-perms="core.can_manage_config" class="panel-group" id="accordion"
|
||||||
|
role="tablist" aria-multiselectable="true">
|
||||||
<!-- generate config groups -->
|
<!-- generate config groups -->
|
||||||
<div ng-repeat="group in configGroups">
|
<div ng-repeat="group in configGroups">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
|
Loading…
Reference in New Issue
Block a user