From 29ae600194ec6d69cd4ccdc4d6e5962bb17974b7 Mon Sep 17 00:00:00 2001 From: FinnStutzenstein Date: Mon, 28 Nov 2016 15:04:55 +0100 Subject: [PATCH] Dynamic webpage title --- openslides/agenda/static/js/agenda/site.js | 11 +++++- .../assignments/static/js/assignments/site.js | 6 ++- openslides/core/static/js/core/projector.js | 12 +++--- openslides/core/static/js/core/site.js | 39 +++++++++++++++++-- openslides/core/static/templates/index.html | 3 +- .../static/templates/projector-container.html | 9 +++-- .../mediafiles/static/js/mediafiles/site.js | 6 ++- openslides/motions/static/js/motions/site.js | 15 +++++-- openslides/topics/static/js/topics/site.js | 6 ++- openslides/users/static/js/users/site.js | 14 ++++++- 10 files changed, 96 insertions(+), 25 deletions(-) diff --git a/openslides/agenda/static/js/agenda/site.js b/openslides/agenda/static/js/agenda/site.js index 8bc8ab654..0c1caf42c 100644 --- a/openslides/agenda/static/js/agenda/site.js +++ b/openslides/agenda/static/js/agenda/site.js @@ -24,12 +24,16 @@ angular.module('OpenSlidesApp.agenda.site', [ .config([ '$stateProvider', - function($stateProvider) { + 'gettext', + function($stateProvider, gettext) { $stateProvider .state('agenda', { url: '/agenda', abstract: true, template: "", + data: { + title: gettext('Agenda'), + }, }) .state('agenda.item', { abstract: true, @@ -86,7 +90,10 @@ angular.module('OpenSlidesApp.agenda.site', [ items: function(Agenda) { return Agenda.findAll(); } - } + }, + data: { + title: gettext('Current list of speakers'), + }, }); } ]) diff --git a/openslides/assignments/static/js/assignments/site.js b/openslides/assignments/static/js/assignments/site.js index 7e668a3ff..c6e0aa695 100644 --- a/openslides/assignments/static/js/assignments/site.js +++ b/openslides/assignments/static/js/assignments/site.js @@ -25,12 +25,16 @@ angular.module('OpenSlidesApp.assignments.site', [ .config([ '$stateProvider', - function($stateProvider) { + 'gettext', + function($stateProvider, gettext) { $stateProvider .state('assignments', { url: '/assignments', abstract: true, template: "", + data: { + title: gettext('Elections'), + }, }) .state('assignments.assignment', { abstract: true, diff --git a/openslides/core/static/js/core/projector.js b/openslides/core/static/js/core/projector.js index 50f58d990..65460a31c 100644 --- a/openslides/core/static/js/core/projector.js +++ b/openslides/core/static/js/core/projector.js @@ -67,14 +67,14 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core']) function($scope, $location, gettext, loadGlobalData, Projector, ProjectorID) { loadGlobalData(); - $scope.projector_id = ProjectorID(); + $scope.projectorId = ProjectorID(); $scope.error = ''; // watch for changes in Projector $scope.$watch(function () { - return Projector.lastModified($scope.projector_id); + return Projector.lastModified($scope.projectorId); }, function () { - var projector = Projector.get($scope.projector_id); + var projector = Projector.get($scope.projectorId); if (projector) { $scope.error = ''; $scope.projectorWidth = projector.width; @@ -125,7 +125,7 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core']) 'Config', 'ProjectorID', function($scope, $location, Projector, slides, Config, ProjectorID) { - var projector_id = ProjectorID(); + var projectorId = ProjectorID(); $scope.broadcast = 0; @@ -141,9 +141,9 @@ angular.module('OpenSlidesApp.core.projector', ['OpenSlidesApp.core']) }; $scope.$watch(function () { - return Projector.lastModified(projector_id); + return Projector.lastModified(projectorId); }, function () { - $scope.projector = Projector.get(projector_id); + $scope.projector = Projector.get(projectorId); if ($scope.projector) { if ($scope.broadcast === 0) { setElements($scope.projector); diff --git a/openslides/core/static/js/core/site.js b/openslides/core/static/js/core/site.js index 76ab9bd15..5580b2d61 100644 --- a/openslides/core/static/js/core/site.js +++ b/openslides/core/static/js/core/site.js @@ -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([ 'mainMenuProvider', 'gettext', @@ -254,12 +266,16 @@ angular.module('OpenSlidesApp.core.site', [ .config([ '$stateProvider', '$locationProvider', - function($stateProvider, $locationProvider) { + 'gettext', + function($stateProvider, $locationProvider, gettext) { // Core urls $stateProvider .state('home', { url: '/', - templateUrl: 'static/templates/home.html' + templateUrl: 'static/templates/home.html', + data: { + title: gettext('Home'), + }, }) .state('projector', { url: '/projector/{id:int}', @@ -280,7 +296,10 @@ angular.module('OpenSlidesApp.core.site', [ .state('manage-projectors', { url: '/manage-projectors', templateUrl: 'static/templates/core/manage-projectors.html', - controller: 'ManageProjectorsCtrl' + controller: 'ManageProjectorsCtrl', + data: { + title: gettext('Manage projectors'), + }, }) .state('core', { url: '/core', @@ -292,6 +311,9 @@ angular.module('OpenSlidesApp.core.site', [ .state('legalnotice', { url: '/legalnotice', controller: 'LegalNoticeCtrl', + data: { + title: gettext('Legal notice'), + }, }) //config @@ -302,7 +324,10 @@ angular.module('OpenSlidesApp.core.site', [ configOptions: function(Config) { return Config.getConfigOptions(); } - } + }, + data: { + title: gettext('Settings'), + }, }) // search @@ -310,6 +335,9 @@ angular.module('OpenSlidesApp.core.site', [ url: '/search?q', controller: 'SearchCtrl', templateUrl: 'static/templates/search.html', + data: { + title: gettext('Search'), + }, }) // tag @@ -317,6 +345,9 @@ angular.module('OpenSlidesApp.core.site', [ url: '/tag', abstract: true, template: "", + data: { + title: gettext('Tags'), + }, }) .state('core.tag.list', { resolve: { diff --git a/openslides/core/static/templates/index.html b/openslides/core/static/templates/index.html index 2a58195da..6688a741d 100644 --- a/openslides/core/static/templates/index.html +++ b/openslides/core/static/templates/index.html @@ -3,7 +3,8 @@ -OpenSlides +OpenSlides +OpenSlides – {{ activeAppTitle | translate }} diff --git a/openslides/core/static/templates/projector-container.html b/openslides/core/static/templates/projector-container.html index d8ed0788c..6a9baa1c5 100644 --- a/openslides/core/static/templates/projector-container.html +++ b/openslides/core/static/templates/projector-container.html @@ -1,9 +1,10 @@ - + -OpenSlides – Projector +OpenSlides – Projector +OpenSlides – {{ 'Projector' | translate }} {{ projectorId }} @@ -12,7 +13,7 @@ -
+
- +
diff --git a/openslides/mediafiles/static/js/mediafiles/site.js b/openslides/mediafiles/static/js/mediafiles/site.js index b256b7d8b..17f085811 100644 --- a/openslides/mediafiles/static/js/mediafiles/site.js +++ b/openslides/mediafiles/static/js/mediafiles/site.js @@ -20,12 +20,16 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp. .config([ '$stateProvider', - function($stateProvider) { + 'gettext', + function($stateProvider, gettext) { $stateProvider .state('mediafiles', { url: '/mediafiles', abstract: true, template: "", + data: { + title: gettext('Files'), + }, }) .state('mediafiles.mediafile', { abstract: true, diff --git a/openslides/motions/static/js/motions/site.js b/openslides/motions/static/js/motions/site.js index 7441ea606..20f6f9d44 100644 --- a/openslides/motions/static/js/motions/site.js +++ b/openslides/motions/static/js/motions/site.js @@ -26,12 +26,16 @@ angular.module('OpenSlidesApp.motions.site', [ .config([ '$stateProvider', - function($stateProvider) { + 'gettext', + function($stateProvider, gettext) { $stateProvider .state('motions', { url: '/motions', abstract: true, template: "", + data: { + title: gettext('Motions'), + }, }) .state('motions.motion', { abstract: true, @@ -170,6 +174,9 @@ angular.module('OpenSlidesApp.motions.site', [ url: '/category', abstract: true, template: "", + data: { + title: gettext('Categories'), + }, }) .state('motions.category.list', { resolve: { @@ -209,6 +216,9 @@ angular.module('OpenSlidesApp.motions.site', [ url: '/blocks', abstract: true, template: '', + data: { + title: gettext('Motion blocks'), + }, }) .state('motions.motionBlock.list', { resolve: { @@ -1043,12 +1053,11 @@ angular.module('OpenSlidesApp.motions.site', [ 'Config', 'motion', 'MotionInlineEditing', - 'gettextCatalog', 'Projector', 'ProjectionDefault', function($scope, $http, operator, ngDialog, MotionForm, 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) { Category.bindAll({}, $scope, 'categories'); Mediafile.bindAll({}, $scope, 'mediafiles'); diff --git a/openslides/topics/static/js/topics/site.js b/openslides/topics/static/js/topics/site.js index efdf1cd76..d17e32d72 100644 --- a/openslides/topics/static/js/topics/site.js +++ b/openslides/topics/static/js/topics/site.js @@ -6,12 +6,16 @@ angular.module('OpenSlidesApp.topics.site', ['OpenSlidesApp.topics']) .config([ '$stateProvider', - function($stateProvider) { + 'gettext', + function($stateProvider, gettext) { $stateProvider .state('topics', { url: '/topics', abstract: true, template: "", + data: { + title: gettext('Topics'), + }, }) .state('topics.topic', { diff --git a/openslides/users/static/js/users/site.js b/openslides/users/static/js/users/site.js index 55ab08d4d..c8340eefd 100644 --- a/openslides/users/static/js/users/site.js +++ b/openslides/users/static/js/users/site.js @@ -24,12 +24,16 @@ angular.module('OpenSlidesApp.users.site', [ .config([ '$stateProvider', - function($stateProvider) { + 'gettext', + function($stateProvider, gettext) { $stateProvider .state('users', { url: '/users', abstract: true, template: "", + data: { + title: gettext('Participants'), + }, }) .state('users.user', { abstract: true, @@ -123,6 +127,9 @@ angular.module('OpenSlidesApp.users.site', [ url: '/groups', abstract: true, template: "", + data: { + title: gettext('Groups'), + }, }) .state('users.group.list', { resolve: { @@ -146,7 +153,10 @@ angular.module('OpenSlidesApp.users.site', [ closeByEscape: $stateParams.guest_enabled, closeByDocument: $stateParams.guest_enabled, }); - }] + }], + data: { + title: 'Login', + }, }); } ])