diff --git a/openslides/core/static/js/core.js b/openslides/core/static/js/core.js
index 5e141407d..7740c95f7 100644
--- a/openslides/core/static/js/core.js
+++ b/openslides/core/static/js/core.js
@@ -239,10 +239,21 @@ angular.module('OpenSlidesApp.core.site', ['OpenSlidesApp.core'])
abstract: true,
template: "",
})
+ // version
.state('version', {
url: '/version',
controller: 'VersionCtrl',
})
+ //config
+ .state('config', {
+ url: '/config',
+ controller: 'ConfigCtrl',
+ resolve: {
+ configOption: function($http) {
+ return $http({ 'method': 'OPTIONS', 'url': '/rest/config/config/' });
+ }
+ }
+ })
// customslide
.state('core.customslide', {
url: '/customslide',
@@ -331,6 +342,35 @@ angular.module('OpenSlidesApp.core.site', ['OpenSlidesApp.core'])
editableOptions.theme = 'bs3';
})
+
+// html-tag os-form-field to generate generic from fields
+// TODO: make it possible to use other fields then config fields
+.directive('osFormField', function($parse, Config) {
+ function getHtmlType(type) {
+ return {
+ string: 'text',
+ integer: 'number',
+ boolean: 'checkbox',
+ choice: 'radio',
+ }[type];
+ }
+
+ return {
+ restrict: 'E',
+ scope: true,
+ templateUrl: '/static/templates/config-form-field.html',
+ link: function ($scope, iElement, iAttrs, controller, transcludeFn) {
+ var field = $parse(iAttrs.field)($scope);
+ var config = Config.get(field.key);
+ $scope.type = getHtmlType(field.input_type);
+ $scope.label = field.label;
+ $scope.id = 'field-' + field.id;
+ $scope.value = config.value;
+ $scope.help_text = field.help_text;
+ }
+ }
+})
+
.controller("LanguageCtrl", function ($scope, gettextCatalog) {
// controller to switch app language
// TODO: detect browser language for default language
@@ -387,6 +427,23 @@ angular.module('OpenSlidesApp.core.site', ['OpenSlidesApp.core'])
});
})
+// Config Controller
+.controller('ConfigCtrl', function($scope, Config, configOption) {
+ Config.bindAll({}, $scope, 'configs');
+ $scope.configGroups = configOption.data.config_groups;
+
+ // save changed config value
+ $scope.save = function(key, value, type) {
+ // TODO: find a better way to check the type without using of
+ // the extra parameter 'type' from template
+ if (type == 'number') {
+ value = parseInt(value);
+ }
+ Config.get(key).value = value;
+ Config.save(key);
+ }
+})
+
// Customslide Controller
.controller('CustomslideListCtrl', function($scope, Customslide) {
Customslide.bindAll({}, $scope, 'customslides');
diff --git a/openslides/core/static/templates/config-form-field.html b/openslides/core/static/templates/config-form-field.html
new file mode 100644
index 000000000..c5348732b
--- /dev/null
+++ b/openslides/core/static/templates/config-form-field.html
@@ -0,0 +1,15 @@
+
diff --git a/openslides/core/static/templates/config.html b/openslides/core/static/templates/config.html
new file mode 100644
index 000000000..8548f6057
--- /dev/null
+++ b/openslides/core/static/templates/config.html
@@ -0,0 +1,27 @@
+Settings
+
+
+
+
+
+
+
+
+
+
{{ subgroup.name }}
+
+
+
+
+
+
+
+
+
diff --git a/openslides/core/static/templates/index.html b/openslides/core/static/templates/index.html
index 384fe4f5b..742a32719 100644
--- a/openslides/core/static/templates/index.html
+++ b/openslides/core/static/templates/index.html
@@ -163,7 +163,7 @@
Files
-
+
Settings
@@ -191,6 +191,7 @@
+