From 6992439c92c247bf5b48155a76ff4e39a57b0ec7 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 22 Mar 2023 00:00:52 +0200 Subject: [PATCH] fixes for diabled state, tri-state boolean and access control --- .../admin_tabs/instance_tab.vue | 87 ++++++++++++++++++- .../settings_modal/helpers/boolean_setting.js | 15 ++++ .../helpers/boolean_setting.vue | 5 +- .../settings_modal/helpers/draft_buttons.vue | 2 +- .../settings_modal/helpers/number_setting.vue | 5 +- .../settings_modal/helpers/setting.js | 4 +- .../settings_modal/helpers/string_setting.vue | 5 +- 7 files changed, 115 insertions(+), 8 deletions(-) diff --git a/src/components/settings_modal/admin_tabs/instance_tab.vue b/src/components/settings_modal/admin_tabs/instance_tab.vue index 43ad4c8c..96d8a17e 100644 --- a/src/components/settings_modal/admin_tabs/instance_tab.vue +++ b/src/components/settings_modal/admin_tabs/instance_tab.vue @@ -33,11 +33,81 @@ BACKGROUND IMAGE + + +
+

{{ $t('admin_dash.instance.access') }}

+
@@ -52,13 +122,28 @@ INVITES ENABLED +
  • + + BDEY REQUIRED + +
      +
    • + + BDEY age of consent + +
    • +
    +
  • ACTIVATION REQUIRED diff --git a/src/components/settings_modal/helpers/boolean_setting.js b/src/components/settings_modal/helpers/boolean_setting.js index 0df01d31..199d3d0f 100644 --- a/src/components/settings_modal/helpers/boolean_setting.js +++ b/src/components/settings_modal/helpers/boolean_setting.js @@ -3,13 +3,28 @@ import Setting from './setting.js' export default { ...Setting, + props: { + ...Setting.props, + indeterminateState: [String, Object] + }, components: { ...Setting.components, Checkbox }, + computed: { + ...Setting.computed, + isIndeterminate () { + return this.visibleState === this.indeterminateState + } + }, methods: { ...Setting.methods, getValue (e) { + // Basic tri-state toggle implementation + if (!!this.indeterminateState && !e && this.visibleState === true) { + // If we have indeterminate state, switching from true to false first goes through indeterminate + return this.indeterminateState + } return e } } diff --git a/src/components/settings_modal/helpers/boolean_setting.vue b/src/components/settings_modal/helpers/boolean_setting.vue index 07971b00..6307d526 100644 --- a/src/components/settings_modal/helpers/boolean_setting.vue +++ b/src/components/settings_modal/helpers/boolean_setting.vue @@ -4,13 +4,15 @@ class="BooleanSetting" >