Implement search for Instance panel and Terms of Services

This commit is contained in:
Angelina Filippova 2020-09-20 02:07:59 +03:00
parent d0f73f4222
commit f3f7a155d7
5 changed files with 21 additions and 8 deletions

View file

@ -275,7 +275,7 @@ export const formSearchObject = description => {
return [...acc, resultObject]
}, [])
return description.reduce((acc, setting) => {
const processedDescription = description.reduce((acc, setting) => {
const searchArray = _.compact([setting.key, setting.label, setting.description]).map(el => el.toLowerCase())
const resultObject = { label: setting.label, key: setting.key || setting.group, groupKey: setting.key || setting.group, groupLabel: setting.label, search: searchArray }
if (setting.children) {
@ -284,4 +284,19 @@ export const formSearchObject = description => {
}
return !setting.key && setting.group === ':pleroma' ? acc : [...acc, resultObject]
}, [])
const searchDataForEditableDocs = [{
groupKey: ':instance_panel',
groupLabel: 'Instance Panel',
key: ':instance_panel',
label: 'Instance Panel',
search: ['Instance Panel', ':instance_panel']
}, {
groupKey: ':terms_of_services',
groupLabel: 'Terms of Services',
key: ':terms_of_services',
label: 'Terms of Services',
search: ['Terms of Services', ':terms_of_services']
}]
return processedDescription.concat(searchDataForEditableDocs)
}

View file

@ -3,9 +3,7 @@
<el-form :model="instanceData" :label-position="labelPosition" :label-width="labelWidth">
<setting :setting-group="instance" :data="instanceData"/>
</el-form>
<div>
<editor-input v-model="instancePanelContent" :name="'instance-panel'" @input="handleEditorUpdate"/>
</div>
<editor-input v-model="instancePanelContent" :name="'instance-panel'" @input="handleEditorUpdate"/>
<el-divider v-if="instance" class="divider thick-line"/>
<el-form :model="restrictUnauthenticatedData" :label-position="labelPosition" :label-width="labelWidth">
<setting :setting-group="restrictUnauthenticated" :data="restrictUnauthenticatedData"/>

View file

@ -1,6 +1,7 @@
<template>
<div v-if="!loading" :class="isSidebarOpen" class="form-container">
<editor-input v-model="termsOfServicesContent" :name="'terms-of-service'" @input="handleEditorUpdate"/>
<el-divider class="divider thick-line"/>
<el-form :model="mimeTypesData" :label-position="labelPosition" :label-width="labelWidth">
<setting :setting-group="mimeTypes" :data="mimeTypesData"/>
</el-form>

View file

@ -1,6 +1,6 @@
<template>
<el-form :label-position="labelPosition" :label-width="labelWidth">
<el-form-item class="editor-form-item">
<el-form-item :data-search="name === 'instance-panel' ? ':instance_panel' : ':terms_of_services'" class="editor-form-item">
<span slot="label">
{{ name === 'instance-panel' ? $t('settings.instancePanel') : $t('settings.termsOfServices') }}
<el-tooltip :content="$t('settings.removeFromDB')" placement="bottom-end">
@ -165,7 +165,6 @@ export default {
}
},
beforeDestroy() {
console.log(this.editor)
if (this.editor) {
this.editor.destroy()
}

View file

@ -30,7 +30,7 @@ export const tabs = description => {
},
'instance': {
label: 'settings.instance',
settings: [':admin_token', ':instance', ':instances_favicons', ':welcome', ':manifest', 'Pleroma.User', 'Pleroma.ScheduledActivity', ':uri_schemes', ':feed', ':streamer', ':restrict_unauthenticated']
settings: [':admin_token', ':instance', ':instance_panel', ':instances_favicons', ':welcome', ':manifest', 'Pleroma.User', 'Pleroma.ScheduledActivity', ':uri_schemes', ':feed', ':streamer', ':restrict_unauthenticated']
},
'job-queue': {
label: 'settings.jobQueue',
@ -78,7 +78,7 @@ export const tabs = description => {
},
'other': {
label: 'settings.other',
settings: [':mime', 'Pleroma.Web.Plugs.RemoteIp', ':modules', 'Pleroma.Web.ApiSpec.CastAndValidate']
settings: [':mime', 'Pleroma.Web.Plugs.RemoteIp', ':modules', 'Pleroma.Web.ApiSpec.CastAndValidate', ':terms_of_services']
}
}
}