Dynamic webpage title

This commit is contained in:
FinnStutzenstein 2016-11-28 15:04:55 +01:00
parent a716910b63
commit 29ae600194
10 changed files with 96 additions and 25 deletions

View File

@ -24,12 +24,16 @@ angular.module('OpenSlidesApp.agenda.site', [
.config([ .config([
'$stateProvider', '$stateProvider',
function($stateProvider) { 'gettext',
function($stateProvider, gettext) {
$stateProvider $stateProvider
.state('agenda', { .state('agenda', {
url: '/agenda', url: '/agenda',
abstract: true, abstract: true,
template: "<ui-view/>", template: "<ui-view/>",
data: {
title: gettext('Agenda'),
},
}) })
.state('agenda.item', { .state('agenda.item', {
abstract: true, abstract: true,
@ -86,7 +90,10 @@ angular.module('OpenSlidesApp.agenda.site', [
items: function(Agenda) { items: function(Agenda) {
return Agenda.findAll(); return Agenda.findAll();
} }
} },
data: {
title: gettext('Current list of speakers'),
},
}); });
} }
]) ])

View File

@ -25,12 +25,16 @@ angular.module('OpenSlidesApp.assignments.site', [
.config([ .config([
'$stateProvider', '$stateProvider',
function($stateProvider) { 'gettext',
function($stateProvider, gettext) {
$stateProvider $stateProvider
.state('assignments', { .state('assignments', {
url: '/assignments', url: '/assignments',
abstract: true, abstract: true,
template: "<ui-view/>", template: "<ui-view/>",
data: {
title: gettext('Elections'),
},
}) })
.state('assignments.assignment', { .state('assignments.assignment', {
abstract: true, abstract: true,

View File

@ -67,14 +67,14 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core'])
function($scope, $location, gettext, loadGlobalData, Projector, ProjectorID) { function($scope, $location, gettext, loadGlobalData, Projector, ProjectorID) {
loadGlobalData(); loadGlobalData();
$scope.projector_id = ProjectorID(); $scope.projectorId = ProjectorID();
$scope.error = ''; $scope.error = '';
// watch for changes in Projector // watch for changes in Projector
$scope.$watch(function () { $scope.$watch(function () {
return Projector.lastModified($scope.projector_id); return Projector.lastModified($scope.projectorId);
}, function () { }, function () {
var projector = Projector.get($scope.projector_id); var projector = Projector.get($scope.projectorId);
if (projector) { if (projector) {
$scope.error = ''; $scope.error = '';
$scope.projectorWidth = projector.width; $scope.projectorWidth = projector.width;
@ -125,7 +125,7 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core'])
'Config', 'Config',
'ProjectorID', 'ProjectorID',
function($scope, $location, Projector, slides, Config, ProjectorID) { function($scope, $location, Projector, slides, Config, ProjectorID) {
var projector_id = ProjectorID(); var projectorId = ProjectorID();
$scope.broadcast = 0; $scope.broadcast = 0;
@ -141,9 +141,9 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core'])
}; };
$scope.$watch(function () { $scope.$watch(function () {
return Projector.lastModified(projector_id); return Projector.lastModified(projectorId);
}, function () { }, function () {
$scope.projector = Projector.get(projector_id); $scope.projector = Projector.get(projectorId);
if ($scope.projector) { if ($scope.projector) {
if ($scope.broadcast === 0) { if ($scope.broadcast === 0) {
setElements($scope.projector); setElements($scope.projector);

View File

@ -123,6 +123,18 @@ angular.module('OpenSlidesApp.core.site', [
} }
]) ])
// Set up the activeAppTitle for the title from the webpage
.run([
'$rootScope',
'gettextCatalog',
function ($rootScope, gettextCatalog) {
$rootScope.activeAppTitle = '';
$rootScope.$on('$stateChangeSuccess', function(evt, toState) {
$rootScope.activeAppTitle = toState.data ? toState.data.title : '';
});
}
])
.config([ .config([
'mainMenuProvider', 'mainMenuProvider',
'gettext', 'gettext',
@ -254,12 +266,16 @@ angular.module('OpenSlidesApp.core.site', [
.config([ .config([
'$stateProvider', '$stateProvider',
'$locationProvider', '$locationProvider',
function($stateProvider, $locationProvider) { 'gettext',
function($stateProvider, $locationProvider, gettext) {
// Core urls // Core urls
$stateProvider $stateProvider
.state('home', { .state('home', {
url: '/', url: '/',
templateUrl: 'static/templates/home.html' templateUrl: 'static/templates/home.html',
data: {
title: gettext('Home'),
},
}) })
.state('projector', { .state('projector', {
url: '/projector/{id:int}', url: '/projector/{id:int}',
@ -280,7 +296,10 @@ angular.module('OpenSlidesApp.core.site', [
.state('manage-projectors', { .state('manage-projectors', {
url: '/manage-projectors', url: '/manage-projectors',
templateUrl: 'static/templates/core/manage-projectors.html', templateUrl: 'static/templates/core/manage-projectors.html',
controller: 'ManageProjectorsCtrl' controller: 'ManageProjectorsCtrl',
data: {
title: gettext('Manage projectors'),
},
}) })
.state('core', { .state('core', {
url: '/core', url: '/core',
@ -292,6 +311,9 @@ angular.module('OpenSlidesApp.core.site', [
.state('legalnotice', { .state('legalnotice', {
url: '/legalnotice', url: '/legalnotice',
controller: 'LegalNoticeCtrl', controller: 'LegalNoticeCtrl',
data: {
title: gettext('Legal notice'),
},
}) })
//config //config
@ -302,7 +324,10 @@ angular.module('OpenSlidesApp.core.site', [
configOptions: function(Config) { configOptions: function(Config) {
return Config.getConfigOptions(); return Config.getConfigOptions();
} }
} },
data: {
title: gettext('Settings'),
},
}) })
// search // search
@ -310,6 +335,9 @@ angular.module('OpenSlidesApp.core.site', [
url: '/search?q', url: '/search?q',
controller: 'SearchCtrl', controller: 'SearchCtrl',
templateUrl: 'static/templates/search.html', templateUrl: 'static/templates/search.html',
data: {
title: gettext('Search'),
},
}) })
// tag // tag
@ -317,6 +345,9 @@ angular.module('OpenSlidesApp.core.site', [
url: '/tag', url: '/tag',
abstract: true, abstract: true,
template: "<ui-view/>", template: "<ui-view/>",
data: {
title: gettext('Tags'),
},
}) })
.state('core.tag.list', { .state('core.tag.list', {
resolve: { resolve: {

View File

@ -3,7 +3,8 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<base href="/"> <base href="/">
<title>OpenSlides</title> <title ng-if="!activeAppTitle">OpenSlides</title> <!-- avoid {{ ... }} in title while angular is not loaded -->
<title ng-if="activeAppTitle">OpenSlides &ndash; {{ activeAppTitle | translate }}</title>
<meta name="description" content=""> <meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="static/css/openslides-libs.css"> <link rel="stylesheet" href="static/css/openslides-libs.css">

View File

@ -1,9 +1,10 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" class="no-js"> <html ng-controller="ProjectorContainerCtrl" lang="en" class="no-js">
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<base href="/"> <base href="/">
<title>OpenSlides &ndash; Projector</title> <title ng-if="projectorId===undefined">OpenSlides &ndash; Projector</title> <!-- avoid {{ ... }} in title while angular is not loaded -->
<title ng-if="projectorId!==undefined">OpenSlides &ndash; {{ 'Projector' | translate }} {{ projectorId }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="static/css/openslides-libs.css"> <link rel="stylesheet" href="static/css/openslides-libs.css">
<link rel="stylesheet" href="static/css/projector.css"> <link rel="stylesheet" href="static/css/projector.css">
@ -12,7 +13,7 @@
<script src="static/js/openslides.js"></script> <script src="static/js/openslides.js"></script>
<script src="static/js/openslides-templates.js"></script> <script src="static/js/openslides-templates.js"></script>
<div ng-controller="ProjectorContainerCtrl" class="pContainer"> <div class="pContainer">
<div> <div>
<style> <style>
.pContainer #iframe { .pContainer #iframe {
@ -38,7 +39,7 @@
</style> </style>
<div id="iframewrapper" ng-hide="error"> <div id="iframewrapper" ng-hide="error">
<iframe id="iframe" ng-src="{{ '/real-projector/' + projector_id }}" frameborder="0"></iframe> <iframe id="iframe" ng-src="{{ '/real-projector/' + projectorId }}" frameborder="0"></iframe>
<div id="iframeoverlay"></div> <div id="iframeoverlay"></div>
</div> </div>

View File

@ -20,12 +20,16 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
.config([ .config([
'$stateProvider', '$stateProvider',
function($stateProvider) { 'gettext',
function($stateProvider, gettext) {
$stateProvider $stateProvider
.state('mediafiles', { .state('mediafiles', {
url: '/mediafiles', url: '/mediafiles',
abstract: true, abstract: true,
template: "<ui-view/>", template: "<ui-view/>",
data: {
title: gettext('Files'),
},
}) })
.state('mediafiles.mediafile', { .state('mediafiles.mediafile', {
abstract: true, abstract: true,

View File

@ -26,12 +26,16 @@ angular.module('OpenSlidesApp.motions.site', [
.config([ .config([
'$stateProvider', '$stateProvider',
function($stateProvider) { 'gettext',
function($stateProvider, gettext) {
$stateProvider $stateProvider
.state('motions', { .state('motions', {
url: '/motions', url: '/motions',
abstract: true, abstract: true,
template: "<ui-view/>", template: "<ui-view/>",
data: {
title: gettext('Motions'),
},
}) })
.state('motions.motion', { .state('motions.motion', {
abstract: true, abstract: true,
@ -170,6 +174,9 @@ angular.module('OpenSlidesApp.motions.site', [
url: '/category', url: '/category',
abstract: true, abstract: true,
template: "<ui-view/>", template: "<ui-view/>",
data: {
title: gettext('Categories'),
},
}) })
.state('motions.category.list', { .state('motions.category.list', {
resolve: { resolve: {
@ -209,6 +216,9 @@ angular.module('OpenSlidesApp.motions.site', [
url: '/blocks', url: '/blocks',
abstract: true, abstract: true,
template: '<ui-view/>', template: '<ui-view/>',
data: {
title: gettext('Motion blocks'),
},
}) })
.state('motions.motionBlock.list', { .state('motions.motionBlock.list', {
resolve: { resolve: {
@ -1043,12 +1053,11 @@ angular.module('OpenSlidesApp.motions.site', [
'Config', 'Config',
'motion', 'motion',
'MotionInlineEditing', 'MotionInlineEditing',
'gettextCatalog',
'Projector', 'Projector',
'ProjectionDefault', 'ProjectionDefault',
function($scope, $http, operator, ngDialog, MotionForm, function($scope, $http, operator, ngDialog, MotionForm,
ChangeRecommmendationCreate, ChangeRecommmendationView, MotionChangeRecommendation, MotionPDFExport, ChangeRecommmendationCreate, ChangeRecommmendationView, MotionChangeRecommendation, MotionPDFExport,
Motion, MotionComment, Category, Mediafile, Tag, User, Workflow, Config, motion, MotionInlineEditing, gettextCatalog, Motion, MotionComment, Category, Mediafile, Tag, User, Workflow, Config, motion, MotionInlineEditing,
Projector, ProjectionDefault) { Projector, ProjectionDefault) {
Category.bindAll({}, $scope, 'categories'); Category.bindAll({}, $scope, 'categories');
Mediafile.bindAll({}, $scope, 'mediafiles'); Mediafile.bindAll({}, $scope, 'mediafiles');

View File

@ -6,12 +6,16 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics'])
.config([ .config([
'$stateProvider', '$stateProvider',
function($stateProvider) { 'gettext',
function($stateProvider, gettext) {
$stateProvider $stateProvider
.state('topics', { .state('topics', {
url: '/topics', url: '/topics',
abstract: true, abstract: true,
template: "<ui-view/>", template: "<ui-view/>",
data: {
title: gettext('Topics'),
},
}) })
.state('topics.topic', { .state('topics.topic', {

View File

@ -24,12 +24,16 @@ angular.module('OpenSlidesApp.users.site', [
.config([ .config([
'$stateProvider', '$stateProvider',
function($stateProvider) { 'gettext',
function($stateProvider, gettext) {
$stateProvider $stateProvider
.state('users', { .state('users', {
url: '/users', url: '/users',
abstract: true, abstract: true,
template: "<ui-view/>", template: "<ui-view/>",
data: {
title: gettext('Participants'),
},
}) })
.state('users.user', { .state('users.user', {
abstract: true, abstract: true,
@ -123,6 +127,9 @@ angular.module('OpenSlidesApp.users.site', [
url: '/groups', url: '/groups',
abstract: true, abstract: true,
template: "<ui-view/>", template: "<ui-view/>",
data: {
title: gettext('Groups'),
},
}) })
.state('users.group.list', { .state('users.group.list', {
resolve: { resolve: {
@ -146,7 +153,10 @@ angular.module('OpenSlidesApp.users.site', [
closeByEscape: $stateParams.guest_enabled, closeByEscape: $stateParams.guest_enabled,
closeByDocument: $stateParams.guest_enabled, closeByDocument: $stateParams.guest_enabled,
}); });
}] }],
data: {
title: 'Login',
},
}); });
} }
]) ])