New AgendaTable

This commit is contained in:
FinnStutzenstein 2016-12-02 09:38:02 +01:00
parent a245236392
commit ee5adb8fd2
14 changed files with 585 additions and 324 deletions

View File

@ -178,6 +178,7 @@ OpenSlides uses the following projects or parts of them:
* `angular-bootstrap <http://angular-ui.github.io/bootstrap>`_, License: MIT * `angular-bootstrap <http://angular-ui.github.io/bootstrap>`_, License: MIT
* `angular-bootstrap-colorpicker <https://github.com/buberdds/angular-bootstrap-colorpicker>`_, License: MIT * `angular-bootstrap-colorpicker <https://github.com/buberdds/angular-bootstrap-colorpicker>`_, License: MIT
* `angular-chosen-localytics <http://github.com/leocaseiro/angular-chosen>`_, License: MIT * `angular-chosen-localytics <http://github.com/leocaseiro/angular-chosen>`_, License: MIT
* `angular-cookies <https://github.com/angular/bower-angular-cookies>`_, License: MIT
* `angular-csv-import <https://github.com/bahaaldine/angular-csv-import>`_, License: MIT * `angular-csv-import <https://github.com/bahaaldine/angular-csv-import>`_, License: MIT
* `angular-formly <http://formly-js.github.io/angular-formly/>`_, License: MIT * `angular-formly <http://formly-js.github.io/angular-formly/>`_, License: MIT
* `angular-formly-templates-bootstrap <https://github.com/formly-js/angular-formly-templates-bootstrap>`_, License: MIT * `angular-formly-templates-bootstrap <https://github.com/formly-js/angular-formly-templates-bootstrap>`_, License: MIT
@ -191,6 +192,7 @@ OpenSlides uses the following projects or parts of them:
* `angular-ui-router <http://angular-ui.github.io/ui-router/>`_, License: MIT * `angular-ui-router <http://angular-ui.github.io/ui-router/>`_, License: MIT
* `angular-ui-tinymce <http://angular-ui.github.com>`_, License: MIT * `angular-ui-tinymce <http://angular-ui.github.com>`_, License: MIT
* `angular-ui-tree <https://github.com/angular-ui-tree/angular-ui-tree>`_, License: MIT * `angular-ui-tree <https://github.com/angular-ui-tree/angular-ui-tree>`_, License: MIT
* `angular-xeditable <https://github.com/vitalets/angular-xeditable>`_, License: MIT
* `api-check <https://github.com/kentcdodds/api-check>`_, License: MIT * `api-check <https://github.com/kentcdodds/api-check>`_, License: MIT
* `bootstrap <http://getbootstrap.com>`_, License: MIT * `bootstrap <http://getbootstrap.com>`_, License: MIT
* `bootstrap-ui-datetime-picker <https://github.com/Gillardo/bootstrap-ui-datetime-picker>`_, License: MIT * `bootstrap-ui-datetime-picker <https://github.com/Gillardo/bootstrap-ui-datetime-picker>`_, License: MIT

View File

@ -9,6 +9,7 @@
"angular-bootstrap-colorpicker": "~3.0.25", "angular-bootstrap-colorpicker": "~3.0.25",
"angular-chosen-localytics": "~1.5.0", "angular-chosen-localytics": "~1.5.0",
"angular-csv-import": "0.0.36", "angular-csv-import": "0.0.36",
"angular-cookies": "~1.5.9",
"angular-file-saver": "~1.1.2", "angular-file-saver": "~1.1.2",
"angular-formly": "~8.4.0", "angular-formly": "~8.4.0",
"angular-formly-templates-bootstrap": "~6.2.0", "angular-formly-templates-bootstrap": "~6.2.0",
@ -21,6 +22,7 @@
"angular-ui-router": "~0.3.1", "angular-ui-router": "~0.3.1",
"angular-ui-tinymce": "~0.0.17", "angular-ui-tinymce": "~0.0.17",
"angular-ui-tree": "~2.22.0", "angular-ui-tree": "~2.22.0",
"angular-xeditable": "~0.5.0",
"bootstrap-css-only": "~3.3.6", "bootstrap-css-only": "~3.3.6",
"bootstrap-ui-datetime-picker": "~2.4.0", "bootstrap-ui-datetime-picker": "~2.4.0",
"docxtemplater": "~2.1.5", "docxtemplater": "~2.1.5",

View File

@ -107,8 +107,12 @@ angular.module('OpenSlidesApp.agenda.site', [
'AgendaContentProvider', 'AgendaContentProvider',
'PdfMakeDocumentProvider', 'PdfMakeDocumentProvider',
'gettextCatalog', 'gettextCatalog',
'gettext',
'osTableFilter',
'AgendaCsvExport',
function($scope, $filter, $http, $state, DS, operator, ngDialog, Agenda, TopicForm, AgendaTree, Projector, function($scope, $filter, $http, $state, DS, operator, ngDialog, Agenda, TopicForm, AgendaTree, Projector,
ProjectionDefault, AgendaContentProvider, PdfMakeDocumentProvider, gettextCatalog) { ProjectionDefault, AgendaContentProvider, PdfMakeDocumentProvider, gettextCatalog, gettext, osTableFilter,
AgendaCsvExport) {
// Bind agenda tree to the scope // Bind agenda tree to the scope
$scope.$watch(function () { $scope.$watch(function () {
return Agenda.lastModified(); return Agenda.lastModified();
@ -132,6 +136,87 @@ angular.module('OpenSlidesApp.agenda.site', [
}); });
$scope.alert = {}; $scope.alert = {};
// Filtering
$scope.filter = osTableFilter.createInstance('AgendaTableFilter');
if (!$scope.filter.existsCookie()) {
$scope.filter.booleanFilters = {
closed: {
value: undefined,
displayName: gettext('Closed items'),
choiceYes: gettext('Closed items'),
choiceNo: gettext('Open items'),
},
is_hidden: {
value: undefined,
displayName: gettext('Internal items'),
choiceYes: gettext('Internal items'),
choiceNo: gettext('No internal items'),
},
};
$scope.filter.save();
}
$scope.filter.propertyList = ['item_number', 'title', 'title_list_view', 'comment', 'duration'];
$scope.filter.propertyFunctionList = [
function (item) {return item.getListViewTitle();},
];
$scope.filter.propertyDict = {
'speakers' : function (speaker) {
console.log(speaker);
return '';
},
};
// pagination
$scope.currentPage = 1;
$scope.itemsPerPage = 100;
$scope.limitBegin = 0;
$scope.pageChanged = function() {
$scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage;
};
// parse duration for inline editing
$scope.generateDurationText = function (item) {
//convert data from model format (m) to view format (hh:mm)
if (item.duration) {
var time = "",
totalminutes = item.duration;
if (totalminutes < 0) {
time = "-";
totalminutes = -totalminutes;
}
var hh = Math.floor(totalminutes / 60);
var mm = Math.floor(totalminutes % 60);
// Add leading "0" for double digit values
mm = ("0"+mm).slice(-2);
time += hh + ":" + mm;
item.durationText = time;
} else {
item.durationText = "";
}
};
$scope.setDurationText = function (item) {
//convert data from view format (hh:mm) to model format (m)
var time = item.durationText.replace('h', '').split(':');
var data;
if (time.length > 1 && !isNaN(time[0]) && !isNaN(time[1])) {
data = (+time[0]) * 60 + (+time[1]);
if (data < 0) {
data = "-"+data;
}
item.duration = parseInt(data);
} else if (time.length == 1 && !isNaN(time[0])) {
data = (+time[0]);
item.duration = parseInt(data);
} else {
item.duration = 0;
}
$scope.save(item);
};
/** Duration calculations **/
$scope.sumDurations = function () { $scope.sumDurations = function () {
var totalDuration = 0; var totalDuration = 0;
$scope.items.forEach(function (item) { $scope.items.forEach(function (item) {
@ -141,7 +226,6 @@ angular.module('OpenSlidesApp.agenda.site', [
}); });
return totalDuration; return totalDuration;
}; };
$scope.calculateEndTime = function () { $scope.calculateEndTime = function () {
var totalDuration = $scope.sumDurations(); var totalDuration = $scope.sumDurations();
var startTimestamp = $scope.config('agenda_start_event_date_time'); var startTimestamp = $scope.config('agenda_start_event_date_time');
@ -156,22 +240,33 @@ angular.module('OpenSlidesApp.agenda.site', [
} }
}; };
$scope.getUpdateStatePrefix = function (item) { /** Agenda item functions **/
var prefix = item.content_object.collection.replace('/','.'); // open dialog for new topics // TODO Remove this. Don't forget import button in template.
// Hotfix for Issue 2566. $scope.newDialog = function () {
// The changes could be reverted if Issue 2480 is closed. ngDialog.open(TopicForm.getDialog());
prefix = prefix.replace('motion-block', 'motionBlock');
return prefix;
}; };
// save changed item
// pagination $scope.save = function (item) {
$scope.currentPage = 1; Agenda.save(item).then(
$scope.itemsPerPage = 100; function(success) {
$scope.limitBegin = 0; $scope.alert.show = false;
$scope.pageChanged = function() { },
$scope.limitBegin = ($scope.currentPage - 1) * $scope.itemsPerPage; function(error){
var message = '';
for (var e in error.data) {
message += e + ': ' + error.data[e] + ' ';
}
$scope.alert = { type: 'danger', msg: message, show: true };
});
};
// delete related item
$scope.deleteRelatedItem = function (item) {
DS.destroy(item.content_object.collection, item.content_object.id);
};
// auto numbering of agenda items
$scope.autoNumbering = function() {
$http.post('/rest/agenda/item/numbering/', {});
}; };
// check open permission // check open permission
// TODO: Use generic solution here. // TODO: Use generic solution here.
$scope.isAllowedToSeeOpenLink = function (item) { $scope.isAllowedToSeeOpenLink = function (item) {
@ -189,47 +284,37 @@ angular.module('OpenSlidesApp.agenda.site', [
return false; return false;
} }
}; };
// open dialog for new topics // TODO Remove this. Don't forget import button in template. $scope.getUpdateStatePrefix = function (item) {
$scope.newDialog = function () { var prefix = item.content_object.collection.replace('/','.');
ngDialog.open(TopicForm.getDialog()); // Hotfix for Issue 2566.
// The changes could be reverted if Issue 2480 is closed.
prefix = prefix.replace('motion-block', 'motionBlock');
return prefix;
}; };
// cancel QuickEdit mode // export
$scope.cancelQuickEdit = function (item) { $scope.pdfExport = function () {
// revert all changes by restore (refresh) original item object from server var filename = gettextCatalog.getString('Agenda') + '.pdf';
Agenda.refresh(item); var agendaContentProvider = AgendaContentProvider.createInstance($scope.itemsFiltered);
item.quickEdit = false; var documentProvider = PdfMakeDocumentProvider.createInstance(agendaContentProvider);
pdfMake.createPdf(documentProvider.getDocument()).download(filename);
}; };
// save changed item $scope.csvExport = function () {
$scope.save = function (item) { var element = document.getElementById('downloadLinkCSV');
Agenda.save(item).then( AgendaCsvExport(element, $scope.itemsFiltered);
function(success) {
item.quickEdit = false;
$scope.alert.show = false;
},
function(error){
var message = '';
for (var e in error.data) {
message += e + ': ' + error.data[e] + ' ';
}
$scope.alert = { type: 'danger', msg: message, show: true };
});
};
// delete related item
$scope.deleteRelatedItem = function (item) {
DS.destroy(item.content_object.collection, item.content_object.id);
}; };
// *** delete mode functions *** /** select mode functions **/
$scope.isDeleteMode = false; $scope.isSelectMode = false;
// check all checkboxes // check all checkboxes
$scope.checkAll = function () { $scope.checkAll = function () {
$scope.selectedAll = !$scope.selectedAll;
angular.forEach($scope.items, function (item) { angular.forEach($scope.items, function (item) {
item.selected = $scope.selectedAll; item.selected = $scope.selectedAll;
}); });
}; };
// uncheck all checkboxes if isDeleteMode is closed // uncheck all checkboxes if isDeleteMode is closed
$scope.uncheckAll = function () { $scope.uncheckAll = function () {
if (!$scope.isDeleteMode) { if (!$scope.isSelectMode) {
$scope.selectedAll = false; $scope.selectedAll = false;
angular.forEach($scope.items, function (item) { angular.forEach($scope.items, function (item) {
item.selected = false; item.selected = false;
@ -243,7 +328,7 @@ angular.module('OpenSlidesApp.agenda.site', [
DS.destroy(item.content_object.collection, item.content_object.id); DS.destroy(item.content_object.collection, item.content_object.id);
} }
}); });
$scope.isDeleteMode = false; $scope.isSelectMode = false;
$scope.uncheckAll(); $scope.uncheckAll();
}; };
@ -319,17 +404,6 @@ angular.module('OpenSlidesApp.agenda.site', [
}); });
return projectorIds; return projectorIds;
}; };
// auto numbering of agenda items
$scope.autoNumbering = function() {
$http.post('/rest/agenda/item/numbering/', {});
};
$scope.makePDF = function() {
var filename = gettextCatalog.getString('Agenda') + '.pdf';
var agendaContentProvider = AgendaContentProvider.createInstance($scope.items);
var documentProvider = PdfMakeDocumentProvider.createInstance(agendaContentProvider);
pdfMake.createPdf(documentProvider.getDocument()).download(filename);
};
} }
]) ])
@ -613,6 +687,30 @@ angular.module('OpenSlidesApp.agenda.site', [
} }
]) ])
.factory('AgendaCsvExport', [
function () {
return function (element, agenda) {
var csvRows = [
['title', 'text', 'duration', 'comment', 'is_hidden'],
];
_.forEach(agenda, function (item) {
var row = [];
row.push('"' + (item.title || '') + '"');
row.push('"' + (item.text || '') + '"');
row.push('"' + (item.duration || '') + '"');
row.push('"' + (item.comment || '') + '"');
row.push('"' + (item.is_hidden ? '1' : '') + '"');
csvRows.push(row);
});
var csvString = csvRows.join("%0A");
element.href = 'data:text/csv;charset=utf-8,' + csvString;
element.download = 'agenda-export.csv';
element.target = '_blank';
};
}
])
//mark all agenda config strings for translation with Javascript //mark all agenda config strings for translation with Javascript
.config([ .config([
'gettext', 'gettext',

View File

@ -61,66 +61,61 @@
<div class="details"> <div class="details">
<div class="row"> <div class="row">
<div class="col-sm-7"> <div class="col-sm-12">
<div class="form-inline"> <!-- select mode -->
<!-- delete mode --> <button os-perms="agenda.can_manage" class="btn btn-sm"
<button os-perms="agenda.can_manage" class="btn btn-sm" ng-class="$parent.isSelectMode ? 'btn-primary' : 'btn-default'"
ng-class="$parent.isDeleteMode ? 'btn-primary' : 'btn-default'" ng-click="$parent.isSelectMode = !$parent.isSelectMode; uncheckAll()">
ng-click="$parent.isDeleteMode = !$parent.isDeleteMode; uncheckAll()"> <i class="fa fa-check-square-o"></i>
<i class="fa fa-check-square-o"></i> <translate>Select ...</translate>
<translate>Select ...</translate> </button>
</button> <!-- sort button -->
<a ui-sref="agenda.item.sort" os-perms="agenda.can_manage" class="btn btn-default btn-sm">
<!-- sort button --> <i class="fa fa-sitemap fa-lg"></i>
<a ui-sref="agenda.item.sort" os-perms="agenda.can_manage" class="btn btn-default btn-sm"> <translate>Sort ...</translate>
<i class="fa fa-sitemap fa-lg"></i> </a>
<translate>Sort ...</translate> <!-- auto numbering button -->
</a> <button os-perms="core.can_manage_projector" class="btn btn-default btn-sm"
<!-- auto numbering button --> ng-click="autoNumbering()">
<a os-perms="core.can_manage_projector" <i class="fa fa-sort-numeric-asc"></i>
class="btn btn-default btn-sm" <translate>Numbering</translate>
ng-click="autoNumbering()"> </button>
<i class="fa fa-sort-numeric-asc"></i> <!-- pdf -->
<translate>Numbering</translate> <div class="pull-right" uib-dropdown>
</a> <button type="button" class="btn btn-default" id="dropdownExport" uib-dropdown-toggle>
<!-- pdf --> <i class="fa fa-upload"></i>
<a ng-click="makePDF()" class="btn btn-default btn-sm"> <span ng-if="itemsFiltered.length == items.length" translate>
<i class="fa fa-file-pdf-o fa-lg"></i> Export all
<translate>PDF</translate> </span>
</a> <span ng-if="itemsFiltered.length != items.length" translate>
</div> Export filtered
</div> </span>
<div class="col-sm-5"> <span class="caret"></span>
<div class="form-inline text-right">
<div class="form-group">
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-search"></i></div>
<input type="text" ng-model="filter.search" class="form-control"
placeholder="{{ 'Search' | translate}}">
</div>
</div>
<button class="btn btn-default" ng-click="isFilterOpen = !isFilterOpen"
ng-class="isFilterOpen ? 'btn-primary' : 'btn-default'">
<i class="fa fa-filter"></i>
<translate>Filter ...</translate>
</button> </button>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownExport">
<!-- PDF export -->
<li>
<a href="" ng-click="pdfExport()">
<i class="fa fa-file-pdf-o fa-lg"></i>
PDF
</a>
</li>
<!-- CSV export -->
<li>
<a href="" id="downloadLinkCSV"
ng-click="csvExport()">
<i class="fa fa-file-text-o fa-lg"></i>
CSV
</a>
</li>
</ul>
</div> </div>
</div> </div>
</div> </div>
<div uib-collapse="!isFilterOpen" class="row spacer"> <div uib-collapse="!isSelectMode" class="row spacer">
<div class="col-sm-12 text-right">
<!-- hidden item filter -->
<input type="checkbox" ng-model="filter.showHiddenItems" ng-true-value="" ng-false-value="false">
<translate> Show internal items</translate>
<!-- closed filter -->
<input type="checkbox" ng-model="filter.showClosedItems" ng-true-value="" ng-false-value="false">
<translate> Show closed items</translate>
</div>
</div>
<div uib-collapse="!isDeleteMode" class="row spacer">
<div class="col-sm-12 text-left"> <div class="col-sm-12 text-left">
<!-- delete button --> <!-- delete button -->
<a ng-show="isDeleteMode" os-perms="agenda.can_manage" <a ng-show="isSelectMode" os-perms="agenda.can_manage"
ng-bootbox-confirm="{{ 'Are you sure you want to delete all selected agenda items?' | translate }}" ng-bootbox-confirm="{{ 'Are you sure you want to delete all selected agenda items?' | translate }}"
ng-bootbox-confirm-action="deleteMultiple()" ng-bootbox-confirm-action="deleteMultiple()"
class="btn btn-primary"> class="btn btn-primary">
@ -134,148 +129,214 @@
<span os-perms="agenda.can_see_hidden_items">{{ itemsFiltered.length }} /</span> <span os-perms="agenda.can_see_hidden_items">{{ itemsFiltered.length }} /</span>
{{ items.length }} {{ "items" | translate }}<span ng-if="(items|filter:{selected:true}).length > 0">, {{ items.length }} {{ "items" | translate }}<span ng-if="(items|filter:{selected:true}).length > 0">,
{{(items|filter:{selected:true}).length}} {{ "selected" | translate }}</span> {{(items|filter:{selected:true}).length}} {{ "selected" | translate }}</span>
<span os-perms="agenda.can_see_hidden_items" class="optional">
<span ng-if="sumDurations() > 0">&middot;
<translate>Duration</translate>:
{{ sumDurations() | osMinutesToTime }}h
<span ng-if="config('agenda_start_event_date_time')">
(<translate>Estimated end:</translate> {{ calculateEndTime() }})
</span>
</span>
</div> </div>
<table class="table table-striped table-bordered table-hover">
<thead> <div class="os-table container-fluid">
<tr> <div class="row header-row">
<!-- projector column --> <div class="col-xs-1 centered" ng-show="isSelectMode">
<th ng-show="!isDeleteMode" os-perms="core.can_manage_projector" class="minimum"></th> <i class="fa text-danger pointer" ng-class="selectedAll ? 'fa-check-square-o' : 'fa-square-o'"
<!-- delete selection column --> ng-click="checkAll()"></i>
<th ng-show="isDeleteMode" os-perms="agenda.can_manage" class="minimum deleteColumn" </div>
ng-click="$event.stopPropagation();"> <div class="col-xs-11 main-header">
<input type="checkbox" ng-model="$parent.selectedAll" ng-change="checkAll()"> <span class="form-inline text-right pull-right">
<!-- agenda item column --> <!-- clear all filters -->
<th> <span class="sort-spacer pointer" ng-click="filter.reset()"
<translate>Agenda item</translate> ng-if="filter.areFiltersSet()" ng-disabled="isSelectMode"
<th os-perms="agenda.can_see_hidden_items" class="optional"> ng-class="{'disabled': isSelectMode}">
<translate>Duration</translate> <i class="fa fa-times-circle"></i>
<span ng-if="sumDurations() > 0"> <translate>Filter</translate>
{{ sumDurations() | osMinutesToTime }}h
<span ng-if="config('agenda_start_event_date_time')">
(<translate>Estimated end:</translate> {{ calculateEndTime() }})
</span>
</span> </span>
<th class="minimum optional"> <!-- boolean Filters -->
<translate>Done</translate> <span ng-repeat="(name, booleanFilter) in filter.booleanFilters" uib-dropdown>
<tbody> <span class="pointer" id="dropdown{{ name }}" uib-dropdown-toggle
<tr ng-repeat="item in itemsFiltered = (items | filter: filter.search | ng-class="{'bold': booleanFilter.value !== undefined, 'disabled': isSelectMode}"
filter: {is_hidden: filter.showHiddenItems} | filter: {closed: filter.showClosedItems}) | ng-disabled="isSelectMode">
limitTo : itemsPerPage : limitBegin" {{ booleanFilter.displayName }}
class="animate-item"
ng-class="{ 'activeline': item.isProjected().length, 'selected': item.selected, 'hiddenrow': item.is_hidden}">
<!-- projector column -->
<td ng-show="!isDeleteMode" os-perms="core.can_manage_projector">
<div class="btn-group" style="min-width:{{ (item.hasSubitems(items) || projectors.length > 1) ? '54' : '34' }}px;" uib-dropdown
uib-tooltip="{{ 'Projector' | translate }} {{ item.isProjected(item.tree)[0] || '' }}"
tooltip-enable="item.isProjected(item.tree).length">
<button class="btn btn-default btn-sm"
title="{{ 'Project item' | translate }}"
ng-click="item.project(getProjectionDefault(item), item.tree)"
ng-class="{ 'btn-primary': item.isProjected(item.tree).length && inArray(item.isProjected(item.tree), getProjectionDefault(item))}">
<i class="fa fa-video-camera"></i>
</button>
<button type="button" class="btn btn-default btn-sm slimDropDown"
ng-class="{ 'btn-primary': item.isProjected(item.tree).length && !inArray(item.isProjected(item.tree), getProjectionDefault(item))}"
ng-if="item.hasSubitems(items) || projectors.length > 1"
uib-dropdown-toggle>
<span class="caret"></span> <span class="caret"></span>
</button> </span>
<ul class="dropdown-menu" role="menu" aria-labelledby="split-button" <ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdown{{ name }}">
ng-if="item.hasSubitems(items) || projectors.length > 1"> <li>
<li role="menuitem" ng-show="item.hasSubitems(items)"> <a href ng-click="booleanFilter.value = (booleanFilter.value ? undefined : true); filter.save();">
<a href="" ng-click="changeItemTree(item); $event.stopPropagation();"> <i class="fa" ng-class="{'fa-check': booleanFilter.value === true}"></i>
<i class="fa" ng-class="item.tree ? 'fa-check-square-o' : 'fa-square-o'"></i> {{ booleanFilter.choiceYes }}
<translate>Include all sub items</translate>
</a> </a>
</li> </li>
<li class="divider" ng-show="item.hasSubitems(items)"></li> <li>
<li role="menuitem" ng-repeat="projector in projectors"> <a href ng-click="booleanFilter.value = (booleanFilter.value === false) ? undefined : false; filter.save();">
<a href="" ng-click="item.project(projector.id, item.tree)" <i class="fa" ng-class="{'fa-check': booleanFilter.value === false}"></i>
ng-class="{ 'projected': inArray(item.isProjected(item.tree), projector.id) }"> {{ booleanFilter.choiceNo }}
<i class="fa fa-video-camera" ng-show="inArray(item.isProjected(item.tree), projector.id)"></i>
{{ projector.name | translate }}
<span ng-if="projector.id == getProjectionDefault(item)">(<translate>Default</translate>)</span>
</a> </a>
</li> </li>
</ul> </ul>
</div>
<!-- delete selection column -->
<td ng-show="isDeleteMode" os-perms="agenda.can_manage" class="deleteColumn">
<input type="checkbox" ng-model="item.selected">
<!-- agenda data columns -->
<td ng-if="!item.quickEdit" ng-mouseover="item.hover=true" ng-mouseleave="item.hover=false"
style="padding-left: calc(8px + {{ item.parentCount }}*15px)">
<strong>
<a ui-sref="{{ getUpdateStatePrefix(item) }}.detail({id: item.content_object.id})" ng-show="isAllowedToSeeOpenLink(item)">
{{ item.getListViewTitle() }}
</a>
<span ng-hide="isAllowedToSeeOpenLink(item)">
{{ item.getListViewTitle() }}
</span>
</strong>
<span ng-if="item.is_hidden" title="{{ 'Internal item' | translate }}"><i class="fa fa-ban"></i></span>
<div ng-if="item.comment">
<small><i class="fa fa-info-circle"></i> {{ item.comment }}</small>
</div>
<div os-perms="agenda.can_see" class="hoverActions" ng-class="{'hiddenDiv': !item.hover}">
<a ui-sref="agenda.item.detail({id: item.id})" translate>List of speakers</a>
<span os-perms="agenda.can_manage"> |
<a ui-sref="{{ getUpdateStatePrefix(item) }}.detail.update({id: item.content_object.id})"
translate>Edit</a> |
<a href="" ng-click="item.quickEdit=true" translate>QuickEdit</a> |
<a href="" class="text-danger"
ng-bootbox-confirm="{{ 'Are you sure you want to delete this entry?' | translate }}<br>
<b>{{ item.getTitle() }}</b>"
ng-bootbox-confirm-action="deleteRelatedItem(item)" translate>Delete</a>
</span>
</div>
<td ng-show="!item.quickEdit" os-perms="agenda.can_see_hidden_items" class="optional">
{{ item.duration | osMinutesToTime }}
<span ng-if="item.duration" translate-comment="'h' means time in hours" translate>h</span>
<td ng-if="!item.quickEdit" class="optional">
<span os-perms="!agenda.can_manage">
<i ng-if="item.closed" class="fa fa-check-square-o"></i>
</span> </span>
<input os-perms="agenda.can_manage" type="checkbox" ng-model="item.closed" ng-change="save(item);"> <!-- search field -->
<!-- quickEdit columns --> <span class="form-group">
<td ng-show="item.quickEdit" os-perms="agenda.can_manage" colspan="3"> <span class="input-group">
<h4>{{ item.getTitle() }} <span class="text-muted">&ndash; QuickEdit</span></h4> <span class="input-group-addon"><i class="fa fa-search"></i></span>
<div uib-alert ng-show="alert.show" ng-class="'alert-' + (alert.type || 'warning')" ng-click="alert={}" close="alert={}"> <input type="text" ng-model="filter.filterString" class="form-control"
{{ alert.msg }} placeholder="{{ 'Search' | translate}}" ng-disabled="isSelectMode"
ng-change="filter.save()">
</span>
</span>
</span>
<!-- show all selected multiselectoptions -->
<span>
<!-- for all boolean Filters -->
<span ng-repeat="(name, booleanFilter) in filter.booleanFilters"
ng-hide="booleanFilter.value === undefined"
class="pointer spacer-left-lg"
ng-click="booleanFilter.value = undefined; filter.save();"
ng-class="{'disabled': isSelectMode}">
<span class="nobr">
<i class="fa fa-times-circle"></i>
{{ booleanFilter.value ? booleanFilter.choiceYes : booleanFilter.choiceNo | translate }}
</span>
</span>
</span>
</div>
</div>
<!-- main table -->
<div class="row data-row" ng-mouseover="item.hover=true"
ng-mouseleave="item.hover=false"
ng-class="{'projected': item.isProjected().length}"
ng-repeat="item in itemsFiltered = (items
| osFilter: filter.filterString : filter.getObjectQueryString
| filter: {closed: filter.booleanFilters.closed.value}
| filter: {is_hidden: filter.booleanFilters.is_hidden.value}
| limitTo : itemsPerPage : limitBegin)">
<!-- select column -->
<div ng-show="isSelectMode" os-perms="agenda.can_manage" class="col-xs-1 centered">
<i class="fa text-danger pointer" ng-click="item.selected=!item.selected"
ng-class="item.selected ? 'fa-check-square-o' : 'fa-square-o'"></i>
</div>
<!-- projector column -->
<div class="col-xs-1 centered projector" os-perms="core.can_manage_projector">
<div class="btn-group" style="min-width:{{ (item.hasSubitems(items) || projectors.length > 1) ? '54' : '34' }}px;" uib-dropdown
uib-tooltip="{{ 'Projector' | translate }} {{ item.isProjected(item.tree)[0] || '' }}"
tooltip-enable="item.isProjected(item.tree).length">
<button class="btn btn-default btn-sm"
title="{{ 'Project item' | translate }}"
ng-click="item.project(getProjectionDefault(item), item.tree)"
ng-class="{ 'btn-primary': item.isProjected(item.tree).length && inArray(item.isProjected(item.tree), getProjectionDefault(item))}">
<i class="fa fa-video-camera"></i>
</button>
<button type="button" class="btn btn-default btn-sm slimDropDown"
ng-class="{ 'btn-primary': item.isProjected(item.tree).length && !inArray(item.isProjected(item.tree), getProjectionDefault(item))}"
ng-if="item.hasSubitems(items) || projectors.length > 1"
uib-dropdown-toggle>
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="split-button"
ng-if="item.hasSubitems(items) || projectors.length > 1">
<li role="menuitem" ng-show="item.hasSubitems(items)">
<a href="" ng-click="changeItemTree(item); $event.stopPropagation();">
<i class="fa" ng-class="item.tree ? 'fa-check-square-o' : 'fa-square-o'"></i>
<translate>Include all sub items</translate>
</a>
</li>
<li class="divider" ng-show="item.hasSubitems(items)"></li>
<li role="menuitem" ng-repeat="projector in projectors">
<a href="" ng-click="item.project(projector.id, item.tree)"
ng-class="{ 'projected': inArray(item.isProjected(item.tree), projector.id) }">
<i class="fa fa-video-camera" ng-show="inArray(item.isProjected(item.tree), projector.id)"></i>
{{ projector.name | translate }}
<span ng-if="projector.id == getProjectionDefault(item)">(<translate>Default</translate>)</span>
</a>
</li>
</ul>
</div>
</div>
<!-- main content column -->
<div class="col-xs-6 content" style="padding-left: calc({{ item.parentCount }}*15px)">
<div class="spacer-right">
<strong>
<i class="fa fa-ban fa-lg" ng-style="{'visibility': item.is_hidden ? 'visible' : 'hidden'}"
title="{{ 'Internal item' | translate }}"></i>
</strong>
</div>
<div>
<!-- ID and title -->
<div>
<strong>
<a class="title" ui-sref="{{ getUpdateStatePrefix(item) }}.detail({id: item.content_object.id})" ng-show="isAllowedToSeeOpenLink(item)">
{{ item.getListViewTitle() }}
</a>
<span class="title" ng-hide="isAllowedToSeeOpenLink(item)">
{{ item.getListViewTitle() }}
</span>
</strong>
</div> </div>
<div class="row"> <!-- hover menu -->
<div class="col-xs-6"> <div os-perms="agenda.can_see" ng-class="{'hiddenDiv': !item.hover}">
<label for="inputItemNumber" translate>Item number</label> <small>
<input type="text" ng-model="item.item_number" class="form-control input-sm" id="inputItemNumber"> <a ui-sref="agenda.item.detail({id: item.id})" translate>List of speakers</a>
<span os-perms="agenda.can_manage"> &middot;
<a ui-sref="{{ getUpdateStatePrefix(item) }}.detail.update({id: item.content_object.id})"
translate>Edit</a> &middot;
<a href="" class="text-danger"
ng-bootbox-confirm="{{ 'Are you sure you want to delete this entry?' | translate }}<br>
<b>{{ item.getTitle() }}</b>"
ng-bootbox-confirm-action="deleteRelatedItem(item)" translate>Delete</a>
</span>
</small>
</div>
</div>
</div>
<!-- additional content column -->
<div class="col-xs-4 content" ng-style="{'width': isSelectMode ? 'calc(50% - 120px)' : 'calc(50% - 70px)'}">
<div style="width: 60%;" class="optional">
<small>
<div ng-style="{'visibility': (item.duration || item.hover) ? 'visible' : 'hidden'}">
<div class="popover-wrapper">
<i class="fa fa-clock-o"></i>
<span editable-text="item.durationText" e-placeholder="hh:mm"
onshow="generateDurationText(item)" onaftersave="setDurationText(item)">
{{ (item.duration | osMinutesToTime) || ('Set duration...' | translate) }}
<span ng-if="item.duration" translate-comment="'h' means time in hours" translate>h</span>
</span>
</div>
</div> </div>
<div class="col-xs-6"> <div ng-style="{'visibility': (item.comment || item.hover) ? 'visible' : 'hidden'}">
<label for="inputComment" translate>Comment</label> <div class="popover-wrapper">
<input type="text" ng-model="item.comment" class="form-control input-sm" id="inputComment"> <i class="fa fa-info-circle"></i>
<span editable-text="item.comment" onaftersave="save(item)">{{ item.comment || ('Set comment...' | translate)}}</span>
</div>
</div>
</small>
</div>
<div style="width: 40%;" class="pull-right">
<div os-perms="agenda.can_manage">
<div class="pointer nobr" ng-click="item.type = (item.type == 1) ? 2 : 1; save(item);" ng-show="item.hover || item.is_hidden">
<i class="fa" ng-class="item.is_hidden ? 'fa-check-square-o' : 'fa-square-o'"></i>
<span class="spacer-left" translate>Internal item</span>
</div>
<div class="pointer nobr" ng-click="item.closed = !item.closed; save(item);" ng-show="item.hover || item.closed">
<i class="fa" ng-class="item.closed ? 'fa-check-square-o' : 'fa-square-o'"></i>
<span class="spacer-left" translate>Done</span>
</div> </div>
</div> </div>
<div class="row"> <div os-perms="!agenda.can_manage" ng-if="item.closed">
<div class="col-xs-6"> <i class="fa fa-check-square-o"></i>
<!-- item type: AGENDA_ITEM = 1, HIDDEN_ITEM = 2 --> <span class="spacer-left" translate>Done</span>
<input type="checkbox" ng-model="item.type" ng-true-value="1" ng-false-value="2">
<translate>Show as agenda item</translate>
</div>
<div class="col-xs-6">
<label for="inputDuration" translate>Duration</label>
<input type="text" ng-model="item.duration" placeholder="hh:mm" hour-min-format
class="form-control input-sm" id="inputDuration">
</div>
</div> </div>
<div class="spacer"> </div>
<button ng-click="cancelQuickEdit(item)" class="btn btn-default pull-left" translate> </div>
Cancel </div> <!-- data row -->
</button> &nbsp;
<button ng-click="save(item)" class="btn btn-primary" translate> </div> <!-- container -->
Update
</button>
<a ui-sref="{{ item.content_object.collection.replace('/','.') }}.detail.update({id: item.content_object.id})"
class="pull-right"><translate>Edit ...</translate></a>
</div>
</table>
<ul uib-pagination <ul uib-pagination
ng-show="itemsFiltered.length > itemsPerPage" ng-show="itemsFiltered.length > itemsPerPage"
total-items="itemsFiltered.length" total-items="itemsFiltered.length"
@ -288,4 +349,4 @@
first-text="&laquo;" first-text="&laquo;"
last-text="&raquo;"> last-text="&raquo;">
</ul> </ul>
</div> </div> <!-- details -->

View File

@ -303,9 +303,10 @@ angular.module('OpenSlidesApp.assignments.site', [
'User', 'User',
'osTableFilter', 'osTableFilter',
'osTableSort', 'osTableSort',
'gettext',
function($scope, ngDialog, AssignmentForm, Assignment, Tag, Agenda, phases, Projector, ProjectionDefault, function($scope, ngDialog, AssignmentForm, Assignment, Tag, Agenda, phases, Projector, ProjectionDefault,
gettextCatalog, AssignmentContentProvider, AssignmentCatalogContentProvider, PdfMakeDocumentProvider, gettextCatalog, AssignmentContentProvider, AssignmentCatalogContentProvider, PdfMakeDocumentProvider,
User, osTableFilter, osTableSort) { User, osTableFilter, osTableSort, gettext) {
Assignment.bindAll({}, $scope, 'assignments'); Assignment.bindAll({}, $scope, 'assignments');
Tag.bindAll({}, $scope, 'tags'); Tag.bindAll({}, $scope, 'tags');
$scope.$watch(function () { $scope.$watch(function () {
@ -320,11 +321,14 @@ angular.module('OpenSlidesApp.assignments.site', [
$scope.alert = {}; $scope.alert = {};
// Filtering // Filtering
$scope.filter = osTableFilter.createInstance(); $scope.filter = osTableFilter.createInstance('AssignmentTableFilter');
$scope.filter.multiselectFilters = {
tag: [], if (!$scope.filter.existsCookie()) {
phase: [], $scope.filter.multiselectFilters = {
}; tag: [],
phase: [],
};
}
$scope.filter.propertyList = ['title', 'description']; $scope.filter.propertyList = ['title', 'description'];
$scope.filter.propertyFunctionList = [ $scope.filter.propertyFunctionList = [
function (assignment) { function (assignment) {

View File

@ -162,7 +162,8 @@
<span class="input-group"> <span class="input-group">
<span class="input-group-addon"><i class="fa fa-search"></i></span> <span class="input-group-addon"><i class="fa fa-search"></i></span>
<input type="text" ng-model="filter.filterString" class="form-control" <input type="text" ng-model="filter.filterString" class="form-control"
placeholder="{{ 'Search' | translate}}"> placeholder="{{ 'Search' | translate}}" ng-disable="isSelectMode"
ng-change="filter.save()">
</span> </span>
</span> </span>
@ -224,7 +225,9 @@
<!-- title and phase --> <!-- title and phase -->
<div> <div>
<strong> <strong>
<a ui-sref="assignments.assignment.detail({id: assignment.id})">{{ assignment.title }}</a> <a ui-sref="assignments.assignment.detail({id: assignment.id})">
{{ assignment.title }}
</a>
</strong> </strong>
<span style="padding: 5px;" ng-mouseover="assignment.phaseHover=true" ng-mouseleave="assignment.phaseHover=false"> <span style="padding: 5px;" ng-mouseover="assignment.phaseHover=true" ng-mouseleave="assignment.phaseHover=false">
<span class="label" ng-class="{'label-primary': assignment.phase == 0, <span class="label" ng-class="{'label-primary': assignment.phase == 0,

View File

@ -978,7 +978,7 @@ img {
.os-table .title { .os-table .title {
font-size: 115%; font-size: 115%;
margin-right: 5px; margin-right: 3px;
padding: 0; padding: 0;
background-color: transparent; background-color: transparent;
} }
@ -1370,6 +1370,21 @@ img {
animation: fade-out 0.25s linear; animation: fade-out 0.25s linear;
} }
/* xeditable */
.editable-click {
border: none;
cursor: pointer;
color: #555;
}
.editable-click:hover {
color: #555;
}
.popover-wrapper .editable-hide {
display: inline !important;
}
@keyframes fade-out { @keyframes fade-out {
0% { opacity: 1; background: none; } 0% { opacity: 1; background: none; }
100% { opacity: 0; background: none; } 100% { opacity: 0; background: none; }

View File

@ -13,12 +13,14 @@ angular.module('OpenSlidesApp.core.site', [
'formlyBootstrap', 'formlyBootstrap',
'localytics.directives', 'localytics.directives',
'ngBootbox', 'ngBootbox',
'ngCookies',
'ngDialog', 'ngDialog',
'ngFileSaver', 'ngFileSaver',
'ngMessages', 'ngMessages',
'ngCsvImport', 'ngCsvImport',
'ui.tinymce', 'ui.tinymce',
'luegg.directives', 'luegg.directives',
'xeditable',
]) ])
// Can be used to find out if the projector or the side is used // Can be used to find out if the projector or the side is used
@ -102,11 +104,25 @@ angular.module('OpenSlidesApp.core.site', [
.run([ .run([
'loadGlobalData', 'loadGlobalData',
'operator', 'operator',
function(loadGlobalData, operator) { function (loadGlobalData, operator) {
operator.onOperatorChange(loadGlobalData); operator.onOperatorChange(loadGlobalData);
} }
]) ])
.run([
'editableOptions',
'gettext',
function (editableOptions, gettext) {
editableOptions.theme = 'bs3';
editableOptions.cancelButtonAriaLabel = gettext('Cancel');
editableOptions.cancelButtonTitle = gettext('Cancel');
editableOptions.clearButtonAriaLabel = gettext('Clear');
editableOptions.clearButtonTitle = gettext('Clear');
editableOptions.submitButtonAriaLabel = gettext('Submit');
editableOptions.submitButtonTitle = gettext('Submit');
}
])
.config([ .config([
'mainMenuProvider', 'mainMenuProvider',
'gettext', 'gettext',
@ -355,13 +371,26 @@ angular.module('OpenSlidesApp.core.site', [
* - propertyList, propertyFunctionList, propertyDict: See function getObjectQueryString * - propertyList, propertyFunctionList, propertyDict: See function getObjectQueryString
*/ */
.factory('osTableFilter', [ .factory('osTableFilter', [
function () { '$cookies',
var createInstance = function () { function ($cookies) {
var createInstance = function (cookieName) {
var self = { var self = {
multiselectFilters: {}, multiselectFilters: {},
booleanFilters: {}, booleanFilters: {},
filterString: '', filterString: '',
}; };
var existsCookie = function () {
return $cookies.getObject(cookieName);
};
var cookie = existsCookie();
if (cookie) {
self = cookie;
}
self.existsCookie = existsCookie;
self.save = function () {
$cookies.putObject(cookieName, self);
};
self.areFiltersSet = function () { self.areFiltersSet = function () {
var areFiltersSet = _.find(self.multiselectFilters, function (filterList) { var areFiltersSet = _.find(self.multiselectFilters, function (filterList) {
return filterList.length > 0; return filterList.length > 0;
@ -380,6 +409,7 @@ angular.module('OpenSlidesApp.core.site', [
self.booleanFilters[filter].value = undefined; self.booleanFilters[filter].value = undefined;
}); });
self.filterString = ''; self.filterString = '';
self.save();
}; };
self.operateMultiselectFilter = function (filter, id, danger) { self.operateMultiselectFilter = function (filter, id, danger) {
if (!danger) { if (!danger) {
@ -390,6 +420,7 @@ angular.module('OpenSlidesApp.core.site', [
// add id // add id
self.multiselectFilters[filter].push(id); self.multiselectFilters[filter].push(id);
} }
self.save();
} }
}; };
/* Three things are could be given to create the query string: /* Three things are could be given to create the query string:

View File

@ -99,22 +99,25 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
updatePresentedMediafiles(); updatePresentedMediafiles();
// Filtering // Filtering
$scope.filter = osTableFilter.createInstance(); $scope.filter = osTableFilter.createInstance('MediafilesTableFilter');
$scope.filter.booleanFilters = {
isPrivate: { if (!$scope.filter.existsCookie()) {
value: undefined, $scope.filter.booleanFilters = {
displayName: gettext('Private'), isPrivate: {
choiceYes: gettext('Is private'), value: undefined,
choiceNo: gettext('Is not private'), displayName: gettext('Private'),
needExtraPermission: true, choiceYes: gettext('Is private'),
}, choiceNo: gettext('Is not private'),
isPdf: { needExtraPermission: true,
value: undefined, },
displayName: gettext('Is PDF'), isPdf: {
choiceYes: gettext('Is PDF file'), value: undefined,
choiceNo: gettext('Is no PDF file'), displayName: gettext('Is PDF'),
}, choiceYes: gettext('Is PDF file'),
}; choiceNo: gettext('Is no PDF file'),
},
};
}
$scope.filter.propertyList = ['title_or_filename']; $scope.filter.propertyList = ['title_or_filename'];
$scope.filter.propertyFunctionList = [ $scope.filter.propertyFunctionList = [
function (mediafile) {return mediafile.uploader.get_short_name();}, function (mediafile) {return mediafile.uploader.get_short_name();},

View File

@ -170,13 +170,13 @@
</span> </span>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdown{{ name }}"> <ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdown{{ name }}">
<li> <li>
<a href ng-click="booleanFilter.value = (booleanFilter.value ? undefined : true)"> <a href ng-click="booleanFilter.value = (booleanFilter.value ? undefined : true); filter.save();">
<i class="fa" ng-class="{'fa-check': booleanFilter.value === true}"></i> <i class="fa" ng-class="{'fa-check': booleanFilter.value === true}"></i>
{{ booleanFilter.choiceYes }} {{ booleanFilter.choiceYes }}
</a> </a>
</li> </li>
<li> <li>
<a href ng-click="booleanFilter.value = (booleanFilter.value === false) ? undefined : false"> <a href ng-click="booleanFilter.value = (booleanFilter.value === false) ? undefined : false; filter.save();">
<i class="fa" ng-class="{'fa-check': booleanFilter.value === false}"></i> <i class="fa" ng-class="{'fa-check': booleanFilter.value === false}"></i>
{{ booleanFilter.choiceNo }} {{ booleanFilter.choiceNo }}
</a> </a>
@ -209,7 +209,8 @@
<span class="input-group"> <span class="input-group">
<span class="input-group-addon"><i class="fa fa-search"></i></span> <span class="input-group-addon"><i class="fa fa-search"></i></span>
<input type="text" ng-model="filter.filterString" class="form-control" <input type="text" ng-model="filter.filterString" class="form-control"
placeholder="{{ 'Search' | translate}}" ng-disabled="isSelectMode"> placeholder="{{ 'Search' | translate}}" ng-disabled="isSelectMode"
ng-change="filter.save()">
</span> </span>
</span> </span>
</span> </span>
@ -219,7 +220,7 @@
<span ng-repeat="(name, booleanFilter) in filter.booleanFilters" <span ng-repeat="(name, booleanFilter) in filter.booleanFilters"
ng-hide="booleanFilter.value === undefined" ng-hide="booleanFilter.value === undefined"
class="pointer spacer-left-lg" class="pointer spacer-left-lg"
ng-click="booleanFilter.value = undefined;" ng-click="booleanFilter.value = undefined; filter.save();"
ng-class="{'disabled': isSelectMode}"> ng-class="{'disabled': isSelectMode}">
<span class="nobr"> <span class="nobr">
<i class="fa fa-times-circle"></i> <i class="fa fa-times-circle"></i>

View File

@ -822,13 +822,16 @@ angular.module('OpenSlidesApp.motions.site', [
$scope.alert = {}; $scope.alert = {};
// Filtering // Filtering
$scope.filter = osTableFilter.createInstance(); $scope.filter = osTableFilter.createInstance('MotionTableFilter');
$scope.filter.multiselectFilters = {
state: [], if (!$scope.filter.existsCookie()) {
category: [], $scope.filter.multiselectFilters = {
motionBlock: [], state: [],
tag: [] category: [],
}; motionBlock: [],
tag: []
};
}
$scope.filter.propertyList = ['identifier', 'origin']; $scope.filter.propertyList = ['identifier', 'origin'];
$scope.filter.propertyFunctionList = [ $scope.filter.propertyFunctionList = [
function (motion) {return motion.getTitle();}, function (motion) {return motion.getTitle();},
@ -907,7 +910,7 @@ angular.module('OpenSlidesApp.motions.site', [
// Use this methon instead of Motion.save(), because otherwise // Use this methon instead of Motion.save(), because otherwise
// you have to provide always a title and a text // you have to provide always a title and a text
var save = function (motion) { $scope.save = function (motion) {
motion.title = motion.getTitle(-1); motion.title = motion.getTitle(-1);
motion.text = motion.getText(-1); motion.text = motion.getText(-1);
motion.reason = motion.getReason(-1); motion.reason = motion.getReason(-1);
@ -922,7 +925,7 @@ angular.module('OpenSlidesApp.motions.site', [
} else { } else {
motion.tags_id.push(tag.id); motion.tags_id.push(tag.id);
} }
save(motion); $scope.save(motion);
}; };
$scope.toggleCategory = function (motion, category) { $scope.toggleCategory = function (motion, category) {
if (motion.category_id == category.id) { if (motion.category_id == category.id) {
@ -930,7 +933,7 @@ angular.module('OpenSlidesApp.motions.site', [
} else { } else {
motion.category_id = category.id; motion.category_id = category.id;
} }
save(motion); $scope.save(motion);
}; };
$scope.toggleMotionBlock = function (motion, block) { $scope.toggleMotionBlock = function (motion, block) {
if (motion.motion_block_id == block.id) { if (motion.motion_block_id == block.id) {
@ -938,7 +941,7 @@ angular.module('OpenSlidesApp.motions.site', [
} else { } else {
motion.motion_block_id = block.id; motion.motion_block_id = block.id;
} }
save(motion); $scope.save(motion);
}; };
// open new/edit dialog // open new/edit dialog

View File

@ -241,7 +241,8 @@
<span class="input-group"> <span class="input-group">
<span class="input-group-addon"><i class="fa fa-search"></i></span> <span class="input-group-addon"><i class="fa fa-search"></i></span>
<input type="text" ng-model="filter.filterString" class="form-control" <input type="text" ng-model="filter.filterString" class="form-control"
placeholder="{{ 'Search' | translate}}" ng-disabled="isSelectMode"> placeholder="{{ 'Search' | translate}}" ng-disabled="isSelectMode"
ng-change="filter.save()">
</span> </span>
</span> </span>
</span> </span>
@ -506,7 +507,11 @@
<!-- Origin --> <!-- Origin -->
<div ng-if="motion.origin"> <div ng-if="motion.origin">
<i class="fa fa-share spacer-right" uib-tooltip="{{ 'Origin' | translate }}"></i> <i class="fa fa-share spacer-right" uib-tooltip="{{ 'Origin' | translate }}"></i>
{{ motion.origin | limitTo:25 }}{{ motion.origin.length > 25 ? '...' : '' }} <div class="popover-wrapper">
<span editable-text="motion.origin" onaftersave="save(motion)">
{{ motion.origin | limitTo:25 }}{{ motion.origin.length > 25 ? '...' : '' }}
</span>
</div>
</div> </div>
</small> </small>
</div> </div>

View File

@ -510,39 +510,42 @@ angular.module('OpenSlidesApp.users.site', [
$scope.alert = {}; $scope.alert = {};
// Filtering // Filtering
$scope.filter = osTableFilter.createInstance(); $scope.filter = osTableFilter.createInstance('UserTableFilter');
$scope.filter.multiselectFilters = {
group: [], if (!$scope.filter.existsCookie()) {
}; $scope.filter.multiselectFilters = {
group: [],
};
$scope.filter.booleanFilters = {
isPresent: {
value: undefined,
displayName: gettext('Present'),
choiceYes: gettext('Is present'),
choiceNo: gettext('Is not present'),
needExtraPermission: true,
},
isActive: {
value: undefined,
displayName: gettext('Active'),
choiceYes: gettext('Is active'),
choiceNo: gettext('Is not active'),
needExtraPermission: true,
},
isCommittee: {
value: undefined,
displayName: gettext('Committee'),
choiceYes: gettext('Is committee'),
choiceNo: gettext('Is not committee'),
},
};
}
$scope.filter.propertyList = ['first_name', 'last_name', 'title', 'number', 'comment', 'structure_level']; $scope.filter.propertyList = ['first_name', 'last_name', 'title', 'number', 'comment', 'structure_level'];
$scope.filter.propertyDict = { $scope.filter.propertyDict = {
'groups_id' : function (group_id) { 'groups_id' : function (group_id) {
return Group.get(group_id).name; return Group.get(group_id).name;
}, },
}; };
$scope.filter.booleanFilters = {
isPresent: {
value: undefined,
displayName: gettext('Present'),
choiceYes: gettext('Is present'),
choiceNo: gettext('Is not present'),
needExtraPermission: true,
},
isActive: {
value: undefined,
displayName: gettext('Active'),
choiceYes: gettext('Is active'),
choiceNo: gettext('Is not active'),
needExtraPermission: true,
},
isCommittee: {
value: undefined,
displayName: gettext('Committee'),
choiceYes: gettext('Is committee'),
choiceNo: gettext('Is not committee'),
},
};
$scope.getItemId = { $scope.getItemId = {
group: function (user) {return user.groups_id;}, group: function (user) {return user.groups_id;},
}; };

View File

@ -181,13 +181,13 @@
</span> </span>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdown{{ name }}"> <ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdown{{ name }}">
<li> <li>
<a href ng-click="booleanFilter.value = (booleanFilter.value ? undefined : true)"> <a href ng-click="booleanFilter.value = (booleanFilter.value ? undefined : true); filter.save();">
<i class="fa" ng-class="{'fa-check': booleanFilter.value === true}"></i> <i class="fa" ng-class="{'fa-check': booleanFilter.value === true}"></i>
{{ booleanFilter.choiceYes }} {{ booleanFilter.choiceYes }}
</a> </a>
</li> </li>
<li> <li>
<a href ng-click="booleanFilter.value = (booleanFilter.value === false) ? undefined : false"> <a href ng-click="booleanFilter.value = (booleanFilter.value === false) ? undefined : false; filter.save();">
<i class="fa" ng-class="{'fa-check': booleanFilter.value === false}"></i> <i class="fa" ng-class="{'fa-check': booleanFilter.value === false}"></i>
{{ booleanFilter.choiceNo }} {{ booleanFilter.choiceNo }}
</a> </a>
@ -220,7 +220,8 @@
<span class="input-group"> <span class="input-group">
<span class="input-group-addon"><i class="fa fa-search"></i></span> <span class="input-group-addon"><i class="fa fa-search"></i></span>
<input type="text" ng-model="filter.filterString" class="form-control" ng-model-options="{debounce: 500}" <input type="text" ng-model="filter.filterString" class="form-control" ng-model-options="{debounce: 500}"
placeholder="{{ 'Search' | translate}}" ng-disabled="isSelectMode"> placeholder="{{ 'Search' | translate}}" ng-disabled="isSelectMode"
ng-change="filter.save()">
</span> </span>
</span> </span>
</span> </span>
@ -245,7 +246,7 @@
<span ng-repeat="(name, booleanFilter) in filter.booleanFilters" <span ng-repeat="(name, booleanFilter) in filter.booleanFilters"
ng-hide="booleanFilter.value === undefined" ng-hide="booleanFilter.value === undefined"
class="pointer spacer-left-lg" class="pointer spacer-left-lg"
ng-click="booleanFilter.value = undefined;" ng-click="booleanFilter.value = undefined; filter.save();"
ng-class="{'disabled': isSelectMode}"> ng-class="{'disabled': isSelectMode}">
<span class="nobr"> <span class="nobr">
<i class="fa fa-times-circle"></i> <i class="fa fa-times-circle"></i>
@ -289,7 +290,14 @@
<a ui-sref="users.user.detail({id: user.id})" class="title">{{ user.get_short_name() }}</a> <a ui-sref="users.user.detail({id: user.id})" class="title">{{ user.get_short_name() }}</a>
</strong> </strong>
</div> </div>
<div ng-if="user.number"><translate>No.</translate> {{ user.number }} </div> <div os-perms="users.can_manage"> <!-- user number -->
<div ng-if="user.number" editable-text="user.number" onaftersave="save(user)">
<translate>No.</translate> {{ user.number }}
</div>
</div>
<div os-perms="!users.can_manage" ng-if="user.number">
<translate>No.</translate> {{ user.number }}
</div>
<div os-perms="users.can_manage" ng-class="{'hiddenDiv': !user.hover}"> <div os-perms="users.can_manage" ng-class="{'hiddenDiv': !user.hover}">
<small> <small>
<a href="" ng-click="openDialog(user)" translate>Edit</a> &middot; <a href="" ng-click="openDialog(user)" translate>Edit</a> &middot;
@ -345,19 +353,41 @@
... [+{{ user.groups_id.length - 2}}]</span> ... [+{{ user.groups_id.length - 2}}]</span>
<!-- sorry for merging them together, but otherwise there would be a whitespace because of the new line --> <!-- sorry for merging them together, but otherwise there would be a whitespace because of the new line -->
</div> </div>
<div ng-if="user.structure_level" uib-tooltip="{{ 'Structure level' | translate }}" tooltip-placement="top-left">
<i class="fa fa-flag"></i> <div os-perms="users.can_manage" ng-show="user.structure_level || user.hover">
{{ user.structure_level }} <div class="popover-wrapper" uib-tooltip="{{ 'Structure level' | translate }}" tooltip-placement="top-left">
<i class="fa fa-flag"></i>
<span editable-text="user.structure_level" onaftersave="save(user)">
{{ user.structure_level || ('Set structure level...' | translate)}}
</span>
</div>
</div> </div>
<div ng-if="user.comment" uib-tooltip="{{ 'Comment' | translate }}" tooltip-placement="top-left"> <div os-perms="!users.can_manage">
<i class="fa fa-info-circle"></i> <div ng-if="user.structure_level" uib-tooltip="{{ 'Structure level' | translate }}" tooltip-placement="top-left">
{{ user.comment | limitTo:25}}{{ user.comment.length > 25 ? '...' : '' }} <i class="fa fa-flag"></i>
{{ user.structure_level }}
</div>
</div>
<div os-perms="users.can_manage" ng-show="user.comment || user.hover">
<div class="popover-wrapper" uib-tooltip="{{ 'Comment' | translate }}" tooltip-placement="top-left">
<i class="fa fa-info-circle"></i>
<span editable-text="user.comment" onaftersave="save(user)">
{{ user.comment || ('Set comment...' | translate)}}
</span>
</div>
</div>
<div os-perms="!users.can_manage">
<div ng-if="user.comment" uib-tooltip="{{ 'Comment' | translate }}" tooltip-placement="top-left">
<i class="fa fa-info-circle"></i>
{{ user.comment | limitTo:25}}{{ user.comment.length > 25 ? '...' : '' }}
</div>
</div> </div>
</small> </small>
</div> </div>
<div style="width: 40%;" class="pull-right" os-perms="users.can_see_extra_data"> <div style="width: 40%;" class="pull-right" os-perms="users.can_see_extra_data">
<div os-perms="users.can_manage"> <div os-perms="users.can_manage">
<span class="pointer nobr" ng-click="user.is_present = !user.is_present; save(user);"> <span class="pointer nobr" ng-click="user.is_present = !user.is_present; save(user);" ng-show="user.hover || user.is_present">
<i class="fa" ng-class="user.is_present ? 'fa-check-square-o' : 'fa-square-o'"></i> <i class="fa" ng-class="user.is_present ? 'fa-check-square-o' : 'fa-square-o'"></i>
<span class="spacer-left" translate>Present</span> <span class="spacer-left" translate>Present</span>
</span> </span>