Rename AdditionalId to arg (closes #2465)

This commit is contained in:
FinnStutzenstein 2016-10-17 08:05:40 +02:00
parent c2a1675e37
commit 7fcbed051c
4 changed files with 16 additions and 17 deletions

View File

@ -369,9 +369,8 @@ angular.module('OpenSlidesApp.agenda', ['OpenSlidesApp.users'])
[{name: 'agenda/current-list-of-speakers-overlay',stable: true}]);
}
},
isProjected: function (additionalId) {
isProjected: function () {
// Returns the id of the last projector with an agenda-item element. Else return 0.
// additionalId is not needed
var isProjected = 0;
var predicate = function (element) {
var value;

View File

@ -163,7 +163,7 @@
</button>
<!-- Project -->
<projector-button model="assignment" default-projector-id="defaultProjectorId"
additional-id="poll.id" content="{{ 'Project' | translate }}">
arg="poll.id" content="{{ 'Project' | translate }}">
</projector-button>
</div>

View File

@ -320,11 +320,11 @@ angular.module('OpenSlidesApp.core', [
* This places a projector button in the document.
*
* Example: <projector-button model="motion" default-projector.id="defPrId"
* additional-id="2" content="{{ 'project' | translate }}"></projector-button>
* arg="2" content="{{ 'project' | translate }}"></projector-button>
* This button references to model (in this example 'motion'). Also a defaultProjectionId
* has to be given. In the example it's a scope variable. The next two parameters are additional:
* - additional-id: Then the model.project and model.isProjected will be called with
* this argument (e. g.: model.project(2))
* - arg: Then the model.project and model.isProjected will be called with
* this argument (e. g.: model.project(2))
* - content: A text placed behind the projector symbol.
*/
.directive('projectorButton', [
@ -350,9 +350,9 @@ angular.module('OpenSlidesApp.core', [
scope.defaultProjectorId = defaultProjectorId;
});
if (attributes.additionalId) {
scope.$watch(attributes.additionalId, function (id) {
scope.additionalId = id;
if (attributes.arg) {
scope.$watch(attributes.arg, function (arg) {
scope.arg = arg;
});
}

View File

@ -1,24 +1,24 @@
<div class="btn-group" style="min-width:{{ projectors.length > 1 ? '54' : '34' }}px;" uib-dropdown
uib-tooltip="{{ 'Projector' | translate }} {{ model.isProjected(additionalId) }}"
tooltip-enable="model.isProjected(additionalId) > 0"
uib-tooltip="{{ 'Projector' | translate }} {{ model.isProjected(arg) }}"
tooltip-enable="model.isProjected(arg) > 0"
os-perms="core.can_manage_projector">
<button type="button" class="btn btn-default btn-sm"
ng-click="model.project(defaultProjectorId, additionalId)"
ng-class="{ 'btn-primary': model.isProjected(additionalId) == defaultProjectorId }">
ng-click="model.project(defaultProjectorId, arg)"
ng-class="{ 'btn-primary': model.isProjected(arg) == defaultProjectorId }">
<i class="fa fa-video-camera"></i>
{{ content }}
</button>
<button type="button" class="btn btn-default btn-sm slimDropDown"
ng-class="{ 'btn-primary': (model.isProjected(additionalId) > 0 && model.isProjected(additionalId) != defaultProjectorId) }"
ng-class="{ 'btn-primary': (model.isProjected(arg) > 0 && model.isProjected(arg) != defaultProjectorId) }"
ng-if="projectors.length > 1"
uib-dropdown-toggle>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li role="menuitem" ng-repeat="projector in projectors">
<a href="" ng-click="model.project(projector.id, additionalId)"
ng-class="{ 'projected': (model.isProjected(additionalId) == projector.id) }">
<i class="fa fa-video-camera" ng-show="model.isProjected(additionalId) == projector.id"></i>
<a href="" ng-click="model.project(projector.id, arg)"
ng-class="{ 'projected': (model.isProjected(arg) == projector.id) }">
<i class="fa fa-video-camera" ng-show="model.isProjected(arg) == projector.id"></i>
{{ projector.name }}
<span ng-if="defaultProjectorId == projector.id">(<translate>Default</translate>)</span>
</a>