Merge pull request #2764 from FinnStutzenstein/Issue2754

More motion select mode options and layout changes for guests
This commit is contained in:
Norman Jäckel 2016-12-13 11:57:51 +01:00 committed by GitHub
commit c1d4927a9b
7 changed files with 92 additions and 10 deletions

View File

@ -256,6 +256,7 @@
</ul>
</div>
</div>
<div class="no-projector-spacer" os-perms="!core.can_manage_projector"></div>
<!-- main content column -->
<div class="col-xs-6 content" style="padding-left: calc({{ item.parentCount }}*15px)">

View File

@ -219,6 +219,7 @@
<projector-button model="assignment", default-projector-id="defaultProjectorId">
</projector-button>
</div>
<div class="no-projector-spacer" os-perms="!core.can_manage_projector"></div>
<!-- main contant column -->
<div class="col-xs-6 content">
<div class="title-col">

View File

@ -960,6 +960,11 @@ img {
width: calc(100% - 50px);
}
.os-table .no-projector-spacer {
margin-right: 20px;
float: left;
}
.os-table .header-row {
border-top: 1px solid #ddd;
background-color: #f5f5f5;

View File

@ -276,6 +276,7 @@
</ul>
</div>
</div>
<div class="no-projector-spacer" os-perms="!core.can_manage_projector"></div>
<!-- main content column -->
<div class="col-xs-6 content">
<div class="spacer-right"> <!-- horizontal block -->

View File

@ -947,6 +947,10 @@ angular.module('OpenSlidesApp.motions.site', [
motion.reason = motion.getReason(-1);
Motion.save(motion);
};
// delete single motion
$scope.delete = function (motion) {
Motion.destroy(motion.id);
};
$scope.toggleTag = function (motion, tag) {
if ($scope.hasTag(motion, tag)) {
// remove
@ -1038,18 +1042,40 @@ angular.module('OpenSlidesApp.motions.site', [
});
}
};
// delete selected motions
$scope.deleteMultiple = function () {
var selectModeAction = function (predicate) {
angular.forEach($scope.motionsFiltered, function (motion) {
if (motion.selected)
Motion.destroy(motion.id);
if (motion.selected) {
predicate(motion);
}
});
$scope.isSelectMode = false;
$scope.uncheckAll();
};
// delete single motion
$scope.delete = function (motion) {
Motion.destroy(motion.id);
// delete selected motions
$scope.deleteMultiple = function () {
selectModeAction(function (motion) {
$scope.delete(motion);
});
};
// set status for selected motions
$scope.setStatusMultiple = function (stateId) {
selectModeAction(function (motion) {
$scope.updateState(motion, stateId);
});
};
// set category for selected motions
$scope.setCategoryMultiple = function (categoryId) {
selectModeAction(function (motion) {
motion.category_id = categoryId === 'no_category_selected' ? null : categoryId;
$scope.save(motion);
});
};
// set status for selected motions
$scope.setMotionBlockMultiple = function (motionBlockId) {
selectModeAction(function (motion) {
motion.motion_block_id = motionBlockId === 'no_motionBlock_selected' ? null : motionBlockId;
$scope.save(motion);
});
};
}
])

View File

@ -77,12 +77,58 @@
</div>
<div uib-collapse="!isSelectMode" class="row spacer">
<div class="col-sm-12 text-left">
<div class="col-sm-12 text-left form-inline" ng-show="isSelectMode" os-perms="motions.can_manage">
<!-- actions -->
<select ng-model="selectedAction" class="form-control">
<option value="" translate>--- Select action ---</option>
<option value="delete" translate>Delete</option>
<option value="setStatus" translate>Set status</option>
<option value="setCategory" ng-if="categories.length" translate>Set category</option>
<option value="setMotionBlock" ng-if="motionBlocks.length" translate>Set motion block</option>
</select>
<!-- state select -->
<select ng-show="selectedAction == 'setStatus'" ng-model="selectedState" class="form-control">
<option value="">--- <translate>Select state</translate> ---</option>
<option ng-repeat="state in states" ng-disabled="state.workflowHeader" value="{{ state.id }}">
{{ (state.workflowHeader ? state.headername : state.name) | translate }}
</option>
</select>
<!-- set state button -->
<a ng-show="selectedAction == 'setStatus' && selectedState"
ng-click="setStatusMultiple(selectedState)" class="btn btn-default">
<translate>Set status</translate>
</a>
<!-- category select -->
<select ng-show="selectedAction == 'setCategory'" ng-model="selectedCategory" class="form-control">
<option value="">--- <translate>Select category</translate> ---</option>
<option ng-repeat="category in categories" value="{{ category.id }}">
{{ category.name }}
</option>
<option value="no_category_selected" translate>No category</option>
</select>
<!-- set category button -->
<a ng-show="selectedAction == 'setCategory' && selectedCategory"
ng-click="setCategoryMultiple(selectedCategory)" class="btn btn-default">
<translate>Set category</translate>
</a>
<!-- motionBlock select -->
<select ng-show="selectedAction == 'setMotionBlock'" ng-model="selectedMotionBlock" class="form-control">
<option value="">--- <translate>Select motion block</translate> ---</option>
<option ng-repeat="motionBlock in motionBlocks" value="{{ motionBlock.id }}">
{{ motionBlock.title }}
</option>
<option value="no_motionBlock_selected" translate>No motion block</option>
</select>
<!-- set motion block button -->
<a ng-show="selectedAction == 'setMotionBlock' && selectedMotionBlock"
ng-click="setMotionBlockMultiple(selectedMotionBlock)" class="btn btn-default">
<translate>Set motion block</translate>
</a>
<!-- delete button -->
<a ng-show="isSelectMode" os-perms="motions.can_manage"
<a ng-show="selectedAction == 'delete'"
ng-bootbox-confirm="{{ 'Are you sure you want to delete all selected motions?' | translate }}"
ng-bootbox-confirm-action="deleteMultiple()"
class="btn btn-primary">
class="btn btn-danger">
<i class="fa fa-trash fa-lg"></i>
<translate>Delete selected motions</translate>
</a>
@ -385,6 +431,7 @@
<projector-button model="motion" default-projector-id="defaultProjectorId">
</projector-button>
</div>
<div class="no-projector-spacer" os-perms="!core.can_manage_projector"></div>
<!-- main content column -->
<div class="col-xs-6 content">
<div class="id-col">

View File

@ -274,6 +274,7 @@
<projector-button model="user" default-projector-id="defaultProjectorId">
</projector-button>
</div>
<div class="no-projector-spacer" os-perms="!core.can_manage_projector"></div>
<!-- main content column -->
<div class="col-xs-6 content">
<div class="spacer-right"> <!-- horizontal block -->