Fix group restriction regression

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
Morris Jobke 2017-05-19 12:05:09 -05:00
parent 7eb8b3cec1
commit c7ade85982
2 changed files with 9 additions and 9 deletions

View File

@ -259,10 +259,10 @@ OC.Settings.Apps = OC.Settings.Apps || {
page.find(".groups-enable").hide(); page.find(".groups-enable").hide();
page.find(".groups-enable__checkbox").prop('checked', false); page.find(".groups-enable__checkbox").prop('checked', false);
} else { } else {
page.find('#group_select').val((app.groups || []).join('|')); page.find('.group_select').val((app.groups || []).join('|'));
if (app.active) { if (app.active) {
if (app.groups.length) { if (app.groups.length) {
OC.Settings.Apps.setupGroupsSelect(page.find('#group_select')); OC.Settings.Apps.setupGroupsSelect(page.find('.group_select'));
page.find(".groups-enable__checkbox").prop('checked', true); page.find(".groups-enable__checkbox").prop('checked', true);
} else { } else {
page.find(".groups-enable__checkbox").prop('checked', false); page.find(".groups-enable__checkbox").prop('checked', false);
@ -390,7 +390,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
elements.forEach(function(element) { elements.forEach(function(element) {
element.val(t('settings', 'Enable')); element.val(t('settings', 'Enable'));
element.parent().find(".groups-enable").hide(); element.parent().find(".groups-enable").hide();
element.parent().find('#group_select').hide().val(null); element.parent().find('.group_select').hide().val(null);
}); });
OC.Settings.Apps.State.apps[appId].active = false; OC.Settings.Apps.State.apps[appId].active = false;
} }
@ -458,7 +458,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
elements.forEach(function(element) { elements.forEach(function(element) {
element.parent().find(".groups-enable").prop('checked', true); element.parent().find(".groups-enable").prop('checked', true);
element.parent().find(".groups-enable").hide(); element.parent().find(".groups-enable").hide();
element.parent().find('#group_select').hide().val(null); element.parent().find('.group_select').hide().val(null);
}); });
} else { } else {
elements.forEach(function(element) { elements.forEach(function(element) {
@ -905,8 +905,8 @@ OC.Settings.Apps = OC.Settings.Apps || {
OC.Settings.Apps.updateApp(appId, element); OC.Settings.Apps.updateApp(appId, element);
}); });
$(document).on('change', '#group_select', function() { $(document).on('change', '.group_select', function() {
var element = $(this).parent().find('input.enable'); var element = $(this).closest('.section').find('input.enable');
var groups = $(this).val(); var groups = $(this).val();
if (groups && groups !== '') { if (groups && groups !== '') {
groups = groups.split('|'); groups = groups.split('|');
@ -922,7 +922,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
}); });
$(document).on('change', ".groups-enable__checkbox", function() { $(document).on('change', ".groups-enable__checkbox", function() {
var $select = $(this).closest('.section').find('#group_select'); var $select = $(this).closest('.section').find('.group_select');
$select.val(''); $select.val('');
if (this.checked) { if (this.checked) {

View File

@ -59,7 +59,7 @@ script(
<div class="groups-enable"> <div class="groups-enable">
<input type="checkbox" class="groups-enable__checkbox checkbox" id="groups_enable-{{id}}"/> <input type="checkbox" class="groups-enable__checkbox checkbox" id="groups_enable-{{id}}"/>
<label for="groups_enable-{{id}}"><?php p($l->t('Limit to groups')); ?></label> <label for="groups_enable-{{id}}"><?php p($l->t('Limit to groups')); ?></label>
<input type="hidden" id="group_select" title="<?php p($l->t('All')); ?>"> <input type="hidden" class="group_select" title="<?php p($l->t('All')); ?>">
</div> </div>
{{/if}} {{/if}}
</div> </div>
@ -182,7 +182,7 @@ script(
<input type="checkbox" class="groups-enable__checkbox checkbox" id="groups_enable-{{id}}"/> <input type="checkbox" class="groups-enable__checkbox checkbox" id="groups_enable-{{id}}"/>
<label for="groups_enable-{{id}}"><?php p($l->t('Enable only for specific groups')); ?></label> <label for="groups_enable-{{id}}"><?php p($l->t('Enable only for specific groups')); ?></label>
</div> </div>
<input type="hidden" id="group_select" title="<?php p($l->t('All')); ?>" style="width: 200px"> <input type="hidden" class="group_select" title="<?php p($l->t('All')); ?>" style="width: 200px">
{{else}} {{else}}
<input class="enable{{#if needsDownload}} needs-download{{/if}}" type="submit" data-appid="{{id}}" data-active="false" {{#unless canInstall}}disabled="disabled"{{/unless}} value="<?php p($l->t("Enable"));?>"/> <input class="enable{{#if needsDownload}} needs-download{{/if}}" type="submit" data-appid="{{id}}" data-active="false" {{#unless canInstall}}disabled="disabled"{{/unless}} value="<?php p($l->t("Enable"));?>"/>
{{/if}} {{/if}}