Merge pull request #3310 from emanuelschuetze/new-logo

Added new logo placeholder for web interface header logo.
This commit is contained in:
Emanuel Schütze 2017-08-14 14:50:07 +02:00 committed by GitHub
commit 81f841d5e5
7 changed files with 148 additions and 40 deletions

View File

@ -51,8 +51,8 @@ Users:
Core:
- No reload on logoff. OpenSlides is now a full single page
application [#3172].
- Adding support for choosing image files as logos for projector and
PDF [#3184, #3207, #3208].
- Adding support for choosing image files as logos for projector,
PDF and web interface header [#3184, #3207, #3208, #3310].
- Fixing error when clearing empty chat [#3199].
- Added notify system [#3212].
- Enhanced performance esp. for server restart and first connection of all

View File

@ -266,14 +266,46 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
])
.factory('BallotContentProvider', [
'$q',
'$filter',
'gettextCatalog',
'PDFLayout',
'Config',
'User',
function($filter, gettextCatalog, PDFLayout, Config, User) {
'ImageConverter',
function($q, $filter, gettextCatalog, PDFLayout, Config, User, ImageConverter) {
var createInstance = function(assignment, poll, pollNumber) {
var logoBallotPaperUrl = Config.get('logo_pdf_ballot_paper').value.path;
var imageMap = {};
// PDF header
var header = function() {
var columns = [];
// logo
if (logoBallotPaperUrl) {
columns.push({
image: imageMap[logoBallotPaperUrl].data,
fit: [90,20],
width: '20%'
});
}
var text = Config.get('general_event_name').value;
columns.push({
text: text,
fontSize: 8,
alignment: 'right',
});
return {
color: '#555',
margin: [30, 10, 10, -10], // [left, top, right, bottom]
columns: columns,
columnGap: 10
};
};
// page title
var createTitle = function() {
return {
@ -351,20 +383,21 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
// since it is not possible to give a column a fixed height, we draw an "empty" column
// with a one px width and a fixed top-margin
return {
columns : [
columns: [
{
width: 1,
margin: [0, marginTop],
text: ""
text: '',
},
{
width: '*',
stack: [
header(),
createTitle(),
createPollHint(),
createSelectionField(),
]
}
],
},
]
};
};
@ -473,9 +506,17 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
return createContentTable();
};
return {
return $q(function (resolve) {
var imageSources = [
logoBallotPaperUrl,
];
ImageConverter.toBase64(imageSources).then(function (_imageMap) {
imageMap = _imageMap;
resolve({
getContent: getContent
};
});
});
});
};
return {
@ -610,9 +651,10 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
}
});
var filename = gettextCatalog.getString('Ballot') + '_' + pollNumber + '_' + assignment.title + '.pdf';
var ballotContentProvider = BallotContentProvider.createInstance(assignment, thePoll, pollNumber);
BallotContentProvider.createInstance(assignment, thePoll, pollNumber).then(function (ballotContentProvider) {
var documentProvider = PdfMakeBallotPaperProvider.createInstance(ballotContentProvider);
PdfCreate.download(documentProvider.getDocument(), filename);
});
},
};
}

View File

@ -250,8 +250,10 @@ def get_config_variables():
default_value=[
'logo_projector_main',
'logo_projector_header',
'logo_web_header',
'logo_pdf_header',
'logo_pdf_footer'],
'logo_pdf_footer',
'logo_pdf_ballot_paper'],
weight=300,
group='Logo',
hidden=True)
@ -276,6 +278,16 @@ def get_config_variables():
group='Logo',
hidden=True)
yield ConfigVariable(
name='logo_web_header',
default_value={
'display_name': 'Web interface header logo',
'path': ''},
input_type='logo',
weight=303,
group='Logo',
hidden=True)
# PDF logos
yield ConfigVariable(
name='logo_pdf_header',
@ -296,3 +308,13 @@ def get_config_variables():
weight=311,
group='Logo',
hidden=True)
yield ConfigVariable(
name='logo_pdf_ballot_paper',
default_value={
'display_name': 'PDF ballot paper logo',
'path': ''},
input_type='logo',
weight=312,
group='Logo',
hidden=True)

View File

@ -59,12 +59,6 @@ var replacePlaceholder = function (content) {
hLineWidth: function(i, node) {
if (i === 0){
return 0;
} else if (i === node.table.body.length) {
if (node.rowsperpage && node.rowsperpage > i) {
return 0.5;
} else {
return 0;
}
} else {
return 0.5;
}

View File

@ -1898,6 +1898,8 @@ angular.module('OpenSlidesApp.core.site', [
gettext('Projector header image');
gettext('PDF header logo');
gettext('PDF footer logo');
gettext('Web interface header logo');
gettext('PDF ballot paper logo');
// Mark the string 'Default projector' here, because it does not appear in the templates.
gettext('Default projector');

View File

@ -29,7 +29,8 @@
<!-- Logo -->
<div class="title">
<a ui-sref="home">
<img src="/static/img/openslides-logo-dark.png" alt="Logo" height="35">
<img src="/static/img/openslides-logo-dark.png" alt="OpenSlides Logo" height="35">
<img ng-if="config('logo_web_header').path" ng-src="{{ config('logo_web_header').path }}" alt="OpenSlides Logo" height="35">
</a>
</div>

View File

@ -540,11 +540,13 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
])
.factory('PollContentProvider', [
'$q',
'PDFLayout',
'gettextCatalog',
'Config',
'User',
function(PDFLayout, gettextCatalog, Config, User) {
'ImageConverter',
function($q, PDFLayout, gettextCatalog, Config, User, ImageConverter) {
/**
* Generates a content provider for polls
* @constructor
@ -553,25 +555,61 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
*/
var createInstance = function(title, id) {
var logoBallotPaperUrl = Config.get('logo_pdf_ballot_paper').value.path;
var imageMap = {};
// PDF header
var header = function() {
var columns = [];
var text = Config.get('general_event_name').value;
columns.push({
text: text,
fontSize: 8,
alignment: 'left',
width: '60%'
});
// logo
if (logoBallotPaperUrl) {
columns.push({
image: imageMap[logoBallotPaperUrl].data,
fit: [90,25],
alignment: 'right',
width: '40%'
});
}
return {
color: '#555',
fontSize: 10,
margin: [30, 10, 10, -10], // [left, top, right, bottom]
columns: columns,
columnGap: 5
};
};
/**
* Returns a single section on the ballot paper
* @function
*/
var createSection = function() {
var sheetend = 75;
var sheetend = 40;
return {
stack: [{
text: gettextCatalog.getString("Motion") + " " + id,
stack: [
header(),
{
text: gettextCatalog.getString('Motion') + ' ' + id,
style: 'title',
}, {
},
{
text: title,
style: 'description'
},
PDFLayout.createBallotEntry(gettextCatalog.getString("Yes")),
PDFLayout.createBallotEntry(gettextCatalog.getString("No")),
PDFLayout.createBallotEntry(gettextCatalog.getString("Abstain")),
PDFLayout.createBallotEntry(gettextCatalog.getString('Yes')),
PDFLayout.createBallotEntry(gettextCatalog.getString('No')),
PDFLayout.createBallotEntry(gettextCatalog.getString('Abstain')),
],
margin: [0, 0, 0, sheetend]
margin: [0, 0, 0, sheetend],
};
};
@ -642,9 +680,17 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
return content;
};
return {
getContent: getContent,
};
return $q(function (resolve) {
var imageSources = [
logoBallotPaperUrl,
];
ImageConverter.toBase64(imageSources).then(function (_imageMap) {
imageMap = _imageMap;
resolve({
getContent: getContent
});
});
});
};
return {
createInstance: createInstance
@ -944,9 +990,10 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
var id = motion.identifier.replace(' ', '');
var title = motion.getTitle(version);
var filename = gettextCatalog.getString('Motion') + '-' + id + '-' + gettextCatalog.getString('ballot-paper') + '.pdf';
var pollContentProvider = PollContentProvider.createInstance(title, id);
PollContentProvider.createInstance(title, id).then(function (pollContentProvider) {
var documentProvider = PdfMakeBallotPaperProvider.createInstance(pollContentProvider);
PdfCreate.download(documentProvider.getDocument(), filename);
});
},
exportPersonalNote: function (motion, filename) {
var personalNote = PersonalNoteManager.getNote(motion);