Merge pull request #2760 from normanjaeckel/MotionTextIntro

Added global config for motion preamble.
This commit is contained in:
Norman Jäckel 2016-12-12 16:23:18 +01:00 committed by GitHub
commit 99db9b71b7
9 changed files with 29 additions and 9 deletions

View File

@ -37,6 +37,7 @@ Motions:
- Added blocks for motions which can set as agenda item. - Added blocks for motions which can set as agenda item.
Set states for multiple motions of a motion block by following Set states for multiple motions of a motion block by following
the recommendations of each motion. the recommendations of each motion.
- Used global config variable for preamble.
Users: Users:
- Added field is_committee and new default group Committees. - Added field is_committee and new default group Committees.

View File

@ -1155,7 +1155,9 @@ img {
.spacer-left-lg { .spacer-left-lg {
margin-left: 10px; margin-left: 10px;
} }
.no-padding {
padding: 0px;
}
.lead-div { .lead-div {
margin-bottom: 20px; margin-bottom: 20px;
} }

View File

@ -49,7 +49,7 @@ def get_config_variables():
yield ConfigVariable( yield ConfigVariable(
name='motions_preamble', name='motions_preamble',
default_value='The assembly may decide,', default_value='The assembly may decide:',
label='Motion preamble', label='Motion preamble',
weight=320, weight=320,
group='Motions', group='Motions',

View File

@ -11,7 +11,7 @@ angular.module('OpenSlidesApp.motions.docx', [])
'gettextCatalog', 'gettextCatalog',
'FileSaver', 'FileSaver',
function ($http, $q, Config, gettextCatalog, FileSaver) { function ($http, $q, Config, gettextCatalog, FileSaver) {
var PAGEBREAK = '<w:p><w:r><w:br w:type="page" /></w:r></w:p>'; var PAGEBREAK = '<w:p><w:r><w:br w:type="page" /></w:r></w:p>';
var TAGS_NO_PARAM = ['b', 'strong', 'em', 'i']; var TAGS_NO_PARAM = ['b', 'strong', 'em', 'i'];
@ -30,8 +30,8 @@ angular.module('OpenSlidesApp.motions.docx', [])
var d = today.getDate(); var d = today.getDate();
var m = today.getMonth()+1; //January is 0! var m = today.getMonth()+1; //January is 0!
var y = today.getFullYear(); var y = today.getFullYear();
if (d<10) { d='0'+d; } if (d<10) { d='0'+d; }
if (m<10) { m='0'+m; } if (m<10) { m='0'+m; }
return d+'.'+m+'.'+y; return d+'.'+m+'.'+y;
}(); }();
data.pagebreak_main = motions.length === 0 ? '' : PAGEBREAK; data.pagebreak_main = motions.length === 0 ? '' : PAGEBREAK;
@ -44,7 +44,7 @@ angular.module('OpenSlidesApp.motions.docx', [])
return data; return data;
}; };
var getCategoriesData = function (categories) { var getCategoriesData = function (categories) {
return _.map(categories, function (category) { return _.map(categories, function (category) {
return { return {
@ -83,6 +83,7 @@ angular.module('OpenSlidesApp.motions.docx', [])
signature_translation: signature_translation, signature_translation: signature_translation,
status_translation: status_translation, status_translation: status_translation,
status: motion.getStateName(), status: motion.getStateName(),
preamble: gettextCatalog.getString(Config.get('motions_preamble').value),
text: html2docx(motion.getText()), text: html2docx(motion.getText()),
reason_translation: motion.getReason().length === 0 ? '' : reason_translation, reason_translation: motion.getReason().length === 0 ? '' : reason_translation,
reason: html2docx(motion.getReason()), reason: html2docx(motion.getReason()),

View File

@ -248,6 +248,14 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
}]; }];
}; };
// motion preamble
var motionPreamble = function () {
return {
text: Config.translate(Config.get('motions_preamble').value),
margin: [0, 10, 0, 0]
};
};
// motion text (with line-numbers) // motion text (with line-numbers)
var motionText = function() { var motionText = function() {
@ -299,6 +307,7 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
subtitle, subtitle,
metaTable(), metaTable(),
motionTitle(), motionTitle(),
motionPreamble(),
motionText(), motionText(),
]; ];
if (motionReason()) { if (motionReason()) {

View File

@ -481,6 +481,9 @@ angular.module('OpenSlidesApp.motions.site', [
required: true required: true
} }
}, },
{
template: '<p class="spacer-top-lg no-padding">' + Config.translate(Config.get('motions_preamble').value) + '</p>'
},
{ {
key: 'text', key: 'text',
type: 'editor', type: 'editor',
@ -1396,8 +1399,6 @@ angular.module('OpenSlidesApp.motions.site', [
var isAmendment = $scope.$parent.motion && $scope.$parent.motion.id; var isAmendment = $scope.$parent.motion && $scope.$parent.motion.id;
// Set default values for create form // Set default values for create form
// ... set preamble config value as text
$scope.model.text = gettextCatalog.getString(Config.get('motions_preamble').value);
// ... for amendments add parent_id // ... for amendments add parent_id
if (isAmendment) { if (isAmendment) {
if (Config.get('motions_amendments_apply_text').value) { if (Config.get('motions_amendments_apply_text').value) {
@ -1946,7 +1947,7 @@ angular.module('OpenSlidesApp.motions.site', [
gettext('Serially numbered'); gettext('Serially numbered');
gettext('Set it manually'); gettext('Set it manually');
gettext('Motion preamble'); gettext('Motion preamble');
gettext('The assembly may decide,'); gettext('The assembly may decide:');
gettext('Default line numbering'); gettext('Default line numbering');
/// Line numbering: Outside /// Line numbering: Outside
gettext('Outside'); gettext('Outside');

View File

@ -343,6 +343,9 @@
<ng-include src="'static/templates/motions/motion-detail/toolbar.html'"></ng-include> <ng-include src="'static/templates/motions/motion-detail/toolbar.html'"></ng-include>
<div ng-class="{'col-sm-8': (lineNumberMode != 'outside'), 'col-sm-12': (lineNumberMode == 'outside')}"> <div ng-class="{'col-sm-8': (lineNumberMode != 'outside'), 'col-sm-12': (lineNumberMode == 'outside')}">
<div><p>{{ config('motions_preamble') | translate }}</p></div>
<div class="motion-text-holder"> <div class="motion-text-holder">
<!-- Original view --> <!-- Original view -->

View File

@ -75,6 +75,9 @@
</h2> </h2>
</div> </div>
<!-- Preamble -->
<div><p>{{ config('motions_preamble') | translate }}</p></div>
<!-- Text --> <!-- Text -->
<div ng-bind-html="motion.getTextWithLineBreaks(null, line, scroll) | trusted" <div ng-bind-html="motion.getTextWithLineBreaks(null, line, scroll) | trusted"
class="motion-text line-numbers-{{ config('motions_default_line_numbering') }}"></div> class="motion-text line-numbers-{{ config('motions_default_line_numbering') }}"></div>