Use ckeditor in config

This commit is contained in:
FinnStutzenstein 2017-01-06 10:00:31 +01:00
parent 11c0b0cc3f
commit 4530a5faed
5 changed files with 21 additions and 4 deletions

View File

@ -31,7 +31,8 @@ Core:
- Added template hook system for plugins. - Added template hook system for plugins.
- Made a lot of code clean up, improvements and bug fixes in client and - Made a lot of code clean up, improvements and bug fixes in client and
backend. backend.
- Use CKEditor for editing projector messages. - Use a separate dialog with CKEditor for editing projector messages.
- Use CKEditor in settings for text markup.
Motions: Motions:
- Added adjustable line numbering mode (outside, inside, none) for each - Added adjustable line numbering mode (outside, inside, none) for each

View File

@ -7,6 +7,7 @@ from .models import ConfigStore
INPUT_TYPE_MAPPING = { INPUT_TYPE_MAPPING = {
'string': str, 'string': str,
'text': str, 'text': str,
'markupText': str,
'integer': int, 'integer': int,
'boolean': bool, 'boolean': bool,
'choice': str, 'choice': str,

View File

@ -60,7 +60,7 @@ def get_config_variables():
'free web based presentation and assembly system for ' 'free web based presentation and assembly system for '
'visualizing and controlling agenda, motions and ' 'visualizing and controlling agenda, motions and '
'elections of an assembly.', 'elections of an assembly.',
input_type='text', input_type='markupText',
label='Legal notice', label='Legal notice',
weight=132, weight=132,
group='General', group='General',
@ -79,7 +79,7 @@ def get_config_variables():
yield ConfigVariable( yield ConfigVariable(
name='general_event_welcome_text', name='general_event_welcome_text',
default_value='[Space for your welcome text.]', default_value='[Space for your welcome text.]',
input_type='text', input_type='markupText',
label='Front page text', label='Front page text',
weight=136, weight=136,
group='General', group='General',

View File

@ -635,6 +635,7 @@ angular.module('OpenSlidesApp.core.site', [
return { return {
string: 'text', string: 'text',
text: 'textarea', text: 'textarea',
markupText: 'editor',
integer: 'number', integer: 'number',
boolean: 'checkbox', boolean: 'checkbox',
choice: 'choice', choice: 'choice',
@ -878,11 +879,17 @@ angular.module('OpenSlidesApp.core.site', [
'configOptions', 'configOptions',
'gettextCatalog', 'gettextCatalog',
'DateTimePickerTranslation', 'DateTimePickerTranslation',
function($scope, MajorityMethodChoices, Config, configOptions, gettextCatalog, DateTimePickerTranslation) { 'Editor',
function($scope, MajorityMethodChoices, Config, configOptions, gettextCatalog, DateTimePickerTranslation, Editor) {
Config.bindAll({}, $scope, 'configs'); Config.bindAll({}, $scope, 'configs');
$scope.configGroups = configOptions.data.config_groups; $scope.configGroups = configOptions.data.config_groups;
$scope.dateTimePickerTranslatedButtons = DateTimePickerTranslation.getButtons(); $scope.dateTimePickerTranslatedButtons = DateTimePickerTranslation.getButtons();
$scope.ckeditorOptions = Editor.getOptions();
$scope.ckeditorOptions.on.change = function (event) {
$scope.save(event.editor.element.$.id, this.getData());
};
// save changed config value // save changed config value
$scope.save = function(key, value) { $scope.save = function(key, value) {
Config.get(key).value = value; Config.get(key).value = value;

View File

@ -71,6 +71,14 @@
id="{{ key }}" class="form-control"> id="{{ key }}" class="form-control">
</textarea> </textarea>
<!-- editor -->
<textarea ng-if="type == 'editor'"
id="{{ configOption.key }}"
ckeditor="ckeditorOptions"
ng-model="$parent.value" class="form-control"
ng-model-options="{debounce: 1000}">
</textarea>
<!-- select --> <!-- select -->
<select ng-if="type == 'choice'" <select ng-if="type == 'choice'"
ng-model="$parent.value" ng-model="$parent.value"