Merge pull request #20201 from owncloud/checkboxes-groups-enable

Apply new checkbox style in app settings
This commit is contained in:
Thomas Müller 2015-11-03 11:19:45 +01:00
commit b0c456c0fc
2 changed files with 10 additions and 18 deletions

View File

@ -178,22 +178,19 @@ OC.Settings.Apps = OC.Settings.Apps || {
if(OC.Settings.Apps.isType(app, 'filesystem') || OC.Settings.Apps.isType(app, 'prelogin') || if(OC.Settings.Apps.isType(app, 'filesystem') || OC.Settings.Apps.isType(app, 'prelogin') ||
OC.Settings.Apps.isType(app, 'authentication') || OC.Settings.Apps.isType(app, 'logging')) { OC.Settings.Apps.isType(app, 'authentication') || OC.Settings.Apps.isType(app, 'logging')) {
page.find(".groups-enable").hide(); page.find(".groups-enable").hide();
page.find("label[for='groups_enable-"+app.id+"']").hide(); page.find(".groups-enable__checkbox").attr('checked', null);
page.find(".groups-enable").attr('checked', null);
} 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").attr('checked','checked'); page.find(".groups-enable__checkbox").attr('checked','checked');
} else { } else {
page.find(".groups-enable").attr('checked', null); page.find(".groups-enable__checkbox").attr('checked', null);
} }
page.find(".groups-enable").show(); page.find(".groups-enable").show();
page.find("label[for='groups_enable-"+app.id+"']").show();
} else { } else {
page.find(".groups-enable").hide(); page.find(".groups-enable").hide();
page.find("label[for='groups_enable-"+app.id+"']").hide();
} }
} }
}, },
@ -227,8 +224,6 @@ OC.Settings.Apps = OC.Settings.Apps || {
appItem.removeClass('active'); appItem.removeClass('active');
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("#groups_enable-"+appId).hide();
element.parent().find("label[for='groups_enable-"+appId+"']").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;
} }
@ -265,15 +260,10 @@ OC.Settings.Apps = OC.Settings.Apps || {
if (OC.Settings.Apps.isType(app, 'filesystem') || OC.Settings.Apps.isType(app, 'prelogin') || if (OC.Settings.Apps.isType(app, 'filesystem') || OC.Settings.Apps.isType(app, 'prelogin') ||
OC.Settings.Apps.isType(app, 'authentication') || OC.Settings.Apps.isType(app, 'logging')) { OC.Settings.Apps.isType(app, 'authentication') || OC.Settings.Apps.isType(app, 'logging')) {
element.parent().find(".groups-enable").attr('checked', null); element.parent().find(".groups-enable").attr('checked', null);
element.parent().find("#groups_enable-"+appId).hide();
element.parent().find("label[for='groups_enable-"+appId+"']").hide();
element.parent().find(".groups-enable").hide(); element.parent().find(".groups-enable").hide();
element.parent().find("#groups_enable-"+appId).hide();
element.parent().find("label[for='groups_enable-"+appId+"']").hide();
element.parent().find('#group_select').hide().val(null); element.parent().find('#group_select').hide().val(null);
} else { } else {
element.parent().find("#groups_enable-"+appId).show(); element.parent().find("#groups-enable").show();
element.parent().find("label[for='groups_enable-"+appId+"']").show();
if (groups) { if (groups) {
appItem.data('groups', JSON.stringify(groups)); appItem.data('groups', JSON.stringify(groups));
} else { } else {
@ -550,8 +540,8 @@ OC.Settings.Apps = OC.Settings.Apps || {
} }
}); });
$(document).on('change', ".groups-enable", function() { $(document).on('change', ".groups-enable__checkbox", function() {
var $select = $(this).parent().find('#group_select'); var $select = $(this).closest('.section').find('#group_select');
$select.val(''); $select.val('');
if (this.checked) { if (this.checked) {

View File

@ -111,8 +111,10 @@ script(
<input class="update hidden" type="submit" value="<?php p($l->t('Update to %s', array('{{update}}'))); ?>" data-appid="{{id}}" /> <input class="update hidden" type="submit" value="<?php p($l->t('Update to %s', array('{{update}}'))); ?>" data-appid="{{id}}" />
{{#if active}} {{#if active}}
<input class="enable" type="submit" data-appid="{{id}}" data-active="true" value="<?php p($l->t("Disable"));?>"/> <input class="enable" type="submit" data-appid="{{id}}" data-active="true" value="<?php p($l->t("Disable"));?>"/>
<input type="checkbox" class="groups-enable" id="groups_enable-{{id}}"/> <span class="groups-enable">
<label for="groups_enable-{{id}}"><?php p($l->t('Enable only for specific groups')); ?></label> <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>
</span>
<br /> <br />
<input type="hidden" id="group_select" title="<?php p($l->t('All')); ?>" style="width: 200px"> <input type="hidden" id="group_select" title="<?php p($l->t('All')); ?>" style="width: 200px">
{{else}} {{else}}