Merge pull request #2692 from FinnStutzenstein/OSTitle

dynamic webpage title
This commit is contained in:
Emanuel Schütze 2016-12-06 20:48:32 +01:00 committed by GitHub
commit 29d7c55dd9
10 changed files with 96 additions and 25 deletions

View File

@ -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: "<ui-view/>",
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'),
},
});
}
])

View File

@ -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: "<ui-view/>",
data: {
title: gettext('Elections'),
},
})
.state('assignments.assignment', {
abstract: true,

View File

@ -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);

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([
'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: "<ui-view/>",
data: {
title: gettext('Tags'),
},
})
.state('core.tag.list', {
resolve: {

View File

@ -3,7 +3,8 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<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="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">

View File

@ -1,9 +1,10 @@
<!DOCTYPE html>
<html lang="en" class="no-js">
<html ng-controller="ProjectorContainerCtrl" lang="en" class="no-js">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<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">
<link rel="stylesheet" href="static/css/openslides-libs.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-templates.js"></script>
<div ng-controller="ProjectorContainerCtrl" class="pContainer">
<div class="pContainer">
<div>
<style>
.pContainer #iframe {
@ -38,7 +39,7 @@
</style>
<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>

View File

@ -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: "<ui-view/>",
data: {
title: gettext('Files'),
},
})
.state('mediafiles.mediafile', {
abstract: true,

View File

@ -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: "<ui-view/>",
data: {
title: gettext('Motions'),
},
})
.state('motions.motion', {
abstract: true,
@ -170,6 +174,9 @@ angular.module('OpenSlidesApp.motions.site', [
url: '/category',
abstract: true,
template: "<ui-view/>",
data: {
title: gettext('Categories'),
},
})
.state('motions.category.list', {
resolve: {
@ -209,6 +216,9 @@ angular.module('OpenSlidesApp.motions.site', [
url: '/blocks',
abstract: true,
template: '<ui-view/>',
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');

View File

@ -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: "<ui-view/>",
data: {
title: gettext('Topics'),
},
})
.state('topics.topic', {

View File

@ -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: "<ui-view/>",
data: {
title: gettext('Participants'),
},
})
.state('users.user', {
abstract: true,
@ -123,6 +127,9 @@ angular.module('OpenSlidesApp.users.site', [
url: '/groups',
abstract: true,
template: "<ui-view/>",
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',
},
});
}
])