From 5882c6dd752493a5ac4d18a4dfa24bfcc5991808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Nunes=20Medeiros?= Date: Thu, 5 Oct 2023 10:53:58 -0300 Subject: [PATCH 01/14] fix: remove echo re --- src/classes/class-tainacan-private-files.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/classes/class-tainacan-private-files.php b/src/classes/class-tainacan-private-files.php index c97ced581..d7aab700c 100644 --- a/src/classes/class-tainacan-private-files.php +++ b/src/classes/class-tainacan-private-files.php @@ -228,7 +228,7 @@ class Private_Files { if ( !$existing_file && \file_exists( $prefixed_both ) ) { $existing_file = $prefixed_both; } - echo "-----------> $file
$prefixed_file
$prefixed_collection $prefixed_both: $existing_file"; + if ($existing_file) { $item = \Tainacan\Repositories\Items::get_instance()->fetch( (int) $item_id, (int) $collection_id ); From 8c958127d4d75f192ad1df9d6fc13361885d7440 Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Mon, 9 Oct 2023 15:13:00 -0300 Subject: [PATCH 02/14] Checks if user can edit taxonomy before displaying add new term button. --- ...-tainacan-rest-item-metadata-controller.php | 2 +- .../components/edition/item-edition-form.vue | 5 +++++ .../components/edition/term-edition-form.vue | 12 +++++++++--- .../metadata-types/taxonomy/Taxonomy.vue | 6 +++++- .../admin/js/store/modules/taxonomy/actions.js | 18 ++++++++++++++++-- .../class-tainacan-gutenberg-block.php | 2 +- 6 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/classes/api/endpoints/class-tainacan-rest-item-metadata-controller.php b/src/classes/api/endpoints/class-tainacan-rest-item-metadata-controller.php index d50e20fe6..0329721a7 100644 --- a/src/classes/api/endpoints/class-tainacan-rest-item-metadata-controller.php +++ b/src/classes/api/endpoints/class-tainacan-rest-item-metadata-controller.php @@ -132,7 +132,7 @@ class REST_Item_Metadata_Controller extends REST_Controller { public function prepare_item_for_response( $item, $request ) { $item_arr = $item->_toArray(true, true); - if($request['context'] === 'edit'){ + if ($request['context'] === 'edit') { $item_arr['current_user_can_edit'] = $item->can_edit(); $item_arr['current_user_can_delete'] = $item->can_delete(); } diff --git a/src/views/admin/components/edition/item-edition-form.vue b/src/views/admin/components/edition/item-edition-form.vue index 2c027cc0f..21eb9981d 100644 --- a/src/views/admin/components/edition/item-edition-form.vue +++ b/src/views/admin/components/edition/item-edition-form.vue @@ -1172,6 +1172,11 @@ export default { this.isLoading = false; + if ( wp && wp.hooks && wp.hooks.hasFilter(`tainacan_item_edition_form_submit--redirect`) ) { + window.location = wp.hooks.applyFilters(`tainacan_item_edition_form_submit--redirect`, this.item, this.form.collectionId, tainacan_plugin.admin_url); + return; + } + if (!this.$adminOptions.itemEditionMode && !this.$adminOptions.mobileAppMode) { if (!this.isOnSequenceEdit) { diff --git a/src/views/admin/components/edition/term-edition-form.vue b/src/views/admin/components/edition/term-edition-form.vue index 7bb11f7a4..689d5acb4 100644 --- a/src/views/admin/components/edition/term-edition-form.vue +++ b/src/views/admin/components/edition/term-edition-form.vue @@ -233,7 +233,9 @@ originalForm: Object, taxonomyId: '', isHierarchical: Boolean, - isTermInsertionFlow: false + isTermInsertionFlow: false, + metadatumId: [String, Number], + itemId: [String, Number] }, data() { return { @@ -308,7 +310,9 @@ this.isLoading = true; this.sendChildTerm({ taxonomyId: this.taxonomyId, - term: data + term: data, + metadatumId: this.metadatumId, + itemId: this.itemId }) .then((term) => { this.$emit('onEditionFinished', {term: term, hasChangedParent: this.hasChangedParent, initialParent: this.initialParentId }); @@ -342,7 +346,9 @@ this.isLoading = true; this.updateTerm({ taxonomyId: this.taxonomyId, - term: data + term: data, + metadatumId: this.metadatumId, + itemId: this.itemId }) .then((term) => { this.formErrors = {}; diff --git a/src/views/admin/components/metadata-types/taxonomy/Taxonomy.vue b/src/views/admin/components/metadata-types/taxonomy/Taxonomy.vue index 42558db5d..fa4a0b4ac 100644 --- a/src/views/admin/components/metadata-types/taxonomy/Taxonomy.vue +++ b/src/views/admin/components/metadata-types/taxonomy/Taxonomy.vue @@ -59,6 +59,8 @@ custom-class="tainacan-modal" :close-button-aria-label="$i18n.get('close')"> { +export const sendChildTerm = ({ commit }, { taxonomyId, term, itemId, metadatumId }) => { + + if ( itemId != undefined ) + term['item_id'] = itemId; + + if ( metadatumId != undefined ) + term['metadatum_id'] = metadatumId; + return new Promise(( resolve, reject ) => { axios.tainacan.post(`/taxonomy/${taxonomyId}/terms/`, term) .then( res => { @@ -172,7 +179,14 @@ export const sendChildTerm = ({ commit }, { taxonomyId, term }) => { }); }; -export const updateTerm = ({}, { taxonomyId, term }) => { +export const updateTerm = ({}, { taxonomyId, term, itemId, metadatumId }) => { + + if ( itemId != undefined ) + term['item_id'] = itemId; + + if ( metadatumId != undefined ) + term['metadatum_id'] = metadatumId; + return new Promise(( resolve, reject ) => { axios.tainacan.patch(`/taxonomy/${taxonomyId}/terms/${term.id}`, term) .then( res => { diff --git a/src/views/gutenberg-blocks/class-tainacan-gutenberg-block.php b/src/views/gutenberg-blocks/class-tainacan-gutenberg-block.php index f84a1ee5b..4fac8f1af 100644 --- a/src/views/gutenberg-blocks/class-tainacan-gutenberg-block.php +++ b/src/views/gutenberg-blocks/class-tainacan-gutenberg-block.php @@ -284,7 +284,7 @@ function tainacan_blocks_get_category_icon_script() { wp_enqueue_script( 'tainacan-blocks-register-category-icon', $TAINACAN_BASE_URL . '/assets/js/tainacan_blocks_category_icon.js', - array('wp-blocks'), + array('wp-blocks', 'wp-element'), $TAINACAN_VERSION ); } From 2fb84e6d78e223a1220b86ec87bbe42779be9b3a Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Tue, 10 Oct 2023 11:20:36 -0300 Subject: [PATCH 03/14] Removes abandoned filter on item edition form to redriect after submit. --- src/views/admin/components/edition/item-edition-form.vue | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/views/admin/components/edition/item-edition-form.vue b/src/views/admin/components/edition/item-edition-form.vue index 21eb9981d..2c027cc0f 100644 --- a/src/views/admin/components/edition/item-edition-form.vue +++ b/src/views/admin/components/edition/item-edition-form.vue @@ -1172,11 +1172,6 @@ export default { this.isLoading = false; - if ( wp && wp.hooks && wp.hooks.hasFilter(`tainacan_item_edition_form_submit--redirect`) ) { - window.location = wp.hooks.applyFilters(`tainacan_item_edition_form_submit--redirect`, this.item, this.form.collectionId, tainacan_plugin.admin_url); - return; - } - if (!this.$adminOptions.itemEditionMode && !this.$adminOptions.mobileAppMode) { if (!this.isOnSequenceEdit) { From c08ae9a74221401c667e2e5d4a193f0837a5b89b Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Tue, 10 Oct 2023 16:52:41 -0300 Subject: [PATCH 04/14] Adds options to hide certain elements of the item edition form and change labels. #811. --- .../entities/class-tainacan-collection.php | 208 ++++++++- .../class-tainacan-collections.php | 123 +++++ .../edition/collection-edition-form.vue | 424 ++++++++++++++---- .../edition/item-attachments-edition-form.vue | 5 +- .../edition/item-document-edition-form.vue | 11 +- .../components/edition/item-edition-form.vue | 37 +- .../edition/item-thumbnail-edition-form.vue | 3 +- .../js/store/modules/collection/actions.js | 3 +- src/views/admin/pages/singles/item-page.vue | 20 +- src/views/tainacan-i18n.php | 6 +- 10 files changed, 704 insertions(+), 136 deletions(-) diff --git a/src/classes/entities/class-tainacan-collection.php b/src/classes/entities/class-tainacan-collection.php index 3ab6d06fd..b4922de52 100644 --- a/src/classes/entities/class-tainacan-collection.php +++ b/src/classes/entities/class-tainacan-collection.php @@ -40,7 +40,17 @@ class Collection extends Entity { $hide_items_thumbnail_on_lists, $submission_anonymous_user, $submission_default_status, - $submission_use_recaptcha; + $submission_use_recaptcha, + $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; /** * {@inheritDoc} @@ -607,14 +617,103 @@ class Collection extends Entity { /** * Get the default metadata section properties. * - * @param [string] $value - * * @return void */ function get_default_metadata_section_properties( ) { return $this->get_mapped_property( 'default_metadata_section_properties' ); } + /** + * Get the enabled document types for this collection. + * + * @return array The enabled document types. + */ + function get_item_enabled_document_types() { + return $this->get_mapped_property('item_enabled_document_types'); + } + + /** + * Get the label for the section in this collection. + * + * @return string The label for the section. + */ + function get_item_document_label() { + return $this->get_mapped_property('item_document_label'); + } + + /** + * Get the label for the thumbnail section in this collection. + * + * @return string The label for the thumbnail section. + */ + function get_item_thumbnail_label() { + 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'); + } + + /** + * Check if attachments are enabled for this collection. + * + * @return string 'yes' if attachments are enabled, 'no' otherwise. + */ + function get_item_enable_attachments() { + return $this->get_mapped_property('item_enable_attachments'); + } + + /** + * Check if metadata focus mode is enabled for this collection. + * + * @return string 'yes' if metadata focus mode is enabled, 'no' otherwise. + */ + function get_item_enable_metadata_focus_mode() { + return $this->get_mapped_property('item_enable_metadata_focus_mode'); + } + + /** + * Check if metadata required filter is enabled for this collection. + * + * @return string 'yes' if metadata required filter is enabled, 'no' otherwise. + */ + function get_item_enable_metadata_required_filter() { + return $this->get_mapped_property('item_enable_metadata_required_filter'); + } + + /** + * Check if metadata search bar is enabled for this collection. + * + * @return string 'yes' if metadata search bar is enabled, 'no' otherwise. + */ + function get_item_enable_metadata_searchbar() { + return $this->get_mapped_property('item_enable_metadata_searchbar'); + } + + /** + * Check if metadata collapses are enabled for this collection. + * + * @return bool True if metadata collapses are enabled, 'no' otherwise. + */ + function get_item_enable_metadata_collapses() { + return $this->get_mapped_property('item_enable_metadata_collapses'); + } + + // Setters /** * Set the collection name * @@ -750,7 +849,7 @@ class Collection extends Entity { * @return void */ function set_metadata_section_order( $value ) { - if( !empty($value) ) { + if( !empty( $value ) ) { $metadata_order = array( ); foreach($value as $section) { $metadata_order = array_merge($metadata_order, $section['metadata_order']); @@ -888,6 +987,107 @@ class Collection extends Entity { return $this->set_mapped_property( 'default_metadata_section_properties', $value); } + + /** + * Set the enabled document types for this collection. + * + * @param array $value The enabled document types. + * @return void + */ + function set_item_enabled_document_types( $value ) { + $this->set_mapped_property('item_enabled_document_types', $value); + } + + /** + * Set the label for the document section in this collection. + * + * @param string $value The label for the document section. + * @return void + */ + function set_item_document_label( $value ) { + $this->set_mapped_property('item_document_label', $value); + } + + /** + * Set the label for the thumbnail section in this collection. + * + * @param string $value The label for the thumbnail section. + * @return void + */ + function set_item_thumbnail_label( $value ) { + $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); + } + + /** + * Enable or disable attachments for this collection. + * + * @param string $value 'yes' to enable attachments, 'no' to disable. + * @return void + */ + function set_item_enable_attachments( $value ) { + $this->set_mapped_property('item_enable_attachments', $value); + } + + /** + * Enable or disable metadata focus mode for this collection. + * + * @param string $value 'yes' to enable metadata focus mode, 'no' to disable. + * @return void + */ + function set_item_enable_metadata_focus_mode( $value ) { + $this->set_mapped_property('item_enable_metadata_focus_mode', $value); + } + + /** + * Enable or disable metadata required filter for this collection. + * + * @param string $value 'yes' to enable metadata required filter, 'no' to disable. + * @return void + */ + function set_item_enable_metadata_required_filter( $value ) { + $this->set_mapped_property('item_enable_metadata_required_filter', $value); + } + + /** + * Enable or disable metadata search bar for this collection. + * + * @param string $value 'yes' to enable metadata search bar, 'no' to disable. + * @return void + */ + function set_item_enable_metadata_searchbar( $value ) { + $this->set_mapped_property('item_enable_metadata_searchbar', $value); + } + + /** + * Enable or disable metadata collapses for this collection. + * + * @param string $value 'yes' to enable metadata collapses, 'no' to disable. + * @return void + */ + function set_item_enable_metadata_collapses( $value ) { + $this->set_mapped_property('item_enable_metadata_collapses', $value); + } + /** * Validate Collection * diff --git a/src/classes/repositories/class-tainacan-collections.php b/src/classes/repositories/class-tainacan-collections.php index 509e55b6f..7e454d114 100644 --- a/src/classes/repositories/class-tainacan-collections.php +++ b/src/classes/repositories/class-tainacan-collections.php @@ -330,6 +330,129 @@ class Collections extends Repository { ] ] ], + 'item_enabled_document_types' => [ + 'map' => 'meta', + 'title' => __( 'Enabled document types', 'tainacan' ), + 'type' => 'object', + 'description' => __( 'The document types that are available in the item edition form.', 'tainacan' ), + 'items' => [ + 'type' => 'object', + 'properties' => [ + 'enabled' => [ + 'description' => __( 'Whether the document type is enabled or not.', 'tainacan' ), + 'type' => 'string', + 'enum' => [ 'yes', 'no' ], + ], + 'label' => [ + 'description' => __( 'The label that will represent the document type.', 'tainacan' ), + 'type' => 'string', + ], + 'icon' => [ + 'description' => __( 'The slug of the icon that will represent the document type.', 'tainacan' ), + 'type' => 'string', + ], + ] + ], + 'default' => [ + 'attachment' => [ + 'enabled' => 'yes', + 'label' => __( 'File', 'tainacan' ), + 'icon' => 'attachments' + ], + 'url' => [ + 'enabled' => 'yes', + 'label' => __('URL', 'tainacan' ), + 'icon' => 'url' + ], + 'text' => [ + 'enabled' => 'yes', + 'label' => __('Text', 'tainacan' ), + 'icon' => 'text' + ] + ] + ], + 'item_document_label' => [ + 'map' => 'meta', + 'title' => __( 'Main document label', 'tainacan' ), + 'type' => 'string', + 'description' => __( 'The label for the main document section in the item edition form', 'tainacan' ), + 'default' => __( 'Document', 'tainacan' ), + //'validation' => v::stringType(), + ], + 'item_thumbnail_label' => [ + 'map' => 'meta', + 'title' => __( 'Thumbnail label', 'tainacan' ), + 'type' => 'string', + 'description' => __( 'The label for the thumbnail section in the item edition form', 'tainacan' ), + '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' => [ + 'map' => 'meta', + 'title' => __( 'Attachments plural label', 'tainacan' ), + 'type' => 'string', + 'description' => __( 'The plural label for the attachments section in the item edition form', 'tainacan' ), + 'default' => __( 'Attachments', 'tainacan' ), + //'validation' => v::stringType(), + ], + 'item_enable_attachments' => [ + 'map' => 'meta', + 'title' => __( 'Item attachments', 'tainacan' ), + 'type' => 'string', + 'description' => __( 'If enabled, each item can have a set of files attached to it, complementary to the item document.', 'tainacan' ), + 'default' => 'yes', + 'on_error' => __( 'Value should be yes or no', 'tainacan' ), + 'enum' => [ 'yes', 'no' ], + 'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no + ], + 'item_enable_metadata_focus_mode' => [ + 'map' => 'meta', + 'title' => __( 'Metadata focus mode', 'tainacan' ), + 'type' => 'string', + 'description' => __( 'If enabled, a button can start a special navigation mode, that focus one metadatum per time in the item edition form.', 'tainacan' ), + 'default' => 'yes', + 'on_error' => __( 'Value should be yes or no', 'tainacan' ), + 'enum' => [ 'yes', 'no' ], + 'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no + ], + 'item_enable_metadata_required_filter' => [ + 'map' => 'meta', + 'title' => __( 'Metadata required filter', 'tainacan' ), + 'type' => 'string', + 'description' => __( 'If enabled, a switch can be toggled to display only required metadata in the item edition form.', 'tainacan' ), + 'default' => 'yes', + 'on_error' => __( 'Value should be yes or no', 'tainacan' ), + 'enum' => [ 'yes', 'no' ], + 'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no + ], + 'item_enable_metadata_searchbar' => [ + 'map' => 'meta', + 'title' => __( 'Metadata search bar', 'tainacan' ), + 'type' => 'string', + 'description' => __( 'If enabled, a search bar can be used for filtering the list of metadata in the item edition form.', 'tainacan' ), + 'default' => 'yes', + 'on_error' => __( 'Value should be yes or no', 'tainacan' ), + 'enum' => [ 'yes', 'no' ], + 'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no + ], + 'item_enable_metadata_collapses' => [ + 'map' => 'meta', + 'title' => __( 'Metadata collapses', 'tainacan' ), + 'type' => 'string', + 'description' => __( 'If enabled, each metadata in the item form will be wrapped in a collapsable component.', 'tainacan' ), + 'default' => 'yes', + 'on_error' => __( 'Value should be yes or no', 'tainacan' ), + 'enum' => [ 'yes', 'no' ], + 'validation' => v::stringType()->in( [ 'yes', 'no' ] ), // yes or no + ], ] ); } diff --git a/src/views/admin/components/edition/collection-edition-form.vue b/src/views/admin/components/edition/collection-edition-form.vue index b9871b6e9..81a5fc818 100644 --- a/src/views/admin/components/edition/collection-edition-form.vue +++ b/src/views/admin/components/edition/collection-edition-form.vue @@ -221,116 +221,225 @@ :message="$i18n.getHelperMessage('collections', 'hide_items_thumbnail_on_lists')"/> - - -   - - - + +
+ + + + {{ $i18n.get('label_item_edition_form_options') }} +
- - -   - - - - +
+ v-show="showItemEditionFormOptions" + class="options-columns"> - + +
+ + + + + + + + + +
+ + + +   + + + + + +
+ + + + + + + + + +
+ + + :label="$i18n.getHelperTitle('collections', 'allow_comments')"> +   + + + + +
+
+ + +
+ + + + {{ $i18n.get('label_item_submission_options') }} +
+ +
+ +
+ + +   + v-model="form.allows_submission" /> - - - - - -
- - - - - {{ statusOption.name }} - -
- -

- {{ $i18n.get('info_item_submission_draft_status') }} -

-
-
- - - -   - - -

+ :title="$i18n.getHelperTitle('collections', 'allows_submission')" + :message="$i18n.getHelperMessage('collections', 'allows_submission')"/> + +

+ + + +   + + + + + + + +
+ + + + + {{ statusOption.name }} + +
+ +

+ {{ $i18n.get('info_item_submission_draft_status') }} +

+
+
+ + + +   + + +

+ + + +

+
@@ -723,7 +832,33 @@ export default { submission_default_status: 'draft', submission_anonymous_user: 'no', hide_items_thumbnail_on_lists: '', - submission_use_recaptcha: 'no' + submission_use_recaptcha: 'no', + item_enabled_document_types: { + attachment: { + enabled: 'yes', + label: this.$i18n.get( 'File', 'tainacan'), + icon: 'attachments' + }, + url: { + enabled: 'yes', + label: this.$i18n.get( 'URL', 'tainacan'), + icon: 'url' + }, + text: { + enabled: 'yes', + label: this.$i18n.get( 'Text', 'tainacan'), + icon: 'text' + } + }, + 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_enable_attachments: 'yes', + item_enable_metadata_focus_mode: 'yes', + item_enable_metadata_required_filter: 'yes', + item_enable_metadata_searchbar: 'yes', + item_enable_metadata_collapses: 'yes' }, thumbnail: {}, cover: {}, @@ -754,7 +889,9 @@ export default { metadataSearchCancel: undefined, isLoadingMetadata: true, sortingMetadata: [], - localDefaultOrderBy: 'date' + localDefaultOrderBy: 'date', + showItemEditionFormOptions: false, + showItemSubmissionOptions: false } }, computed: { @@ -844,6 +981,16 @@ export default { this.form.submission_default_status = this.collection.submission_default_status; this.form.submission_use_recaptcha = this.collection.submission_use_recaptcha; this.form.hide_items_thumbnail_on_lists = this.collection.hide_items_thumbnail_on_lists; + 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_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; + this.form.item_enable_metadata_searchbar = this.collection.item_enable_metadata_searchbar; + this.form.item_enable_metadata_collapses = this.collection.item_enable_metadata_collapses; // Generates CoverPage from current cover_page_id info if (this.form.cover_page_id != undefined && this.form.cover_page_id != '') { @@ -954,7 +1101,17 @@ export default { submission_default_status: this.form.submission_default_status, submission_use_recaptcha: this.form.submission_use_recaptcha, allow_comments: this.form.allow_comments, - hide_items_thumbnail_on_lists: this.form.hide_items_thumbnail_on_lists + hide_items_thumbnail_on_lists: this.form.hide_items_thumbnail_on_lists, + 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_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, + item_enable_metadata_searchbar: this.form.item_enable_metadata_searchbar, + item_enable_metadata_collapses: this.form.item_enable_metadata_collapses }; this.fillExtraFormData(data); @@ -983,6 +1140,16 @@ export default { this.form.submission_default_status = this.collection.submission_default_status; this.form.submission_use_recaptcha = this.collection.submission_use_recaptcha; this.form.hide_items_thumbnail_on_lists = this.collection.hide_items_thumbnail_on_lists; + 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_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; + this.form.item_enable_metadata_searchbar = this.collection.item_enable_metadata_searchbar; + this.form.item_enable_metadata_collapses = this.collection.item_enable_metadata_collapses; this.isLoading = false; this.formErrorMessage = ''; @@ -1043,6 +1210,16 @@ export default { this.form.submission_default_status = this.collection.submission_default_status; this.form.submission_use_recaptcha = this.collection.submission_use_recaptcha; this.form.hide_items_thumbnail_on_lists = this.collection.hide_items_thumbnail_on_lists; + 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_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; + this.form.item_enable_metadata_searchbar = this.collection.item_enable_metadata_searchbar; + this.form.item_enable_metadata_collapses = this.collection.item_enable_metadata_collapses; // Pre-fill status with publish to incentivate it this.form.status = 'publish'; @@ -1327,6 +1504,55 @@ export default { color: var(--tainacan-white) !important; } } + + .collection-form-section { + margin: 1.5em 0 0.5em -0.5em; + position: relative; + cursor: pointer; + + .icon { + background: var(--tainacan-background-color); + z-index: 1; + position: relative; + } + strong { + background: var(--tainacan-background-color); + color: var(--tainacan-gray4); + font-size: 0.875em; + z-index: 1; + position: relative; + padding-right: 12px; + } + hr { + position: absolute; + top: -0.75em; + width: calc(100% - 42px); + height: 1px; + background-color: var(--tainacan-gray2); + margin-left: 42px; + } + } + + .options-columns { + margin-left: 0.25rem; + padding-left: 1.25em; + padding-right: 0.25em; + padding-bottom: 1.25em;border-left: 1px solid var(--tainacan-gray2); + + &>div:not(.field) { + -moz-column-count: 2; + -moz-column-gap: 0; + -moz-column-rule: 1px solid var(--tainacan-gray1); + -webkit-column-count: 2; + -webkit-column-gap: 0; + -webkit-column-rule: 1px solid var(--tainacan-gray1); + column-count: 2; + column-gap: 4em; + column-rule: 1px solid var(--tainacan-gray1); + margin-bottom: 1.125rem; + } + } + .header-field { padding-top: 1px; @@ -1472,7 +1698,7 @@ export default { } .item-submission-options { padding-left: 1em; - padding-top: 1.25em; + padding-top: 1.0em; margin-top: -1.5em; border-left: 1px solid var(--tainacan-gray2); } diff --git a/src/views/admin/components/edition/item-attachments-edition-form.vue b/src/views/admin/components/edition/item-attachments-edition-form.vue index ee5773fc5..487d93aeb 100644 --- a/src/views/admin/components/edition/item-attachments-edition-form.vue +++ b/src/views/admin/components/edition/item-attachments-edition-form.vue @@ -8,7 +8,7 @@ - {{ $i18n.get('label_attachments') }}  + {{ collection && collection.item_attachment_label_plural ? collection.item_attachment_label_plural : $i18n.get('label_attachments') }}  - {{ $i18n.get('label_add_or_update_attachments') }} + {{ $i18n.getWithVariables('label_add_or_update_%s', [ collection && collection.item_attachment_label_plural ? collection.item_attachment_label_plural : $i18n.get('label_attachments') ]) }}
- {{ form.document != undefined && form.document != null && form.document != '' ? $i18n.get('label_document') : $i18n.get('label_document_empty') }} + {{ 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') ) }} -
  • +
  • {{ $i18n.get('label_file') }}

  • -
  • +
  • {{ $i18n.get('label_text') }}

  • -
  • +