Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'js/admin.js')
-rw-r--r--js/admin.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/js/admin.js b/js/admin.js
index 884e2512..8561b880 100644
--- a/js/admin.js
+++ b/js/admin.js
@@ -15,6 +15,17 @@ var documentsSettings = {
);
},
+ saveGroups: function(groups) {
+ var data = {
+ 'edit_groups': groups
+ };
+
+ $.post(
+ OC.filePath('richdocuments', 'ajax', 'admin.php'),
+ data
+ );
+ },
+
saveDocFormat: function(format) {
$.post(
OC.filePath('richdocuments', 'ajax', 'admin.php'),
@@ -27,7 +38,19 @@ var documentsSettings = {
OC.msg.finishedAction('#documents-admin-msg', response);
},
+ initEditGroups: function() {
+ var groups = $('#edit_group_select').val();
+ if (groups !== '') {
+ OC.Settings.setupGroupsSelect($('#edit_group_select'));
+ $('.edit-groups-enable').attr('checked', 'checked');
+ } else {
+ $('.edit-groups-enable').attr('checked', null);
+ }
+ },
+
initialize: function() {
+ documentsSettings.initEditGroups();
+
$('#wopi_apply').on('click', documentsSettings.save);
$(document).on('change', '.doc-format-ooxml', function() {
@@ -35,6 +58,27 @@ var documentsSettings = {
documentsSettings.saveDocFormat(ooxml ? 'ooxml' : 'odf');
});
+ $(document).on('change', '#edit_group_select', function() {
+ var element = $(this).parent().find('input.edit-groups-enable');
+ var groups = $(this).val();
+ documentsSettings.saveGroups(groups);
+ });
+
+ $(document).on('change', '.edit-groups-enable', function() {
+ var $select = $(this).parent().find('#edit_group_select');
+ $select.val('');
+
+ if (this.checked) {
+ OC.Settings.setupGroupsSelect($select, {
+ placeholder: t('core', 'All')
+ });
+ } else {
+ $select.select2('destroy');
+ }
+
+ $select.change();
+ });
+
}
};