Add page layout translations
This commit is contained in:
@@ -134,7 +134,7 @@ export default {
|
||||
})
|
||||
|
||||
this.createPage(page).then(({ pageID, title, blocks }) => {
|
||||
const pageLayout = new compose.PageLayout({ namespaceID, pageID, blocks, meta: { title } })
|
||||
const pageLayout = new compose.PageLayout({ namespaceID, pageID, handle: 'primary', blocks, meta: { title } })
|
||||
return this.createPageLayout(pageLayout)
|
||||
}).catch(this.toastErrorHandler(this.$t('notification:module.recordPage.createFailed')))
|
||||
.finally(() => {
|
||||
@@ -167,7 +167,7 @@ export default {
|
||||
|
||||
this.createPage(page)
|
||||
.then(({ pageID, title, blocks }) => {
|
||||
const pageLayout = new compose.PageLayout({ namespaceID, pageID, blocks, meta: { title } })
|
||||
const pageLayout = new compose.PageLayout({ namespaceID, pageID, handle: 'primary', blocks, meta: { title } })
|
||||
return Promise.all([
|
||||
this.updatePage({ ...this.recordPage, selfID: pageID }),
|
||||
this.createPageLayout(pageLayout),
|
||||
|
||||
@@ -49,14 +49,14 @@
|
||||
:get-option-key="b => b.blockID"
|
||||
:options="existingBlocks"
|
||||
:calculate-position="calculateDropdownPosition"
|
||||
placeholder="Blocks from other layouts"
|
||||
:placeholder="$t('selector.selectableBlocks.placeholder')"
|
||||
append-to-body
|
||||
class="block-selector bg-white position-relative"
|
||||
/>
|
||||
|
||||
<b-input-group-append>
|
||||
<b-button
|
||||
title="Clone block without reference"
|
||||
:title="$t('selector.tooltip.clone.noRef')"
|
||||
variant="light"
|
||||
:disabled="!selectedExistingBlock"
|
||||
class="d-flex align-items-center"
|
||||
@@ -67,7 +67,7 @@
|
||||
/>
|
||||
</b-button>
|
||||
<b-button
|
||||
title="Copy block with references"
|
||||
:title="$t('selector.tooltip.clone.ref')"
|
||||
variant="light"
|
||||
:disabled="!selectedExistingBlock"
|
||||
class="d-flex align-items-center"
|
||||
|
||||
@@ -777,7 +777,7 @@ export default {
|
||||
weight: this.layouts.length + 1,
|
||||
}
|
||||
|
||||
layout.meta.title = `${this.$t('copyOf')}${layout.meta.title}`
|
||||
layout.meta.title = `${layout.meta.title}`
|
||||
|
||||
this.createPageLayout(this.layout).then(({ layoutID }) => {
|
||||
return this.fetchPageLayouts().then(() => {
|
||||
@@ -872,7 +872,7 @@ export default {
|
||||
|
||||
this.layout = this.layout || this.layouts[0]
|
||||
if (!this.layout) {
|
||||
this.toastWarning('No layout, create one to edit it')
|
||||
this.toastWarning('notification:page.page-layout.notFound.edit')
|
||||
return this.$router.push(this.pageEditor)
|
||||
}
|
||||
|
||||
|
||||
@@ -195,14 +195,14 @@
|
||||
class="text-primary"
|
||||
style="width: 45%; min-width: 200px;"
|
||||
>
|
||||
Title *
|
||||
{{ $t('page-layout.title') }}
|
||||
</th>
|
||||
|
||||
<th
|
||||
class="text-primary"
|
||||
style="width: 45%; min-width: 200px;"
|
||||
>
|
||||
Handle
|
||||
{{ $t('page-layout.handle') }}
|
||||
</th>
|
||||
|
||||
<th style="width: 80px;" />
|
||||
@@ -229,10 +229,21 @@
|
||||
<b-td
|
||||
class="align-middle"
|
||||
>
|
||||
<b-form-input
|
||||
v-model="layout.meta.title"
|
||||
:state="layoutTitleState(layout.meta.title)"
|
||||
/>
|
||||
<b-input-group>
|
||||
<b-form-input
|
||||
v-model="layout.meta.title"
|
||||
:state="layoutTitleState(layout.meta.title)"
|
||||
/>
|
||||
|
||||
<b-input-group-append>
|
||||
<page-layout-translator
|
||||
:page-layout="layout"
|
||||
:disabled="layout.pageLayoutID === '0'"
|
||||
highlight-key="meta.title"
|
||||
button-variant="light"
|
||||
/>
|
||||
</b-input-group-append>
|
||||
</b-input-group>
|
||||
</b-td>
|
||||
|
||||
<b-td
|
||||
@@ -260,17 +271,12 @@
|
||||
variant="primary"
|
||||
:disabled="layout.pageLayoutID === '0'"
|
||||
class="d-flex align-items-center"
|
||||
style="margin-left:2px;"
|
||||
:to="{ name: 'admin.pages.builder', query: { layoutID: layout.pageLayoutID} }"
|
||||
>
|
||||
<font-awesome-icon
|
||||
:icon="['far', 'edit']"
|
||||
/>
|
||||
</b-button>
|
||||
<page-layout-translator
|
||||
:page-layout="layout"
|
||||
style="margin-left:2px;"
|
||||
/>
|
||||
</b-input-group-append>
|
||||
</b-input-group>
|
||||
</b-td>
|
||||
@@ -290,7 +296,7 @@
|
||||
variant="primary"
|
||||
@click="addLayout"
|
||||
>
|
||||
Add layout
|
||||
{{ $t('page-layout.add') }}
|
||||
</b-button>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
@@ -301,7 +307,7 @@
|
||||
<b-modal
|
||||
v-if="layoutEditor.layout"
|
||||
:visible="!!layoutEditor.layout"
|
||||
title="Configure layout"
|
||||
:title="$t('page-layout.configure', { title: ((layoutEditor.layout || {}).meta || {}).title})"
|
||||
:ok-title="$t('general:label.saveAndClose')"
|
||||
ok-variant="primary"
|
||||
cancel-variant="link"
|
||||
@@ -311,11 +317,11 @@
|
||||
@hide="layoutEditor.layout = undefined"
|
||||
>
|
||||
<h5 class="mb-3">
|
||||
Visibility
|
||||
{{ $t('page-layout.visibility') }}
|
||||
</h5>
|
||||
|
||||
<b-form-group
|
||||
label="Condition"
|
||||
:label="$t('page-layout.condition.label')"
|
||||
label-class="text-primary"
|
||||
>
|
||||
<b-input-group>
|
||||
@@ -326,20 +332,20 @@
|
||||
</b-input-group-prepend>
|
||||
<b-form-input
|
||||
v-model="layoutEditor.layout.config.visibility.expression"
|
||||
placeholder="When will the layout be shown"
|
||||
:placeholder="$t('page-layout.condition.placeholder')"
|
||||
/>
|
||||
</b-input-group>
|
||||
</b-form-group>
|
||||
|
||||
<b-form-group
|
||||
label="Roles"
|
||||
:label="$t('page-layout.roles.label')"
|
||||
label-class="text-primary"
|
||||
>
|
||||
<vue-select
|
||||
v-model="currentLayoutRoles"
|
||||
:options="roles.options"
|
||||
:loading="roles.processing"
|
||||
placeholder="Pick roles that the layout will be shown to"
|
||||
:placeholder="$t('page-layout.roles.placeholder')"
|
||||
:get-option-label="role => role.name"
|
||||
:reduce="role => role.roleID"
|
||||
:selectable="role => !currentLayoutRoles.includes(role.roleID)"
|
||||
@@ -353,52 +359,52 @@
|
||||
<hr>
|
||||
|
||||
<h5 class="mb-3">
|
||||
Record toolbar
|
||||
{{ $t('page-layout.recordToolbar') }}
|
||||
</h5>
|
||||
|
||||
<b-form-group
|
||||
label="Buttons"
|
||||
:label="$t('page-layout.recordToolbar.buttons.label')"
|
||||
label-class="text-primary"
|
||||
>
|
||||
<b-form-checkbox
|
||||
v-model="layoutEditor.layout.config.buttons.back.enabled"
|
||||
>
|
||||
Show back button
|
||||
{{ $t('page-layout.recordToolbar.buttons.showBack') }}
|
||||
</b-form-checkbox>
|
||||
|
||||
<b-form-checkbox
|
||||
v-model="layoutEditor.layout.config.buttons.delete.enabled"
|
||||
>
|
||||
Show delete button
|
||||
{{ $t('page-layout.recordToolbar.buttons.showDelete') }}
|
||||
</b-form-checkbox>
|
||||
|
||||
<b-form-checkbox
|
||||
v-model="layoutEditor.layout.config.buttons.clone.enabled"
|
||||
>
|
||||
Show clone button
|
||||
{{ $t('page-layout.recordToolbar.buttons.showClone') }}
|
||||
</b-form-checkbox>
|
||||
|
||||
<b-form-checkbox
|
||||
v-model="layoutEditor.layout.config.buttons.new.enabled"
|
||||
>
|
||||
Show new button
|
||||
{{ $t('page-layout.recordToolbar.buttons.showNew') }}
|
||||
</b-form-checkbox>
|
||||
|
||||
<b-form-checkbox
|
||||
v-model="layoutEditor.layout.config.buttons.edit.enabled"
|
||||
>
|
||||
Show edit button
|
||||
{{ $t('page-layout.recordToolbar.buttons.showEdit') }}
|
||||
</b-form-checkbox>
|
||||
|
||||
<b-form-checkbox
|
||||
v-model="layoutEditor.layout.config.buttons.submit.enabled"
|
||||
>
|
||||
Show submit button
|
||||
{{ $t('page-layout.recordToolbar.buttons.showEdit') }}
|
||||
</b-form-checkbox>
|
||||
</b-form-group>
|
||||
|
||||
<b-form-group
|
||||
label="Actions"
|
||||
:label="$t('page-layout.recordToolbar.actions.label')"
|
||||
label-class="text-primary"
|
||||
>
|
||||
<b-table-simple
|
||||
@@ -414,35 +420,35 @@
|
||||
class="text-primary"
|
||||
style="width: 25%; min-width: 190px;"
|
||||
>
|
||||
Label
|
||||
{{ $t('page-layout.recordToolbar.actions.buttonLabel') }}
|
||||
</th>
|
||||
|
||||
<th
|
||||
class="text-primary"
|
||||
style="width: 25%; min-width: 240px;"
|
||||
>
|
||||
Redirect to layout
|
||||
{{ $t('page-layout.recordToolbar.actions.layout.label') }}
|
||||
</th>
|
||||
|
||||
<th
|
||||
style="min-width: 100px;"
|
||||
class="text-primary"
|
||||
>
|
||||
Variant
|
||||
{{ $t('page-layout.recordToolbar.actions.variant') }}
|
||||
</th>
|
||||
|
||||
<th
|
||||
style="min-width: 100px;"
|
||||
class="text-primary"
|
||||
>
|
||||
Placement
|
||||
{{ $t('page-layout.recordToolbar.actions.placement.label') }}
|
||||
</th>
|
||||
|
||||
<th
|
||||
style="min-width: 80px;"
|
||||
class="text-primary text-center"
|
||||
>
|
||||
Visible
|
||||
{{ $t('page-layout.recordToolbar.actions.visible') }}
|
||||
</th>
|
||||
|
||||
<th style="min-width: 80px;" />
|
||||
@@ -819,15 +825,9 @@ export default {
|
||||
},
|
||||
},
|
||||
|
||||
actionKindOptions () {
|
||||
return [
|
||||
{ value: 'toLayout', text: 'Go to layout' },
|
||||
]
|
||||
},
|
||||
|
||||
actionLayoutOptions () {
|
||||
return [
|
||||
{ pageLayoutID: '', label: 'No route selected' },
|
||||
{ pageLayoutID: '', label: this.$t('page-layout.recordToolbar.actions.layout.placeholder') },
|
||||
...this.layouts.filter(({ pageLayoutID }) => pageLayoutID !== NoID)
|
||||
.map(({ pageLayoutID, handle, meta }) => ({ pageLayoutID, label: meta.title || handle || pageLayoutID })),
|
||||
]
|
||||
@@ -835,22 +835,22 @@ export default {
|
||||
|
||||
actionPlacementOptions () {
|
||||
return [
|
||||
{ value: 'start', text: 'Start' },
|
||||
{ value: 'center', text: 'Center' },
|
||||
{ value: 'end', text: 'End' },
|
||||
{ value: 'start', text: this.$t('page-layout.recordToolbar.actions.placement.start') },
|
||||
{ value: 'center', text: this.$t('page-layout.recordToolbar.actions.placement.center') },
|
||||
{ value: 'end', text: this.$t('page-layout.recordToolbar.actions.placement.end') },
|
||||
]
|
||||
},
|
||||
|
||||
actionVariantOptions () {
|
||||
return [
|
||||
{ text: this.$t('general:variants.primary'), value: 'primary' },
|
||||
{ text: this.$t('general:variants.secondary'), value: 'secondary' },
|
||||
{ text: this.$t('general:variants.success'), value: 'success' },
|
||||
{ text: this.$t('general:variants.warning'), value: 'warning' },
|
||||
{ text: this.$t('general:variants.danger'), value: 'danger' },
|
||||
{ text: this.$t('general:variants.info'), value: 'info' },
|
||||
{ text: this.$t('general:variants.light'), value: 'light' },
|
||||
{ text: this.$t('general:variants.dark'), value: 'dark' },
|
||||
{ value: 'primary', text: this.$t('general:variants.primary') },
|
||||
{ value: 'secondary', text: this.$t('general:variants.secondary') },
|
||||
{ value: 'success', text: this.$t('general:variants.success') },
|
||||
{ value: 'warning', text: this.$t('general:variants.warning') },
|
||||
{ value: 'danger', text: this.$t('general:variants.danger') },
|
||||
{ value: 'info', text: this.$t('general:variants.info') },
|
||||
{ value: 'light', text: this.$t('general:variants.light') },
|
||||
{ value: 'dark', text: this.$t('general:variants.dark') },
|
||||
]
|
||||
},
|
||||
},
|
||||
|
||||
@@ -393,7 +393,7 @@ export default {
|
||||
})
|
||||
|
||||
if (!this.layout) {
|
||||
this.toastWarning('No page layout, create one to view the page')
|
||||
this.toastWarning('notification:page.page-layout.notFound.view')
|
||||
return this.$router.go(-1)
|
||||
}
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ export default {
|
||||
})
|
||||
|
||||
if (!this.layout) {
|
||||
this.toastWarning('No page layout, create one to view the page')
|
||||
this.toastWarning('notification:page.page-layout.notFound.view')
|
||||
return this.$router.go(-1)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
selector:
|
||||
selectableBlocks:
|
||||
placeholder: Blocks from other layouts
|
||||
tooltip:
|
||||
clone:
|
||||
ref: Clone with references
|
||||
noRef: Clone without references
|
||||
automation:
|
||||
addPlaceholderLabel: Add placeholder (dummy button)
|
||||
availableScriptsAndWorkflow: Available scripts and workflows ({{count}})
|
||||
|
||||
@@ -99,6 +99,9 @@ page:
|
||||
copyFailed: Could not copy block {{reason}}
|
||||
invalidBlock: Not a valid page-block
|
||||
page-layout:
|
||||
notFound:
|
||||
edit: No page layout, create one to edit it
|
||||
view: No page layout found, create one to view the page
|
||||
save:
|
||||
success: Layout saved
|
||||
failed: Failed to save layout
|
||||
|
||||
@@ -1,3 +1,38 @@
|
||||
page-layout:
|
||||
title: Title *
|
||||
handle: Handle
|
||||
add: Add layout
|
||||
configure: 'Configure layout - "{{title}}"'
|
||||
visibility: Visibility
|
||||
condition:
|
||||
label: Condition
|
||||
placeholder: When will the layout be shown
|
||||
roles:
|
||||
label: Roles
|
||||
placeholder: Pick roles that the layout will be shown to
|
||||
recordToolbar:
|
||||
buttons:
|
||||
label: Buttons
|
||||
showBack: Show "Back" button
|
||||
showDelete: Show "Delete" button
|
||||
showClone: Show "Save as copy" button
|
||||
showNew: Show "Add new" button
|
||||
showEdit: Show "Edit" button
|
||||
showSave: Show "Save" button
|
||||
actions:
|
||||
label: Actions
|
||||
buttonLabel: Label
|
||||
variant: Variant
|
||||
visible: Visible
|
||||
placement:
|
||||
label: Placement
|
||||
start: Start
|
||||
center: Center
|
||||
end: End
|
||||
layout:
|
||||
label: Redirect to layout
|
||||
placeholder: No layout selected
|
||||
|
||||
block:
|
||||
general:
|
||||
changeBlock: Change existing block
|
||||
|
||||
Reference in New Issue
Block a user