More motion select mode options and layout changes for guests

This commit is contained in:
FinnStutzenstein 2016-12-12 12:14:30 +01:00
parent 5cc820d6d2
commit dbdaa9748c
7 changed files with 92 additions and 10 deletions

View File

@ -256,6 +256,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<div class="no-projector-spacer" os-perms="!core.can_manage_projector"></div>
<!-- main content column --> <!-- main content column -->
<div class="col-xs-6 content" style="padding-left: calc({{ item.parentCount }}*15px)"> <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 model="assignment", default-projector-id="defaultProjectorId">
</projector-button> </projector-button>
</div> </div>
<div class="no-projector-spacer" os-perms="!core.can_manage_projector"></div>
<!-- main contant column --> <!-- main contant column -->
<div class="col-xs-6 content"> <div class="col-xs-6 content">
<div class="title-col"> <div class="title-col">

View File

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

View File

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

View File

@ -944,6 +944,10 @@ angular.module('OpenSlidesApp.motions.site', [
motion.reason = motion.getReason(-1); motion.reason = motion.getReason(-1);
Motion.save(motion); Motion.save(motion);
}; };
// delete single motion
$scope.delete = function (motion) {
Motion.destroy(motion.id);
};
$scope.toggleTag = function (motion, tag) { $scope.toggleTag = function (motion, tag) {
if ($scope.hasTag(motion, tag)) { if ($scope.hasTag(motion, tag)) {
// remove // remove
@ -1035,18 +1039,40 @@ angular.module('OpenSlidesApp.motions.site', [
}); });
} }
}; };
// delete selected motions var selectModeAction = function (predicate) {
$scope.deleteMultiple = function () {
angular.forEach($scope.motionsFiltered, function (motion) { angular.forEach($scope.motionsFiltered, function (motion) {
if (motion.selected) if (motion.selected) {
Motion.destroy(motion.id); predicate(motion);
}
}); });
$scope.isSelectMode = false; $scope.isSelectMode = false;
$scope.uncheckAll(); $scope.uncheckAll();
}; };
// delete single motion // delete selected motions
$scope.delete = function (motion) { $scope.deleteMultiple = function () {
Motion.destroy(motion.id); 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>
<div uib-collapse="!isSelectMode" class="row spacer"> <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 --> <!-- 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="{{ 'Are you sure you want to delete all selected motions?' | translate }}"
ng-bootbox-confirm-action="deleteMultiple()" ng-bootbox-confirm-action="deleteMultiple()"
class="btn btn-primary"> class="btn btn-danger">
<i class="fa fa-trash fa-lg"></i> <i class="fa fa-trash fa-lg"></i>
<translate>Delete selected motions</translate> <translate>Delete selected motions</translate>
</a> </a>
@ -385,6 +431,7 @@
<projector-button model="motion" default-projector-id="defaultProjectorId"> <projector-button model="motion" default-projector-id="defaultProjectorId">
</projector-button> </projector-button>
</div> </div>
<div class="no-projector-spacer" os-perms="!core.can_manage_projector"></div>
<!-- main content column --> <!-- main content column -->
<div class="col-xs-6 content"> <div class="col-xs-6 content">
<div class="id-col"> <div class="id-col">

View File

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