Skip to content

Commit

Permalink
Port admin delegation selects
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Ng <chrng8@gmail.com>
  • Loading branch information
Pytal committed Mar 1, 2023
1 parent 7c477d4 commit db5d5c1
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 17 deletions.
4 changes: 3 additions & 1 deletion apps/settings/lib/Settings/Admin/Delegation.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ private function initSettingState(): void {
$settings = array_merge(
$settings,
array_map(function (IDelegatedSettings $setting) use ($section) {
$sectionName = $section->getName() . ($setting->getName() !== null ? ' - ' . $setting->getName() : '');
return [
'class' => get_class($setting),
'sectionName' => $section->getName() . ($setting->getName() !== null ? ' - ' . $setting->getName() : ''),
'sectionName' => $sectionName,
'id' => mb_strtolower(str_replace(' ', '-', $sectionName)),
'priority' => $section->getPriority(),
];
}, $sectionSettings)
Expand Down
11 changes: 10 additions & 1 deletion apps/settings/src/components/AdminDelegating.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
:doc-url="authorizedSettingsDocLink">
<div class="setting-list">
<div v-for="setting in availableSettings" :key="setting.class">
<h3>{{ setting.sectionName }}</h3>
<label :for="setting.id">{{ setting.sectionName }}</label>
<GroupSelect :available-groups="availableGroups" :authorized-groups="authorizedGroups" :setting="setting" />
</div>
</div>
Expand Down Expand Up @@ -32,3 +32,12 @@ export default {
},
}
</script>

<style lang="scss" scoped>
label {
display: block;
font-size: 16px;
margin: 12px 0;
color: var(--color-text-light);
}
</style>
16 changes: 7 additions & 9 deletions apps/settings/src/components/AdminDelegation/GroupSelect.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<template>
<NcMultiselect v-model="selected"
class="group-multiselect"
<NcSelect :input-id="setting.id"
v-model="selected"
class="group-select"
:placeholder="t('settings', 'None')"
track-by="gid"
label="displayName"
:options="availableGroups"
open-direction="bottom"
:multiple="true"
:allow-empty="true" />
:close-on-select="false" />
</template>

<script>
import NcMultiselect from '@nextcloud/vue/dist/Components/NcMultiselect'
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
import { generateUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios'
import { showError } from '@nextcloud/dialogs'
Expand All @@ -20,7 +19,7 @@ import logger from '../../logger'
export default {
name: 'GroupSelect',
components: {
NcMultiselect,
NcSelect,
},
props: {
availableGroups: {
Expand Down Expand Up @@ -67,8 +66,7 @@ export default {
</script>

<style lang="scss">
.group-multiselect {
.group-select {
width: 100%;
margin-right: 0;
}
</style>
4 changes: 2 additions & 2 deletions dist/core-common.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-common.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/settings-vue-settings-admin-delegation.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/settings-vue-settings-admin-delegation.js.map

Large diffs are not rendered by default.

0 comments on commit db5d5c1

Please sign in to comment.