Adds more options to tweak item edition form options. #811.
This commit is contained in:
parent
c08ae9a742
commit
961ab09ad1
|
@ -44,8 +44,7 @@ class Collection extends Entity {
|
|||
$item_enabled_document_types,
|
||||
$item_document_label,
|
||||
$item_thumbnail_label,
|
||||
$item_attachment_label_singular,
|
||||
$item_attachment_label_plural,
|
||||
$item_attachment_label,
|
||||
$item_enable_attachments,
|
||||
$item_enable_metadata_focus_mode,
|
||||
$item_enable_metadata_required_filter,
|
||||
|
@ -650,22 +649,13 @@ class Collection extends Entity {
|
|||
return $this->get_mapped_property('item_thumbnail_label');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the singular label for the attachment section in this collection.
|
||||
*
|
||||
* @return string The singular label for the attachment section.
|
||||
*/
|
||||
function get_item_attachment_label_singular() {
|
||||
return $this->get_mapped_property('item_attachment_label_singular');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plural label for the attachment section in this collection.
|
||||
*
|
||||
* @return string The plural label for the attachment section.
|
||||
*/
|
||||
function get_item_attachment_label_plural() {
|
||||
return $this->get_mapped_property('item_attachment_label_plural');
|
||||
function get_item_attachment_label() {
|
||||
return $this->get_mapped_property('item_attachment_label');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1018,24 +1008,14 @@ class Collection extends Entity {
|
|||
$this->set_mapped_property('item_thumbnail_label', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the singular label for the attachment section in this collection.
|
||||
*
|
||||
* @param string $value The singular label for the attachment section.
|
||||
* @return void
|
||||
*/
|
||||
function set_item_attachment_label_singular( $value ) {
|
||||
$this->set_mapped_property('item_attachment_label_singular', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plural label for the attachment section in this collection.
|
||||
*
|
||||
* @param string $value The plural label for the attachment section.
|
||||
* @return void
|
||||
*/
|
||||
function set_item_attachment_label_plural( $value ) {
|
||||
$this->set_mapped_property('item_attachment_label_plural', $value);
|
||||
function set_item_attachment_label( $value ) {
|
||||
$this->set_mapped_property('item_attachment_label', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -387,15 +387,7 @@ class Collections extends Repository {
|
|||
'default' => __( 'Thumbnail', 'tainacan' ),
|
||||
//'validation' => v::stringType(),
|
||||
],
|
||||
'item_attachment_label_singular' => [
|
||||
'map' => 'meta',
|
||||
'title' => __( 'Attachments singular label', 'tainacan' ),
|
||||
'type' => 'string',
|
||||
'description' => __( 'The singular label for the attachments section in the item edition form', 'tainacan' ),
|
||||
'default' => __( 'Attachment', 'tainacan' ),
|
||||
//'validation' => v::stringType(),
|
||||
],
|
||||
'item_attachment_label_plural' => [
|
||||
'item_attachment_label' => [
|
||||
'map' => 'meta',
|
||||
'title' => __( 'Attachments plural label', 'tainacan' ),
|
||||
'type' => 'string',
|
||||
|
|
|
@ -239,6 +239,28 @@
|
|||
v-show="showItemEditionFormOptions"
|
||||
class="options-columns">
|
||||
|
||||
<!-- Allowed types of main document -------------------------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.getHelperTitle('collections', 'item_enabled_document_types')">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('collections', 'item_enabled_document_types')"
|
||||
:message="$i18n.getHelperMessage('collections', 'item_enabled_document_types')"/>
|
||||
<div class="status-radios">
|
||||
<b-checkbox
|
||||
v-for="(documentType, slug) in form.item_enabled_document_types"
|
||||
:key="slug"
|
||||
v-model="documentType.enabled"
|
||||
true-value="yes"
|
||||
false-value="no">
|
||||
<span class="icon">
|
||||
<i :class="'tainacan-icon tainacan-icon-' + documentType.icon" />
|
||||
</span>
|
||||
{{ documentType.label }}
|
||||
</b-checkbox>
|
||||
</div>
|
||||
</b-field>
|
||||
|
||||
<!-- Document and Thumbnail Label -------------------------------- -->
|
||||
<div>
|
||||
<b-field
|
||||
|
@ -265,47 +287,69 @@
|
|||
</div>
|
||||
|
||||
<!-- Allow attachments ------------------------ -->
|
||||
<b-field
|
||||
style="margin-top: 0.5rem; margin-bottom: 0.5rem;"
|
||||
:addons="false"
|
||||
:label="$i18n.getHelperTitle('collections', 'item_enable_attachments')">
|
||||
|
||||
<b-switch
|
||||
id="tainacan-checkbox-item-enable-attachments"
|
||||
size="is-small"
|
||||
true-value="yes"
|
||||
false-value="no"
|
||||
v-model="form.item_enable_attachments" />
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('collections', 'item_enable_attachments')"
|
||||
:message="$i18n.getHelperMessage('collections', 'item_enable_attachments')"/>
|
||||
</b-field>
|
||||
|
||||
<!-- Attachments Label -------------------------------- -->
|
||||
<div v-if="form.item_enable_attachments === 'yes'">
|
||||
<div>
|
||||
<b-field
|
||||
style="margin-top: 1.5rem; margin-bottom: 0rem;"
|
||||
:addons="false"
|
||||
:label="$i18n.getHelperTitle('collections', 'item_attachment_label_singular')">
|
||||
:label="$i18n.getHelperTitle('collections', 'item_enable_attachments')">
|
||||
|
||||
<b-switch
|
||||
id="tainacan-checkbox-item-enable-attachments"
|
||||
size="is-small"
|
||||
true-value="yes"
|
||||
false-value="no"
|
||||
v-model="form.item_enable_attachments" />
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('collections', 'item_attachment_label_singular')"
|
||||
:message="$i18n.getHelperMessage('collections', 'item_attachment_label_singular')"/>
|
||||
<b-input
|
||||
id="tainacan-text-item-attachment-label-singular"
|
||||
v-model="form.item_attachment_label_singular" />
|
||||
:title="$i18n.getHelperTitle('collections', 'item_enable_attachments')"
|
||||
:message="$i18n.getHelperMessage('collections', 'item_enable_attachments')"/>
|
||||
</b-field>
|
||||
|
||||
<!-- Attachments Label -------------------------------- -->
|
||||
<b-field
|
||||
v-if="form.item_enable_attachments === 'yes'"
|
||||
:addons="false"
|
||||
:label="$i18n.getHelperTitle('collections', 'item_attachment_label_plural')">
|
||||
:label="$i18n.getHelperTitle('collections', 'item_attachment_label')">
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('collections', 'item_attachment_label_plural')"
|
||||
:message="$i18n.getHelperMessage('collections', 'item_attachment_label_plural')"/>
|
||||
:title="$i18n.getHelperTitle('collections', 'item_attachment_label')"
|
||||
:message="$i18n.getHelperMessage('collections', 'item_attachment_label')"/>
|
||||
<b-input
|
||||
id="tainacan-text-item-attachment-label-singular"
|
||||
v-model="form.item_attachment_label_plural" />
|
||||
v-model="form.item_attachment_label" />
|
||||
</b-field>
|
||||
</div>
|
||||
|
||||
<!-- Features related to how metadata are shown in the item edition form -------------------------------- -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
:label="$i18n.get('label_metadata_related_features')">
|
||||
<div class="status-radios">
|
||||
<b-checkbox
|
||||
v-model="form.item_enable_metadata_collapses"
|
||||
true-value="yes"
|
||||
false-value="no">
|
||||
{{ $i18n.getHelperTitle('collections', 'item_enable_metadata_collapses') }}
|
||||
</b-checkbox>
|
||||
<b-checkbox
|
||||
v-model="form.item_enable_metadata_focus_mode"
|
||||
true-value="yes"
|
||||
false-value="no">
|
||||
{{ $i18n.getHelperTitle('collections', 'item_enable_metadata_focus_mode') }}
|
||||
</b-checkbox>
|
||||
<b-checkbox
|
||||
v-model="form.item_enable_metadata_required_filter"
|
||||
true-value="yes"
|
||||
false-value="no">
|
||||
{{ $i18n.getHelperTitle('collections', 'item_enable_metadata_required_filter') }}
|
||||
</b-checkbox>
|
||||
<b-checkbox
|
||||
v-model="form.item_enable_metadata_searchbar"
|
||||
true-value="yes"
|
||||
false-value="no">
|
||||
{{ $i18n.getHelperTitle('collections', 'item_enable_metadata_searchbar') }}
|
||||
</b-checkbox>
|
||||
</div>
|
||||
</b-field>
|
||||
|
||||
<!-- Comment Status ------------------------ -->
|
||||
<b-field
|
||||
:addons="false"
|
||||
|
@ -852,8 +896,7 @@ export default {
|
|||
},
|
||||
item_document_label: this.$i18n.get( 'Document', 'tainacan' ),
|
||||
item_thumbnail_label: this.$i18n.get( 'Thumbnail', 'tainacan' ),
|
||||
item_attachment_label_singular: this.$i18n.get( 'Attachment', 'tainacan' ),
|
||||
item_attachment_label_plural: this.$i18n.get( 'Attachments', 'tainacan' ),
|
||||
item_attachment_label: this.$i18n.get( 'Attachments', 'tainacan' ),
|
||||
item_enable_attachments: 'yes',
|
||||
item_enable_metadata_focus_mode: 'yes',
|
||||
item_enable_metadata_required_filter: 'yes',
|
||||
|
@ -984,8 +1027,7 @@ export default {
|
|||
this.form.item_enabled_document_types = this.collection.item_enabled_document_types;
|
||||
this.form.item_document_label = this.collection.item_document_label;
|
||||
this.form.item_thumbnail_label = this.collection.item_thumbnail_label;
|
||||
this.form.item_attachment_label_singular = this.collection.item_attachment_label_singular;
|
||||
this.form.item_attachment_label_plural = this.collection.item_attachment_label_plural;
|
||||
this.form.item_attachment_label = this.collection.item_attachment_label;
|
||||
this.form.item_enable_attachments = this.collection.item_enable_attachments;
|
||||
this.form.item_enable_metadata_focus_mode = this.collection.item_enable_metadata_focus_mode;
|
||||
this.form.item_enable_metadata_required_filter = this.collection.item_enable_metadata_required_filter;
|
||||
|
@ -1105,8 +1147,7 @@ export default {
|
|||
item_enabled_document_types: this.form.item_enabled_document_types,
|
||||
item_document_label: this.form.item_document_label,
|
||||
item_thumbnail_label: this.form.item_thumbnail_label,
|
||||
item_attachment_label_singular: this.form.item_attachment_label_singular,
|
||||
item_attachment_label_plural: this.form.item_attachment_label_plural,
|
||||
item_attachment_label: this.form.item_attachment_label,
|
||||
item_enable_attachments: this.form.item_enable_attachments,
|
||||
item_enable_metadata_focus_mode: this.form.item_enable_metadata_focus_mode,
|
||||
item_enable_metadata_required_filter: this.form.item_enable_metadata_required_filter,
|
||||
|
@ -1143,8 +1184,7 @@ export default {
|
|||
this.form.item_enabled_document_types = this.collection.item_enabled_document_types;
|
||||
this.form.item_document_label = this.collection.item_document_label;
|
||||
this.form.item_thumbnail_label = this.collection.item_thumbnail_label;
|
||||
this.form.item_attachment_label_singular = this.collection.item_attachment_label_singular;
|
||||
this.form.item_attachment_label_plural = this.collection.item_attachment_label_plural;
|
||||
this.form.item_attachment_label = this.collection.item_attachment_label;
|
||||
this.form.item_enable_attachments = this.collection.item_enable_attachments;
|
||||
this.form.item_enable_metadata_focus_mode = this.collection.item_enable_metadata_focus_mode;
|
||||
this.form.item_enable_metadata_required_filter = this.collection.item_enable_metadata_required_filter;
|
||||
|
@ -1213,8 +1253,7 @@ export default {
|
|||
this.form.item_enabled_document_types = this.collection.item_enabled_document_types;
|
||||
this.form.item_document_label = this.collection.item_document_label;
|
||||
this.form.item_thumbnail_label = this.collection.item_thumbnail_label;
|
||||
this.form.item_attachment_label_singular = this.collection.item_attachment_label_singular;
|
||||
this.form.item_attachment_label_plural = this.collection.item_attachment_label_plural;
|
||||
this.form.item_attachment_label = this.collection.item_attachment_label;
|
||||
this.form.item_enable_attachments = this.collection.item_enable_attachments;
|
||||
this.form.item_enable_metadata_focus_mode = this.collection.item_enable_metadata_focus_mode;
|
||||
this.form.item_enable_metadata_required_filter = this.collection.item_enable_metadata_required_filter;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<span class="icon has-text-gray4">
|
||||
<i class="tainacan-icon tainacan-icon-attachments"/>
|
||||
</span>
|
||||
{{ collection && collection.item_attachment_label_plural ? collection.item_attachment_label_plural : $i18n.get('label_attachments') }}
|
||||
{{ collection && collection.item_attachment_label ? collection.item_attachment_label : $i18n.get('label_attachments') }}
|
||||
<span
|
||||
v-if="totalAttachments"
|
||||
class="has-text-gray has-text-weight-normal"
|
||||
|
@ -17,7 +17,7 @@
|
|||
</span>
|
||||
</label>
|
||||
<help-button
|
||||
:title="$i18n.get('label_attachments')"
|
||||
:title="collection && collection.item_attachment_label ? collection.item_attachment_label : $i18n.get('label_attachments')"
|
||||
:message="$i18n.get('info_edit_attachments')"/>
|
||||
<button
|
||||
style="float: right; font-size: 0.875em; margin: 2px 5px;"
|
||||
|
@ -28,7 +28,7 @@
|
|||
<span class="icon">
|
||||
<i class="tainacan-icon tainacan-icon-edit"/>
|
||||
</span>
|
||||
{{ $i18n.getWithVariables('label_add_or_update_%s', [ collection && collection.item_attachment_label_plural ? collection.item_attachment_label_plural : $i18n.get('label_attachments') ]) }}
|
||||
{{ $i18n.getWithVariables('label_add_or_update_%s', [ collection && collection.item_attachment_label ? collection.item_attachment_label : $i18n.get('label_attachments') ]) }}
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
|
@ -38,6 +38,7 @@
|
|||
<attachments-list
|
||||
:item="item"
|
||||
:form="form"
|
||||
:collection="collection"
|
||||
:is-editable="true"
|
||||
:should-load-attachments="shouldLoadAttachments"
|
||||
@onDeleteAttachment="($event) => $emit('onDeleteAttachment', $event)"/>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
{{ collection && collection.item_document_label ? collection.item_document_label : ( (form.document != undefined && form.document != null && form.document != '') ? $i18n.get('label_document') : $i18n.get('label_document_empty') ) }}
|
||||
</label>
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('items', 'document')"
|
||||
:title="collection && collection.item_document_label ? collection.item_document_label : $i18n.getHelperTitle('items', 'document')"
|
||||
:message="$i18n.getHelperMessage('items', 'document')"/>
|
||||
</div>
|
||||
<div
|
||||
|
|
|
@ -891,7 +891,7 @@ export default {
|
|||
pageTabs.push({
|
||||
slug: 'attachments',
|
||||
icon: 'attachments',
|
||||
name: this.collection && this.collection.item_attachment_label_plural ? this.collection.item_attachment_label_plural : this.$i18n.get('label_attachments'),
|
||||
name: this.collection && this.collection.item_attachment_label ? this.collection.item_attachment_label : this.$i18n.get('label_attachments'),
|
||||
total: this.totalAttachments
|
||||
});
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
{{ collection && collection.item_thumbnail_label ? collection.item_thumbnail_label : $i18n.get('label_thumbnail') }}
|
||||
</label>
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('items', '_thumbnail_id')"
|
||||
:title="collection && collection.item_thumbnail_label ? collection.item_thumbnail_label: $i18n.getHelperTitle('items', '_thumbnail_id')"
|
||||
:message="$i18n.getHelperMessage('items', '_thumbnail_id')"/>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<span
|
||||
v-if="form.document == attachment.id"
|
||||
class="file-attachment-document-tag">
|
||||
{{ $i18n.get('label_document') }}
|
||||
{{ collection && collection.item_document_label ? collection.item_document_label : $i18n.get('label_document') }}
|
||||
</span>
|
||||
<file-item
|
||||
:show-name="true"
|
||||
|
@ -52,7 +52,7 @@
|
|||
<i class="tainacan-icon tainacan-icon-30px tainacan-icon-attachments"/>
|
||||
</span>
|
||||
</p>
|
||||
<p>{{ $i18n.get('info_no_attachments_on_item_yet') }}</p>
|
||||
<p>{{ $i18n.getWithVariables('info_no_%s_on_item_yet', [ collection && collection.item_attachment_label ? collection.item_attachment_label : $i18n.get('label_attachments') ]) }}</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
@ -63,7 +63,7 @@
|
|||
v-if="attachments.length > 0">
|
||||
<div class="shown-items">
|
||||
{{
|
||||
$i18n.get('info_showing_attachments') + ' ' +
|
||||
$i18n.getWithVariables('info_showing_%s', [ collection && collection.item_attachment_label ? collection.item_attachment_label : $i18n.get('label_attachments') ]) + ' ' +
|
||||
(attachmentsPerPage * (attachmentsPage - 1) + 1) +
|
||||
$i18n.get('info_to') +
|
||||
getLastAttachmentsNumber() +
|
||||
|
@ -99,6 +99,7 @@
|
|||
props: {
|
||||
item: Object,
|
||||
form: Object,
|
||||
collection: Object,
|
||||
shouldLoadAttachments: Boolean,
|
||||
isEditable: Boolean,
|
||||
},
|
||||
|
|
|
@ -636,7 +636,7 @@ AdminOptionsHelperPlugin.install = function (Vue, options = {}) {
|
|||
* hideItemEditionMetadataTypes
|
||||
* allowItemEditionModalInsideModal // Not recommended!
|
||||
* itemEditionDocumentInsideTabs
|
||||
* itemEditionAttachmentInsideTabs
|
||||
* itemEditionAttachmentsInsideTabs
|
||||
|
||||
* hideBulkEditionPageTitle
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ export const fetchCollection = ({ commit, }, id) => {
|
|||
|
||||
export const fetchCollectionBasics = ({ commit }, {collectionId, isContextEdit }) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let endpoint = '/collections/' + collectionId + '?fetch_only=name,url,status,allow_comments,hide_items_thumbnail_on_lists,item_enabled_document_types,item_document_label,item_thumbnail_label,item_attachment_label_singular,item_attachment_label_plural,item_enable_attachments,item_enable_metadata_focus_mode,item_enable_metadata_required_filter,item_enable_metadata_searchbar,item_enable_metadata_collapses';
|
||||
let endpoint = '/collections/' + collectionId + '?fetch_only=name,url,status,allow_comments,hide_items_thumbnail_on_lists,item_enabled_document_types,item_document_label,item_thumbnail_label,item_attachment_label,item_enable_attachments,item_enable_metadata_focus_mode,item_enable_metadata_required_filter,item_enable_metadata_searchbar,item_enable_metadata_collapses';
|
||||
|
||||
if (isContextEdit)
|
||||
endpoint += '&context=edit';
|
||||
|
|
|
@ -277,7 +277,7 @@
|
|||
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-attachments"/>
|
||||
</span>
|
||||
<span>
|
||||
{{ collection && collection.item_attachment_label_plural ? collection.item_attachment_label_plural : $i18n.get('label_attachments') }}
|
||||
{{ collection && collection.item_attachment_label ? collection.item_attachment_label : $i18n.get('label_attachments') }}
|
||||
<span
|
||||
v-if="totalAttachments"
|
||||
class="has-text-gray has-text-weight-normal">
|
||||
|
@ -291,7 +291,8 @@
|
|||
class="section-box section-attachments">
|
||||
<attachments-list
|
||||
:item="item"
|
||||
:form="item" />
|
||||
:form="item"
|
||||
:collection="collection" />
|
||||
</div>
|
||||
|
||||
<!-- Hook for extra Form options -->
|
||||
|
|
|
@ -701,7 +701,8 @@ return apply_filters( 'tainacan-i18n', [
|
|||
'label_separator' => __( 'Separator', 'tainacan' ),
|
||||
'label_item_edition_form_options' => __( 'Item edition form options', 'tainacan' ),
|
||||
'label_item_submission_options' => __( 'Item submission options', 'tainacan' ),
|
||||
|
||||
'label_metadata_related_features' => __( 'Metadata related features', 'tainacan' ),
|
||||
|
||||
// Instructions. More complex sentences to guide user and placeholders
|
||||
'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ),
|
||||
'instruction_delete_selected_items' => __( 'Delete selected items', 'tainacan' ),
|
||||
|
@ -866,6 +867,8 @@ return apply_filters( 'tainacan-i18n', [
|
|||
/* translators: This is displayed before sentences like "Showing items 2 to 8 of 12 */
|
||||
'info_showing_items' => __( 'Showing items ', 'tainacan' ),
|
||||
'info_showing_attachments' => __( 'Showing attachments ', 'tainacan' ),
|
||||
/* translators: This is displayed before sentences like "Showing attachments 2 to 8 of 12 */
|
||||
'info_showing_%s' => __( 'Showing %s ', 'tainacan' ),
|
||||
'info_showing_collections' => __( 'Showing collections ', 'tainacan' ),
|
||||
'info_showing_taxonomies' => __( 'Showing taxonomies ', 'tainacan' ),
|
||||
'info_showing_activities' => __( 'Showing activities ', 'tainacan' ),
|
||||
|
@ -904,6 +907,8 @@ return apply_filters( 'tainacan-i18n', [
|
|||
'info_help_term_description' => __( 'The description of the Term.', 'tainacan' ),
|
||||
'info_help_parent_term' => __( 'The parent term', 'tainacan' ),
|
||||
'info_no_attachments_on_item_yet' => __( 'The are no attachments on this item so far.', 'tainacan' ),
|
||||
/* translators: This is displayed to indicate that there are no attachments yet. The attachments label can be tweked by user. */
|
||||
'info_no_%s_on_item_yet' => __( 'The are no %s on this item so far.', 'tainacan' ),
|
||||
'info_repository_metadata_inheritance' => __( 'Repository Metadata will be inherited by all collections.', 'tainacan' ),
|
||||
'info_repository_filters_inheritance' => __( 'Repository Filters will be inherited by all collections.', 'tainacan' ),
|
||||
'info_create_filters' => __( 'Click or Drag and Drop Metadata here for creating a new Filter.', 'tainacan' ),
|
||||
|
|
Loading…
Reference in New Issue