Use os-perms instead of os-perms-lite. Removed os-perms-lite. (Fixes #1826)

This commit is contained in:
Emanuel Schuetze 2016-01-21 22:26:11 +01:00
parent 646bf52ea7
commit 94366f35ab
4 changed files with 7 additions and 47 deletions

View File

@ -127,7 +127,8 @@
</button> </button>
<uib-tabset class="spacer"> <uib-tabset class="spacer">
<uib-tab ng-repeat="poll in assignment.polls | orderBy:'-id'" heading="Ballot {{ assignment.polls.length - $index }}"> <uib-tab ng-repeat="poll in assignment.polls | orderBy:'-id'"
heading="{{ 'Ballot' | translate }} {{ assignment.polls.length - $index }}">
<div os-perms="assignments.can_manage" class="spacer"> <div os-perms="assignments.can_manage" class="spacer">
<!-- angular requires to open the link in new tab with "target='_blank'". <!-- angular requires to open the link in new tab with "target='_blank'".
Otherwise the pdf url can't be open in same window; angular redirects to "/". --> Otherwise the pdf url can't be open in same window; angular redirects to "/". -->
@ -143,17 +144,17 @@
2. <translate>Enter votes</translate> 2. <translate>Enter votes</translate>
</button> </button>
<i class="fa fa-arrow-right"></i> <i class="fa fa-arrow-right"></i>
<button os-perms-lite="assignments.can_manage" ng-if="!poll.published" ng-click="publishBallot(poll, true)" <button ng-if="!poll.published" ng-click="publishBallot(poll, true)"
class="btn btn-default btn-sm"> class="btn btn-default btn-sm">
<i class="fa fa-toggle-off"></i> <i class="fa fa-toggle-off"></i>
3. <translate>Publish ballot</translate> 3. <translate>Publish ballot</translate>
</button> </button>
<button os-perms-lite="assignments.can_manage" ng-if="poll.published" ng-click="publishBallot(poll, false)" <button ng-if="poll.published" ng-click="publishBallot(poll, false)"
class="btn btn-default btn-sm"> class="btn btn-default btn-sm">
<i class="fa fa-toggle-on"></i> <i class="fa fa-toggle-on"></i>
<translate>Published</translate> <translate>Published</translate>
</button> </button>
<a ng-click="deleteBallot(poll)" class="btn btn-default btn-sm"> <a ng-click="deleteBallot(poll)" class="btn btn-danger btn-sm">
<i class="fa fa-times"></i> <i class="fa fa-times"></i>
<translate>Delete</translate> <translate>Delete</translate>
</a> </a>

View File

@ -3,7 +3,7 @@
<div ng-controller="ProjectorControlCtrl"> <div ng-controller="ProjectorControlCtrl">
<!-- live view --> <!-- live view -->
<div class="section" os-perms-lite="core.can_see_projector"> <div class="section" os-perms="core.can_see_projector">
<a href="#" ng-click="isLiveViewClosed = !isLiveViewClosed"> <a href="#" ng-click="isLiveViewClosed = !isLiveViewClosed">
<i class="fa toggle-icon" ng-class="isLiveViewClosed ? 'fa-angle-up' : 'fa-angle-down'"></i> <i class="fa toggle-icon" ng-class="isLiveViewClosed ? 'fa-angle-up' : 'fa-angle-down'"></i>
<h4 translate>Live view</h4> <h4 translate>Live view</h4>

View File

@ -60,7 +60,7 @@
<td>{{ mediafile.uploader.get_full_name() }} <td>{{ mediafile.uploader.get_full_name() }}
<td os-perms="mediafiles.can_manage core.can_manage_projector" class="nobr"> <td os-perms="mediafiles.can_manage core.can_manage_projector" class="nobr">
<!-- projector, TODO: add link to activate slide --> <!-- projector, TODO: add link to activate slide -->
<a href="#TODO" ng-if="mediafile.is_presentable" os-perms-lite="core.can_manage_projector" <a href="" ng-show="mediafile.mediafile.type == 'application/pdf'" os-perms="core.can_manage_projector"
class="btn btn-default btn-sm" class="btn btn-default btn-sm"
title="{{ 'Show' | translate }}"> title="{{ 'Show' | translate }}">
<i class="fa fa-video-camera"></i> <i class="fa fa-video-camera"></i>

View File

@ -231,47 +231,6 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
} }
]) ])
/*
* Like osPerms but does only hide the DOM-Elements
*
* This is the Code from angular.js ngShow.
*/
.directive('osPermsLite', [
'$animate',
function($animate) {
var NG_HIDE_CLASS = 'os-perms-lite';
var NG_HIDE_IN_PROGRESS_CLASS = 'os-perms-lite-animate';
return {
restrict: 'A',
multiElement: true,
link: function(scope, element, $attr) {
var perms;
if ($attr.osPermsLite[0] === '!') {
perms = _.trimLeft($attr.osPermsLite, '!');
} else {
perms = $attr.osPermsLite;
}
scope.$watch(
function (scope) {
return scope.operator.hasPerms(perms);
}, function ngShowWatchAction(value) {
if ($attr.osPermsLite[0] === '!') {
value = !value;
}
// we're adding a temporary, animation-specific class for ng-hide since this way
// we can control when the element is actually displayed on screen without having
// to have a global/greedy CSS selector that breaks when other animations are run.
// Read: https://github.com/angular/angular.js/issues/9103#issuecomment-58335845
$animate[value ? 'removeClass' : 'addClass'](element, NG_HIDE_CLASS, {
tempClasses: NG_HIDE_IN_PROGRESS_CLASS
});
}
);
}
};
}
])
// Service for generic assignment form (create and update) // Service for generic assignment form (create and update)
.factory('UserForm', [ .factory('UserForm', [
'$http', '$http',