From 42a5da93ea14186b50c8612a8ef2d86e0079c0e8 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 3 Dec 2025 12:19:20 +0200 Subject: [PATCH] links tab done (finally) --- .../settings_modal/admin_tabs/links_tab.js | 58 ++++++++++- .../settings_modal/admin_tabs/links_tab.scss | 32 ++++++ .../settings_modal/admin_tabs/links_tab.vue | 98 ++++++++++++++++++- .../settings_modal/helpers/choice_setting.js | 5 +- .../settings_modal/helpers/draft_buttons.vue | 7 +- .../settings_modal/helpers/number_setting.vue | 4 +- .../settings_modal/helpers/setting.js | 7 ++ .../settings_modal/helpers/string_setting.vue | 3 +- .../settings_modal/settings_modal.scss | 11 ++- src/i18n/en.json | 21 +++- 10 files changed, 234 insertions(+), 12 deletions(-) create mode 100644 src/components/settings_modal/admin_tabs/links_tab.scss diff --git a/src/components/settings_modal/admin_tabs/links_tab.js b/src/components/settings_modal/admin_tabs/links_tab.js index 1bf626643..da70889ac 100644 --- a/src/components/settings_modal/admin_tabs/links_tab.js +++ b/src/components/settings_modal/admin_tabs/links_tab.js @@ -6,6 +6,8 @@ import GroupSetting from '../helpers/group_setting.vue' import AttachmentSetting from '../helpers/attachment_setting.vue' import ListSetting from '../helpers/list_setting.vue' +import Checkbox from 'src/components/checkbox/checkbox.vue' + import SharedComputedObject from '../helpers/shared_computed_object.js' import { get } from 'lodash' @@ -23,9 +25,22 @@ const MediaProxyTab = { StringSetting, AttachmentSetting, GroupSetting, - ListSetting + ListSetting, + Checkbox }, computed: { + classIsPresent () { + return this.$store.state.adminSettings.draft[':pleroma']['Pleroma.Formatter'][':class'] !== false + }, + relIsPresent () { + return this.$store.state.adminSettings.draft[':pleroma']['Pleroma.Formatter'][':rel'] !== false + }, + truncateIsPresent () { + return this.$store.state.adminSettings.draft[':pleroma']['Pleroma.Formatter'][':truncate'] !== false + }, + truncateDescription () { + return get(this.$store.state.adminSettings.descriptions, [':pleroma', 'Pleroma.Formatter', ':truncate']) + }, ttlSettersOptions () { const desc = get(this.$store.state.adminSettings.descriptions, ':pleroma.:rich_media.:ttl_setters') return new Set(desc.suggestions.map(option => ({ @@ -40,6 +55,18 @@ const MediaProxyTab = { value: option }))) }, + validateTLDOptions () { + return [{ + label: this.$t('general.yes'), + value: true + }, { + label: this.$t('general.no'), + value: false + }, { + label: this.$t('admin_dash.links.no_scheme'), + value: ':no_scheme' + }] + }, mediaProxyEnabled () { return this.$store.state.adminSettings.draft[':pleroma'][':media_proxy'][':enabled'] }, @@ -47,6 +74,35 @@ const MediaProxyTab = { return this.$store.state.adminSettings.draft[':pleroma'][':media_proxy'][':invalidation'][':provider'] }, ...SharedComputedObject() + }, + methods: { + checkRel (e) { + this.$store.commit( + 'updateAdminDraft', + { + path: [':pleroma','Pleroma.Formatter',':rel'], + value: e ? '' : false + } + ) + }, + checkClass (e) { + this.$store.commit( + 'updateAdminDraft', + { + path: [':pleroma','Pleroma.Formatter',':class'], + value: e ? '' : false + } + ) + }, + checkTruncate (e) { + this.$store.commit( + 'updateAdminDraft', + { + path: [':pleroma','Pleroma.Formatter',':truncate'], + value: e ? 20 : false + } + ) + } } } diff --git a/src/components/settings_modal/admin_tabs/links_tab.scss b/src/components/settings_modal/admin_tabs/links_tab.scss new file mode 100644 index 000000000..eb56cd9f5 --- /dev/null +++ b/src/components/settings_modal/admin_tabs/links_tab.scss @@ -0,0 +1,32 @@ +.LinksTab { + // awkward "disable = false" backend options + .weird-options { + .checkbox { + margin: 0; + } + } + + .setting-list.suboptions.weird-suboptions { + display: flex; + flex-direction: column; + gap: 0.5em; + margin: 0; + + li { + margin: 0; + display: flex; + } + + .GroupSetting { + display: inline-block; + margin: 0; + padding: 0; + } + } + + .btn-group { + .button-default { + flex: 0 1 auto; + } + } +} diff --git a/src/components/settings_modal/admin_tabs/links_tab.vue b/src/components/settings_modal/admin_tabs/links_tab.vue index c4677ee63..5e4598c08 100644 --- a/src/components/settings_modal/admin_tabs/links_tab.vue +++ b/src/components/settings_modal/admin_tabs/links_tab.vue @@ -1,5 +1,8 @@ + + diff --git a/src/components/settings_modal/helpers/choice_setting.js b/src/components/settings_modal/helpers/choice_setting.js index c36b870a6..ed54e67be 100644 --- a/src/components/settings_modal/helpers/choice_setting.js +++ b/src/components/settings_modal/helpers/choice_setting.js @@ -23,7 +23,10 @@ export default { ...Setting.computed, realOptions () { if (this.realSource === 'admin') { - if (!(this.backendDescriptionSuggestions?.length !== 0)) { + if ( + !this.backendDescriptionSuggestions?.length || + this.backendDescriptionSuggestions?.length === 0 + ) { return this.options } return this.backendDescriptionSuggestions.map(x => ({ diff --git a/src/components/settings_modal/helpers/draft_buttons.vue b/src/components/settings_modal/helpers/draft_buttons.vue index 46a70e866..2cb4594db 100644 --- a/src/components/settings_modal/helpers/draft_buttons.vue +++ b/src/components/settings_modal/helpers/draft_buttons.vue @@ -3,6 +3,7 @@