Motion template improvements (Fixed #3303)

- Sort categories drop downs by config value (name or prefix) (fixed #3303).
- Show comment fiels in pdf without "Comment" as prefix.
- Improved heading style in web and pdf.
- Added motion block to motion pdf.
This commit is contained in:
Emanuel Schütze 2017-10-11 22:45:01 +02:00
parent 721064700a
commit 17959bd9c5
8 changed files with 45 additions and 18 deletions

View File

@ -46,6 +46,19 @@ h1, h2, h3, h4, h5, h6, #header .title {
#content .col1 .meta .heading .drop-down-name, #content .col1 .meta h3 { #content .col1 .meta .heading .drop-down-name, #content .col1 .meta h3 {
font-family: 'Roboto Condensed Light'; font-family: 'Roboto Condensed Light';
} }
.details h1 {
font-size: 20px;
color: #000;
}
.details h2 {
font-size: 18px;
color: #000;
}
.details h3 {
font-size: 16px;
color: #000;
}
/* /*
* Template styles for OpenSlides site * Template styles for OpenSlides site

View File

@ -324,13 +324,13 @@ angular.module('OpenSlidesApp.motions.lineNumbering', [])
} }
break; break;
case 'H1': case 'H1':
newLength *= 0.5; newLength *= 0.66;
break; break;
case 'H2': case 'H2':
newLength *= 0.66; newLength *= 0.75;
break; break;
case 'H3': case 'H3':
newLength *= 0.66; newLength *= 0.85;
break; break;
} }
return Math.ceil(newLength); return Math.ceil(newLength);

View File

@ -127,6 +127,18 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
]); ]);
} }
// motion block
if (motion.motionBlock) {
metaTableBody.push([
{
text: gettextCatalog.getString('Motion block') + ':',
style: ['bold', 'grey'] },
{
text: motion.motionBlock.title,
style: 'grey'
}
]);
}
// voting result // voting result
if (motion.polls.length > 0 && motion.polls[0].has_votes) { if (motion.polls.length > 0 && motion.polls[0].has_votes) {
var column1 = []; var column1 = [];
@ -313,7 +325,7 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
var comments = []; var comments = [];
_.forEach(fields, function (field, id) { _.forEach(fields, function (field, id) {
if (motion.comments[id]) { if (motion.comments[id]) {
var title = gettextCatalog.getString('Comment') + ' ' + field.name; var title = field.name;
if (!field.public) { if (!field.public) {
title += ' (' + gettextCatalog.getString('internal') + ')'; title += ' (' + gettextCatalog.getString('internal') + ')';
} }
@ -1020,7 +1032,7 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
var content = []; var content = [];
_.forEach(fields, function (field, id) { _.forEach(fields, function (field, id) {
if (motion.comments[id]) { if (motion.comments[id]) {
var title = gettextCatalog.getString('Comment') + ' ' + field.name; var title = field.name;
if (!field.public) { if (!field.public) {
title += ' (' + gettextCatalog.getString('internal') + ')'; title += ' (' + gettextCatalog.getString('internal') + ')';
} }

View File

@ -235,7 +235,7 @@
<i class="fa fa-cog"></i> <i class="fa fa-cog"></i>
</span> </span>
<ul class="dropdown-menu" aria-labelledby="category-dropdown"> <ul class="dropdown-menu" aria-labelledby="category-dropdown">
<li ng-repeat="category in categories"> <li ng-repeat="category in categories | orderBy: config('motions_export_category_sorting')">
<a href ng-click="toggleCategory(category)"> <a href ng-click="toggleCategory(category)">
<i class="fa fa-check" ng-if="category.id == motion.category.id"></i> <i class="fa fa-check" ng-if="category.id == motion.category.id"></i>
{{ category.prefix }} &ndash; {{ category.name }} {{ category.prefix }} &ndash; {{ category.name }}

View File

@ -21,7 +21,7 @@
</button> </button>
</span> </span>
</div> </div>
<h3 class="toolbar-left" translate>Comments</h3> <h1 class="toolbar-left" translate>Comments</h1>
</div> </div>
<!-- comment fields --> <!-- comment fields -->
<div class="col-sm-12"> <div class="col-sm-12">

View File

@ -22,7 +22,7 @@
<i class="fa fa-thumb-tack" ng-class="{'rotate-45-deg-right': !personalNotePinned}"></i> <i class="fa fa-thumb-tack" ng-class="{'rotate-45-deg-right': !personalNotePinned}"></i>
</button> </button>
</div> </div>
<h3 class="toolbar-left" translate>Personal note</h3> <h1 class="toolbar-left" translate>Personal note</h1>
</div> </div>
<!-- personal note editor field --> <!-- personal note editor field -->

View File

@ -85,7 +85,8 @@
<!-- category select --> <!-- category select -->
<select ng-show="selectedAction == 'setCategory'" ng-model="selectedCategory" class="form-control input-sm"> <select ng-show="selectedAction == 'setCategory'" ng-model="selectedCategory" class="form-control input-sm">
<option value="" translate>--- Select category ---</option> <option value="" translate>--- Select category ---</option>
<option ng-repeat="category in categories" value="{{ category.id }}"> <option ng-repeat="category in categories | orderBy: config('motions_export_category_sorting')"
value="{{ category.id }}">
{{ category.prefix }} &ndash; {{ category.name }} {{ category.prefix }} &ndash; {{ category.name }}
</option> </option>
<option value="no_category_selected" translate>No category</option> <option value="no_category_selected" translate>No category</option>
@ -205,7 +206,7 @@
<span class="caret"></span> <span class="caret"></span>
</span> </span>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownCategory"> <ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownCategory">
<li ng-repeat="category in categories"> <li ng-repeat="category in categories | orderBy: config('motions_export_category_sorting')">
<a href ng-click="filter.operateMultiselectFilter('category', category.id, isSelectMode)"> <a href ng-click="filter.operateMultiselectFilter('category', category.id, isSelectMode)">
<i class="fa fa-check" ng-if="filter.multiselectFilters.category.indexOf(category.id) > -1"></i> <i class="fa fa-check" ng-if="filter.multiselectFilters.category.indexOf(category.id) > -1"></i>
{{ category.prefix }} &ndash; {{ category.name }} {{ category.prefix }} &ndash; {{ category.name }}
@ -391,7 +392,8 @@
<translate>done</translate> <translate>done</translate>
</span> </span>
<!-- category --> <!-- category -->
<span ng-repeat="category in categories" class="pointer spacer-left-lg" <span ng-repeat="category in categories | orderBy: config('motions_export_category_sorting')"
class="pointer spacer-left-lg"
ng-if="filter.multiselectFilters.category.indexOf(category.id) > -1" ng-if="filter.multiselectFilters.category.indexOf(category.id) > -1"
ng-click="filter.operateMultiselectFilter('category', category.id, isSelectMode)" ng-click="filter.operateMultiselectFilter('category', category.id, isSelectMode)"
ng-class="{'disabled': isSelectMode}"> ng-class="{'disabled': isSelectMode}">
@ -625,7 +627,7 @@
</span> </span>
</span> </span>
<ul class="dropdown-menu" aria-labelledby="dropdownCategory{{ motion.id }}"> <ul class="dropdown-menu" aria-labelledby="dropdownCategory{{ motion.id }}">
<li ng-repeat="category in categories"> <li ng-repeat="category in categories | orderBy: config('motions_export_category_sorting')">
<a href ng-click="toggleCategory(motion, category)"> <a href ng-click="toggleCategory(motion, category)">
<i class="fa fa-check" ng-if="category.id == motion.category.id"></i> <i class="fa fa-check" ng-if="category.id == motion.category.id"></i>
{{ category.prefix }} &ndash; {{ category.name }} {{ category.prefix }} &ndash; {{ category.name }}

View File

@ -218,20 +218,20 @@ describe('linenumbering', function () {
expect(lineNumberingService.insertLineBreaksWithoutNumbers(outHtml, 80)).toBe(outHtml); expect(lineNumberingService.insertLineBreaksWithoutNumbers(outHtml, 80)).toBe(outHtml);
}); });
it('shortens the line for H1-elements by 1/2', function () { it('shortens the line for H1-elements by 2/3', function () {
var inHtml = '<h1>' + longstr(80) + '</h1>'; var inHtml = '<h1>' + longstr(80) + '</h1>';
var expected = '<h1>' + noMarkup(1) + 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMN' + var expected = '<h1>' + noMarkup(1) + 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA' +
brMarkup(2) + 'OPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZAB</h1>'; brMarkup(2) + 'BCDEFGHIJKLMNOPQRSTUVWXYZAB</h1>';
var outHtml = lineNumberingService.insertLineNumbers(inHtml, 80); var outHtml = lineNumberingService.insertLineNumbers(inHtml, 80);
expect(outHtml).toBe(expected); expect(outHtml).toBe(expected);
expect(lineNumberingService.stripLineNumbers(outHtml)).toBe(inHtml); expect(lineNumberingService.stripLineNumbers(outHtml)).toBe(inHtml);
expect(lineNumberingService.insertLineBreaksWithoutNumbers(outHtml, 80)).toBe(outHtml); expect(lineNumberingService.insertLineBreaksWithoutNumbers(outHtml, 80)).toBe(outHtml);
}); });
it('shortens the line for H2-elements by 2/3', function () { it('shortens the line for H2-elements by 0.75', function () {
var inHtml = '<h2>' + longstr(80) + '</h2>'; var inHtml = '<h2>' + longstr(80) + '</h2>';
var expected = '<h2>' + noMarkup(1) + 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA' + var expected = '<h2>' + noMarkup(1) + 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH' +
brMarkup(2) + 'BCDEFGHIJKLMNOPQRSTUVWXYZAB</h2>'; brMarkup(2) + 'IJKLMNOPQRSTUVWXYZAB</h2>';
var outHtml = lineNumberingService.insertLineNumbers(inHtml, 80); var outHtml = lineNumberingService.insertLineNumbers(inHtml, 80);
expect(outHtml).toBe(expected); expect(outHtml).toBe(expected);
expect(lineNumberingService.stripLineNumbers(outHtml)).toBe(inHtml); expect(lineNumberingService.stripLineNumbers(outHtml)).toBe(inHtml);