Adds option to expose only the displayed metadata on exposers modal. Ref #287.

This commit is contained in:
Mateus Machado Luna 2019-07-25 13:34:04 -03:00
parent 655077d8ab
commit 1075b86c5b
2 changed files with 37 additions and 12 deletions

View File

@ -106,6 +106,15 @@
v-if="selectedExposer != undefined"
class="exposer-item-container"
role="list">
<div class="exposed-metadata-control">
<b-checkbox
v-tooltip="{
content: $i18n.get('info_expose_only_displayed_metadata'),
autoHide: true,
placement: 'bottom'
}"
v-model="shouldRespectFetchOnly">{{ $i18n.get('label_expose_only_displayed_metadata') }}</b-checkbox>
</div>
<b-field
:addons="false"
class="exposer-item"
@ -258,7 +267,8 @@ export default {
siteLinkCopied: false,
selectedExposer: undefined,
selectedExposerMappers: [],
maxItemsPerPage: tainacan_plugin.api_max_items_per_page
maxItemsPerPage: tainacan_plugin.api_max_items_per_page,
shouldRespectFetchOnly: false
}
},
computed: {
@ -267,12 +277,16 @@ export default {
},
exposerBaseURL() {
let baseURL = this.collectionId != undefined ? '/collection/' + this.collectionId + '/items/' : '/items/';
let currentParams = this.$route.query;
let currentParams = JSON.parse(JSON.stringify(this.$route.query));
// Removes Fetch Only
if (currentParams.fetch_only != undefined)
if (currentParams.fetch_only != undefined && this.shouldRespectFetchOnly == false)
delete currentParams.fetch_only;
// Removes Fetch Only Meta
if (currentParams.fetch_only_meta != undefined && this.shouldRespectFetchOnly == false)
delete currentParams.fetch_only_meta;
// Removes View Mode
if (currentParams.view_mode != undefined)
delete currentParams.view_mode;
@ -526,6 +540,15 @@ export default {
}
}
.exposed-metadata-control {
display: flex;
justify-content: flex-end;
.checkbox {
width: auto;
}
}
.exposer-item-link {
margin: 0;
display: flex;

View File

@ -421,7 +421,8 @@ return apply_filters( 'tainacan-admin-i18n', [
'label_make_copies_of_item' => __( 'Make copies of item', 'tainacan' ),
'label_number_of_copies' => __( 'Number of copies', 'tainacan' ),
'label_return_to_list' => __( 'Return to list', 'tainacan' ),
'label_expose_only_displayed_metadata' => __( 'Expose only displayed metadata', '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' ),
@ -628,14 +629,15 @@ return apply_filters( 'tainacan-admin-i18n', [
'info_warning_process_cancelled' => __( 'Are you sure? This process will be cancelled', 'tainacan' ),
'info_empty' => __( 'empty', 'tainacan' ),
'info_url_copied' => __( 'URL link copied', 'tainacan' ),
'info_other_item_listing_options' => __('Other items listing options: ', 'tainacan'),
'info_send_email' => __('The exporter may take a while. Check this option to receive an e-mail when the process is done. You can also check the process status visiting the', 'tainacan'),
'info_tainacan_api' => __('Tainacan API on JSON format.', 'tainacan'),
'info_items_hidden_due_sorting' => __('When ordering by metadata value, items that have no value for the chosen metadata will not be listed. This list may have less elements than the total existing for current search criteria.', 'tainacan'),
'info_sorting_by_metadata_value_%s' => __('Showing only items that have value for metadata %s.', 'tainacan'),
'info_sorting_by_metadata_value_%s_empty_list' => __('No item found, but only items with values for metadata %s are shown. Try sorting by other metatada.', 'tainacan'),
'info_await_while_item_copy' => __('Please wait while copy is being created...', 'tainacan'),
'info_await_while_item_copies' => __('Please wait while copies are being created. This may take a while...', 'tainacan'),
'info_other_item_listing_options' => __( 'Other items listing options: ', 'tainacan'),
'info_send_email' => __( 'The exporter may take a while. Check this option to receive an e-mail when the process is done. You can also check the process status visiting the', 'tainacan'),
'info_tainacan_api' => __( 'Tainacan API on JSON format.', 'tainacan'),
'info_items_hidden_due_sorting' => __( 'When ordering by metadata value, items that have no value for the chosen metadata will not be listed. This list may have less elements than the total existing for current search criteria.', 'tainacan'),
'info_sorting_by_metadata_value_%s' => __( 'Showing only items that have value for metadata %s.', 'tainacan'),
'info_sorting_by_metadata_value_%s_empty_list' => __( 'No item found, but only items with values for metadata %s are shown. Try sorting by other metatada.', 'tainacan'),
'info_await_while_item_copy' => __( 'Please wait while copy is being created...', 'tainacan'),
'info_await_while_item_copies' => __( 'Please wait while copies are being created. This may take a while...', 'tainacan'),
'info_expose_only_displayed_metadata' => __( 'By checking this option, only metatada that are displayed on the current list will be exposed', 'tainacan' ),
// Tainacan Metadatum Types
'tainacan-text' => __( 'Text', 'tainacan' ),