Use colorpicker for projector header color config.

This commit is contained in:
Emanuel Schuetze 2016-02-21 22:03:25 +01:00
parent ba49781b39
commit 0613304724
5 changed files with 19 additions and 3 deletions

View File

@ -11,6 +11,7 @@
"angular-animate": "~1.4.9", "angular-animate": "~1.4.9",
"angular-sanitize": "~1.4.9", "angular-sanitize": "~1.4.9",
"angular-bootstrap": "~0.14.3", "angular-bootstrap": "~0.14.3",
"angular-bootstrap-colorpicker": "~3.0.24",
"angular-csv-import": "~0.0.27", "angular-csv-import": "~0.0.27",
"angular-formly-templates-bootstrap": "~6.2.0", "angular-formly-templates-bootstrap": "~6.2.0",
"angular-formly": "~7.3.9", "angular-formly": "~7.3.9",

View File

@ -9,7 +9,8 @@ INPUT_TYPE_MAPPING = {
'text': str, 'text': str,
'integer': int, 'integer': int,
'boolean': bool, 'boolean': bool,
'choice': str} 'choice': str,
'colorpicker': str}
class ConfigHandler: class ConfigHandler:

View File

@ -154,6 +154,7 @@ def setup_general_config(sender, **kwargs):
yield ConfigVariable( yield ConfigVariable(
name='projector_backgroundcolor', name='projector_backgroundcolor',
default_value='#317796', default_value='#317796',
input_type='colorpicker',
label=ugettext_lazy('Background color of projector header'), label=ugettext_lazy('Background color of projector header'),
help_text=ugettext_lazy('Use web color names like "red" or hex numbers like "#ff0000".'), help_text=ugettext_lazy('Use web color names like "red" or hex numbers like "#ff0000".'),
weight=160, weight=160,

View File

@ -7,6 +7,7 @@ angular.module('OpenSlidesApp.core.site', [
'OpenSlidesApp.core', 'OpenSlidesApp.core',
'ui.router', 'ui.router',
'angular-loading-bar', 'angular-loading-bar',
'colorpicker.module',
'formly', 'formly',
'formlyBootstrap', 'formlyBootstrap',
'ngBootbox', 'ngBootbox',
@ -402,6 +403,7 @@ angular.module('OpenSlidesApp.core.site', [
integer: 'number', integer: 'number',
boolean: 'checkbox', boolean: 'checkbox',
choice: 'choice', choice: 'choice',
colorpicker: 'colorpicker',
}[type]; }[type];
} }

View File

@ -2,19 +2,30 @@
<label>{{ label }}</label> <label>{{ label }}</label>
<div class="input-group"> <div class="input-group">
<input ng-if="type != 'choice' && type != 'textarea'" <!-- text/number input, checkbox -->
<input ng-if="type == 'text' || type == 'number' || type == 'checkbox'"
ng-model="$parent.value" ng-model="$parent.value"
ng-change="save(configOption.key, $parent.value)" ng-change="save(configOption.key, $parent.value)"
ng-class="{ 'form-control': type != 'checkbox' }" ng-class="{ 'form-control': type != 'checkbox' }"
id="{{ key }}" id="{{ key }}"
type="{{ type }}"> type="{{ type }}">
<!-- colorpicker -->
<input ng-if="type == 'colorpicker'"
colorpicker
class="form-control"
ng-model="$parent.value"
ng-change="save(configOption.key, $parent.value)"
type="text">
<!-- textarea -->
<textarea ng-if="type == 'textarea'" <textarea ng-if="type == 'textarea'"
ng-model="$parent.value" ng-model="$parent.value"
ng-change="save(configOption.key, $parent.value)" ng-change="save(configOption.key, $parent.value)"
id="{{ key }}" class="form-control"> id="{{ key }}" class="form-control">
</textarea> </textarea>
<!-- select -->
<select ng-if="type == 'choice'" <select ng-if="type == 'choice'"
ng-model="$parent.value" ng-model="$parent.value"
ng-change="save(configOption.key, $parent.value)" ng-change="save(configOption.key, $parent.value)"