Merge pull request #2051 from emanuelschuetze/templateFixes2

Template improvements
This commit is contained in:
Norman Jäckel 2016-03-20 21:21:52 +01:00
commit e2383dc770
11 changed files with 91 additions and 26 deletions

View File

@ -69,7 +69,10 @@ angular.module('OpenSlidesApp.agenda.projector', ['OpenSlidesApp.agenda'])
} else if ($scope.element.tree) { } else if ($scope.element.tree) {
$scope.items = AgendaTree.getFlatTree(Agenda.getAll()); $scope.items = AgendaTree.getFlatTree(Agenda.getAll());
} else { } else {
$scope.items = $filter('filter')(Agenda.getAll(), {'parent_id': null}); $scope.items = Agenda.filter({
where: { parent_id: null },
orderBy: 'weight'
});
} }
}); });
} }

View File

@ -760,7 +760,7 @@ img {
box-shadow: -5px 5px 5px rgba(0, 0, 0, 0.2); box-shadow: -5px 5px 5px rgba(0, 0, 0, 0.2);
height: 200px; height: 200px;
padding: 0 10px 10px 10px; padding: 0 10px 10px 10px;
z-index: 1; z-index: 10;
} }
#chatbox-text { #chatbox-text {

View File

@ -51,7 +51,7 @@ body{
font-size: 24px; font-size: 24px;
position: absolute; position: absolute;
text-align: right; text-align: right;
top: 25px; top: 23px;
right: 50px; right: 50px;
padding-left: 30px; padding-left: 30px;
} }
@ -185,16 +185,16 @@ hr {
/*** Overlay ***/ /*** Overlay ***/
.countdown { .countdown {
min-width: 260px; min-width: 260px;
position: fixed; position: relative;
margin: 0; margin: 0 0 10px 10px;
top: 90px; top: 0px;
right: 0px; right: 0px;
padding: 23px 47px 0px 19px; padding: 23px 45px 0px 19px;
min-height: 72px; min-height: 72px;
font-size: 3.7em; font-size: 3.7em;
font-weight: bold; font-weight: bold;
text-align: right; text-align: right;
border-radius: 7px 0 0 7px; border-radius: 7px 7px 7px 7px;
z-index: 200; z-index: 200;
font-family: "Roboto Condensed",Helvetica,Arial,sans-serif; font-family: "Roboto Condensed",Helvetica,Arial,sans-serif;
} }
@ -202,7 +202,7 @@ hr {
font-weight: normal; font-weight: normal;
font-size: 18px; font-size: 18px;
margin-top: 20px; margin-top: 20px;
padding-right: 5px; padding-right: 6px;
} }
.countdown.warning { .countdown.warning {
color: #ed940d; color: #ed940d;

View File

@ -391,25 +391,24 @@ angular.module('OpenSlidesApp.core', [
} }
]) ])
/* Converts number of seconds into string "hh:mm:ss" or "mm:ss" */ /* Converts number of seconds into string "h:mm:ss" or "mm:ss" */
.filter('osSecondsToTime', [ .filter('osSecondsToTime', [
function () { function () {
return function (totalseconds) { return function (totalseconds) {
var time; var time;
// floor returns the largest integer of the absolut value of totalseconds // floor returns the largest integer of the absolut value of totalseconds
var total = Math.floor(Math.abs(totalseconds)); var total = Math.floor(Math.abs(totalseconds));
var hh = Math.floor(total / 3600); var h = Math.floor(total / 3600);
var mm = Math.floor(total % 3600 / 60); var mm = Math.floor(total % 3600 / 60);
var ss = Math.floor(total % 60); var ss = Math.floor(total % 60);
var zero = "0"; var zero = "0";
// Add leading "0" for double digit values // Add leading "0" for double digit values
hh = (zero+hh).slice(-2);
mm = (zero+mm).slice(-2); mm = (zero+mm).slice(-2);
ss = (zero+ss).slice(-2); ss = (zero+ss).slice(-2);
if (hh == "00") if (h == "0")
time = mm + ':' + ss; time = mm + ':' + ss;
else else
time = hh + ":" + mm + ":" + ss; time = h + ":" + mm + ":" + ss;
if (totalseconds < 0) if (totalseconds < 0)
time = "-"+time; time = "-"+time;
return time; return time;

View File

@ -812,6 +812,7 @@ angular.module('OpenSlidesApp.core.site', [
if (value.name == 'agenda/list-of-speakers') { if (value.name == 'agenda/list-of-speakers') {
$state.go('agenda.item.detail', {id: value.id}); $state.go('agenda.item.detail', {id: value.id});
} else if ( } else if (
value.name != 'agenda/item-list' &&
value.name != 'core/clock' && value.name != 'core/clock' &&
value.name != 'core/countdown' && value.name != 'core/countdown' &&
value.name != 'core/message' ) { value.name != 'core/message' ) {
@ -1055,6 +1056,48 @@ angular.module('OpenSlidesApp.core.site', [
} }
]) ])
// format time string for model ("s") and view format ("h:mm:ss" or "mm:ss")
.directive('minSecFormat', [
function () {
return {
require: 'ngModel',
link: function(scope, element, attrs, ngModelController) {
ngModelController.$parsers.push(function(data) {
//convert data from view format (mm:ss) to model format (s)
var time = data.split(':');
if (time.length > 1) {
data = (+time[0]) * 60 + (+time[1]);
if (data < 0) {
data = "-"+data;
}
}
return data;
});
ngModelController.$formatters.push(function(data) {
//convert data from model format (s) to view format (mm:ss)
var time;
// floor returns the largest integer of the absolut value of totalseconds
var total = Math.floor(Math.abs(data));
var mm = Math.floor(total / 60);
var ss = Math.floor(total % 60);
var zero = "0";
// Add leading "0" for double digit values
if (mm.length < 2) {
mm = (zero+mm).slice(-2);
}
ss = (zero+ss).slice(-2);
time = mm + ':' + ss;
if (data < 0) {
time = "-"+time;
}
return time;
});
}
};
}
])
.directive('osFocusMe', [ .directive('osFocusMe', [
'$timeout', '$timeout',
function ($timeout) { function ($timeout) {

View File

@ -17,6 +17,8 @@
</a> </a>
<!-- projector control buttons --> <!-- projector control buttons -->
<div os-perms="core.can_manage_projector"> <div os-perms="core.can_manage_projector">
<!-- edit -->
<a ng-click="editCurrentSlide()" <a ng-click="editCurrentSlide()"
class="btn btn-default btn-sm" class="btn btn-default btn-sm"
title="{{ 'Edit current slide' | translate}}"> title="{{ 'Edit current slide' | translate}}">
@ -85,8 +87,7 @@
<i class="fa fa-times"></i> <i class="fa fa-times"></i>
</button> </button>
<!-- edit countdown button --> <!-- edit countdown button -->
<button ng-show="countdown.status=='stop'" <button type="button" class="close editicon"
type="button" class="close editicon"
ng-click="editCountdownFlag=true;" ng-click="editCountdownFlag=true;"
title="{{ 'Edit countdown' | translate}}"> title="{{ 'Edit countdown' | translate}}">
<i class="fa fa-pencil"></i> <i class="fa fa-pencil"></i>
@ -135,7 +136,8 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label translate>Start time</label> <label translate>Start time</label>
<input ng-model="countdown.default" type="number" class="form-control input-sm"> <input data-ng-model="countdown.default" min-sec-format
type="text" placeholder="mm:ss" class="form-control input-sm">
</div> </div>
<button type="submit" <button type="submit"
title="{{ 'Save' | translate}}" title="{{ 'Save' | translate}}"

View File

@ -1,6 +1,6 @@
<div ng-controller="SlideCountdownCtrl"> <div ng-controller="SlideCountdownCtrl">
<div ng-if="visible"> <div ng-if="visible">
<div class="countdown well" style="margin-top: calc({{index}}*100px);" <div class="countdown well pull-right"
ng-class="{ ng-class="{
'negative': seconds <= 0, 'negative': seconds <= 0,
'warning': seconds <= config('agenda_countdown_warning_time') && seconds > 0 }"> 'warning': seconds <= config('agenda_countdown_warning_time') && seconds > 0 }">

View File

@ -24,7 +24,8 @@
<div id="header"> <div id="header">
<img ng-if="config('projector_enable_logo')" id="logo" src="/static/img/logo-projector.png" alt="OpenSlides" /> <img ng-if="config('projector_enable_logo')" id="logo" src="/static/img/logo-projector.png" alt="OpenSlides" />
<div ng-if="config('projector_enable_title')" id="eventdata"> <div ng-if="config('projector_enable_title')" id="eventdata">
<div class="title" ng-bind-html="config('general_event_name')"></div> <div class="title" ng-class="{ 'titleonly': !config('general_event_description') }"
ng-bind-html="config('general_event_name')"></div>
<div ng-if="config('general_event_description')" class="description" <div ng-if="config('general_event_description')" class="description"
ng-bind-html="config('general_event_description')"></div> ng-bind-html="config('general_event_description')"></div>
</div> </div>
@ -37,7 +38,7 @@
font-size: {{scale}}%; font-size: {{scale}}%;
} }
</style> </style>
<div ng-repeat="element in elements"> <div ng-repeat="element in elements | orderBy:'index'">
<div ng-include="element.template"></div> <div ng-include="element.template"></div>
</div> </div>
</div> </div>

View File

@ -198,9 +198,6 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
// angular-formly fields for motion form // angular-formly fields for motion form
getFormFields: function () { getFormFields: function () {
var workflows = Workflow.getAll(); var workflows = Workflow.getAll();
angular.forEach(workflows, function(workflow) {
workflow.name = gettextCatalog.getString(workflow.name);
});
var images = Mediafile.getAllImages(); var images = Mediafile.getAllImages();
return [ return [
{ {
@ -328,7 +325,7 @@ angular.module('OpenSlidesApp.motions.site', ['OpenSlidesApp.motions'])
label: gettextCatalog.getString('Workflow'), label: gettextCatalog.getString('Workflow'),
optionsAttr: 'bs-options', optionsAttr: 'bs-options',
options: workflows, options: workflows,
ngOptions: 'option.id as option.name for option in to.options', ngOptions: 'option.id as option.name | translate for option in to.options',
placeholder: gettextCatalog.getString('Select or search a workflow ...') placeholder: gettextCatalog.getString('Select or search a workflow ...')
}, },
hideExpression: '!model.more', hideExpression: '!model.more',

View File

@ -58,6 +58,26 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
} }
} }
}) })
// Redirects to user detail view and opens user edit form dialog, uses edit url.
// Used by $state.go(..) from core/site.js only (for edit current slide button).
// (from users list controller use UserForm factory instead to open dialog in front of
// current view without redirect)
.state('users.user.detail.update', {
onEnter: ['$stateParams', '$state', 'ngDialog', 'User',
function($stateParams, $state, ngDialog, User) {
ngDialog.open({
template: 'static/templates/users/user-form.html',
controller: 'UserUpdateCtrl',
className: 'ngdialog-theme-default wide-form',
closeByEscape: false,
closeByDocument: false,
resolve: {
user: function() {return User.find($stateParams.id);}
}
});
}
]
})
.state('users.user.detail.profile', { .state('users.user.detail.profile', {
views: { views: {
'@users.user': {}, '@users.user': {},
@ -304,7 +324,7 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
templateOptions: { templateOptions: {
label: gettextCatalog.getString('Groups'), label: gettextCatalog.getString('Groups'),
options: Group.getAll(), options: Group.getAll(),
ngOptions: 'option.id as option.name for option in to.options | ' + ngOptions: 'option.id as option.name | translate for option in to.options | ' +
'filter: {id: "!1"} | filter: {id: "!2"}', 'filter: {id: "!1"} | filter: {id: "!2"}',
placeholder: gettextCatalog.getString('Select or search a group ...') placeholder: gettextCatalog.getString('Select or search a group ...')
} }

View File

@ -15,7 +15,7 @@
<form name="groupForm"> <form name="groupForm">
<div class="form-group"> <div class="form-group">
<label for="inputName" translate>Name</label> <label for="inputName" translate>Name</label>
<input type="text" ng-model="group.name" class="form-control" name="inputName" required> <input type="text" ng-model="group.name|translate" class="form-control" name="inputName" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="selectPermissions" translate>Permissions</label> <label for="selectPermissions" translate>Permissions</label>