Fix conflict while merging with develop.

This commit is contained in:
Mateus Machado Luna 2019-02-27 09:27:22 -03:00
commit 8da15fdade
19 changed files with 308 additions and 142 deletions

View File

@ -1167,9 +1167,11 @@ export default {
}
// Obtains collection name
this.fetchCollectionName(this.collectionId).then((collectionName) => {
this.collectionName = collectionName;
});
if (!this.isRepositoryLevel) {
this.fetchCollectionName(this.collectionId).then((collectionName) => {
this.collectionName = collectionName;
});
}
// Obtains if collection allow items comments
this.fetchCollectionAllowComments(this.collectionId).then((collectionAllowComments) => {

View File

@ -154,13 +154,14 @@
</button>
</div>
<div class="control">
<button
<a
type="button"
v-if="editForm.url != undefined && editForm.url!= ''"
class="button is-secondary"
target="_blank"
:href="editForm.url">
{{ $i18n.get('see') + ' ' + $i18n.get('term') }}
</button>
{{ $i18n.get('label_view_term') }}
</a>
</div>
<div class="control">
<button

View File

@ -603,10 +603,11 @@ export default {
// Obtains collection name
this.fetchCollectionName(this.collectionId).then((collectionName) => {
this.collectionName = collectionName;
});
if (!this.isRepositoryLevel) {
this.fetchCollectionName(this.collectionId).then((collectionName) => {
this.collectionName = collectionName;
});
}
// Sets modal callback function
this.$refs.filterTypeModal.onCancel = () => {
this.onCancelFilterTypeSelection();

View File

@ -220,7 +220,6 @@
<div class="field is-grouped form-submit">
<b-select
id="mappers-options-dropdown"
class="button is-secondary"
:placeholder="$i18n.get('instruction_select_a_mapper')">
<option
v-for="metadatum_mapper in metadatum_mappers"
@ -835,9 +834,11 @@ export default {
});
// Obtains collection name
this.fetchCollectionName(this.collectionId).then((collectionName) => {
this.collectionName = collectionName;
});
if (!this.isRepositoryLevel) {
this.fetchCollectionName(this.collectionId).then((collectionName) => {
this.collectionName = collectionName;
});
}
}
}
</script>
@ -1280,10 +1281,6 @@ export default {
}
}
#mappers-options-dropdown {
background-color: transparent;
color: #fff;
}
}

View File

@ -10,9 +10,10 @@
$i18n.get('info_showing_items') +
getFirstItem() +
$i18n.get('info_to') +
getLastItemNumber() +
$i18n.get('info_of') + totalItems + '.'
getLastItemNumber() +
$i18n.get('info_of')
}}
<span :class="{ 'has-text-warning': collectionTotalItems > totalItems }">{{ totalItems + '.' }}</span>
</div>
<div class="items-per-page">
<b-field
@ -94,6 +95,20 @@ export default {
},
totalPages(){
return Math.ceil(Number(this.totalItems)/Number(this.itemsPerPage));
},
collectionTotalItems() {
let collectionTotalItemsObject = this.getCollectionTotalItems().total_items;
if (collectionTotalItemsObject) {
switch(this.getStatus()) {
case 'draft':
return collectionTotalItemsObject.draft;
case 'trash':
return collectionTotalItemsObject.trash;
default:
return collectionTotalItemsObject.publish + collectionTotalItemsObject.private;
}
} else
return this.totalItems;
}
},
watch: {
@ -103,11 +118,15 @@ export default {
}
},
methods: {
...mapGetters('collection', [
'getCollectionTotalItems'
]),
...mapGetters('search', [
'getTotalItems',
'getPage',
'getItemsPerPage',
'getPostQuery'
'getPostQuery',
'getStatus'
]),
onChangeItemsPerPage(value) {
if( this.itemsPerPage == value){

View File

@ -29,8 +29,9 @@
v-if="!openAdvancedSearch && !(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].full_screen)"
class="is-hidden-mobile"
id="filter-menu-compress-button"
:style="{ top: !isOnTheme ? (isRepositoryLevel ? '172px' : '120px') : '76px' }"
:aria-label="isFiltersMenuCompressed ? $i18n.get('label_show_filters') : $i18n.get('label_hide_filters')"
:style="{ top: !isOnTheme ? (isRepositoryLevel ? '172px' : '120px') : '76px' }"
@click="isFiltersMenuCompressed = !isFiltersMenuCompressed">
<span class="icon">
<i
@ -45,8 +46,9 @@
v-if="!openAdvancedSearch && !(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].full_screen)"
class="is-hidden-tablet"
id="filter-menu-compress-button-mobile"
:style="{ top: !isOnTheme ? (isRepositoryLevel ? (searchControlHeight + 100) : (searchControlHeight + 70) + 'px') : (searchControlHeight - 25) + 'px' }"
:aria-label="isFiltersMenuCompressed ? $i18n.get('label_show_filters') : $i18n.get('label_hide_filters')"
:style="{ top: !isOnTheme ? (isRepositoryLevel ? (searchControlHeight + 100) : (searchControlHeight + 70) + 'px') : (searchControlHeight - 25) + 'px' }"
@click="isFilterModalActive = !isFilterModalActive">
<span class="icon">
<i
@ -64,7 +66,7 @@
role="region"
aria-labelledby="filters-label-landmark"
:style="{ top: searchControlHeight + 'px' }"
v-if="!isFiltersMenuCompressed &&
v-show="!isFiltersMenuCompressed &&
!openAdvancedSearch &&
!(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].full_screen)"
class="filters-menu tainacan-form is-hidden-mobile">
@ -240,7 +242,7 @@
ref="displayedMetadataDropdown"
:mobile-modal="true"
:disabled="totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry'"
class="show">
class="show metadata-options-dropdown">
<button
:aria-label="$i18n.get('label_displayed_metadata')"
class="button is-white"
@ -277,15 +279,15 @@
<!-- Change OrderBy Select and Order Button-->
<div class="search-control-item">
<b-field>
<label class="label is-hidden-mobile">{{ $i18n.get('label_sorting') + ':' }}</label>
<b-dropdown
:mobile-modal="true"
:disabled="totalItems <= 0"
@input="onChangeOrderBy($event)">
<button
:aria-label="$i18n.get('label_sorting')"
class="button is-white"
slot="trigger">
<span>{{ $i18n.get('label_sorting') }}</span>
<span>{{ orderByName }}</span>
<span class="icon">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" />
</span>
@ -293,12 +295,9 @@
<b-dropdown-item
aria-controls="items-list-results"
role="button"
:class="{ 'is-active': metadatum != undefined && orderBy == metadatum.slug }"
:class="{ 'is-active': (orderBy != 'meta_value' && orderBy != 'meta_value_num' && orderBy == metadatum.slug) || ((orderBy == 'meta_value' || orderBy == 'meta_value_num') && metaKey == metadatum.id) }"
v-for="metadatum of sortingMetadata"
v-if="
totalItems > 0 &&
metadatum != undefined
"
v-if="metadatum != undefined"
:value="metadatum"
:key="metadatum.slug">
{{ metadatum.name }}
@ -326,21 +325,21 @@
<button
aria-controls="items-list-results"
class="button is-white is-small"
:aria-label="$i18n.get('label_sort_ascending')"
:aria-label="$i18n.get('label_sort_descending')"
:disabled="totalItems <= 0 || order == 'DESC'"
@click="onChangeOrder()">
<span class="icon is-small gray-icon">
<i class="tainacan-icon tainacan-icon-sortascending"/>
<i class="tainacan-icon tainacan-icon-sortdescending"/>
</span>
</button>
<button
aria-controls="items-list-results"
:disabled="totalItems <= 0 || order == 'ASC'"
:aria-label="$i18n.get('label_sort_descending')"
:aria-label="$i18n.get('label_sort_ascending')"
class="button is-white is-small"
@click="onChangeOrder()">
<span class="icon is-small gray-icon">
<i class="tainacan-icon tainacan-icon-sortdescending"/>
<i class="tainacan-icon tainacan-icon-sortascending"/>
</span>
</button>
</b-field>
@ -351,20 +350,21 @@
v-if="isOnTheme"
class="search-control-item">
<b-field>
<label class="label is-hidden-mobile">{{ $i18n.get('label_visualization') + ':&nbsp; ' }}</label>
<b-dropdown
@change="onChangeViewMode($event)"
:mobile-modal="true"
position="is-bottom-left"
:aria-label="$i18n.get('label_view_mode')">
<button
:aria-label="$i18n.get('label_view_mode')"
:aria-label="registeredViewModes[viewMode] != undefined ? registeredViewModes[viewMode].label : $i18n.get('label_visualization')"
class="button is-white"
slot="trigger">
<span
class="gray-icon view-mode-icon"
v-if="registeredViewModes[viewMode] != undefined"
v-html="registeredViewModes[viewMode].icon"/>
<span class="is-hidden-touch">&nbsp;&nbsp;&nbsp;{{ $i18n.get('label_visualization') }}</span>
<span class="is-hidden-touch">&nbsp;&nbsp;&nbsp;{{ registeredViewModes[viewMode] != undefined ? registeredViewModes[viewMode].label : $i18n.get('label_visualization') }}</span>
<span class="icon">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" />
</span>
@ -389,6 +389,7 @@
v-if="!isOnTheme"
class="search-control-item">
<b-field>
<label class="label is-hidden-mobile">{{ $i18n.get('label_visualization') + ':' }}</label>
<b-dropdown
@change="onChangeAdminViewMode($event)"
:mobile-modal="true"
@ -399,7 +400,7 @@
class="button is-white"
slot="trigger">
<span>
<span class="icon is-small gray-icon">
<span class="view-mode-icon icon is-small gray-icon">
<i
:class="{'tainacan-icon-viewtable' : ( adminViewMode == 'table' || adminViewMode == undefined),
'tainacan-icon-viewcards' : adminViewMode == 'cards',
@ -409,7 +410,7 @@
class="tainacan-icon"/>
</span>
</span>
&nbsp;&nbsp;&nbsp;{{ $i18n.get('label_visualization') }}
&nbsp;&nbsp;&nbsp;{{ adminViewMode != undefined ? $i18n.get('label_' + adminViewMode) : $i18n.get('label_table') }}
<span class="icon">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" />
</span>
@ -560,7 +561,7 @@
:open-form-advanced-search="openFormAdvancedSearch"
:is-do-search="isDoSearch"/>
<div class="advanced-searh-form-submit">
<div class="advanced-search-form-submit">
<p
v-if="advancedSearchResults"
class="control">
@ -883,6 +884,27 @@
},
showLoading() {
return this.isLoadingItems || this.isLoadingFilters || this.isLoadingMetadata;
},
metaKey() {
return this.getMetaKey();
},
orderByName() {
if (this.getOrderByName() != null && this.getOrderByName() != undefined && this.getOrderByName() != '') {
return this.getOrderByName();
} else {
for (let metadatum of this.sortingMetadata) {
if (
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug == 'creation_date' && (!metadatum.metadata_type_object || !metadatum.metadata_type_object.core)) && this.orderBy == 'date') ||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (metadatum.metadata_type_object != undefined && metadatum.metadata_type_object.core)) && this.orderBy == metadatum.metadata_type_object.related_mapped_prop) ||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (!metadatum.metadata_type_object || !metadatum.metadata_type_object.core)) && this.orderBy == metadatum.slug) ||
((this.orderBy == 'meta_value' || this.orderBy == 'meta_value_num') && this.getMetaKey() == metadatum.id)
)
return metadatum.name;
}
}
}
},
components: {
@ -930,10 +952,12 @@
'getSearchQuery',
'getStatus',
'getOrderBy',
'getOrderByName',
'getOrder',
'getViewMode',
'getTotalItems',
'getAdminViewMode',
'getMetaKey'
]),
onSwipeFiltersMenu($event) {
if (this.registeredViewModes[this.viewMode] == undefined ||
@ -1493,7 +1517,7 @@
}
}
.advanced-searh-form-submit {
.advanced-search-form-submit {
display: flex;
justify-content: flex-end;
padding-right: $page-side-padding;
@ -1653,6 +1677,14 @@
flex-basis: 100%;
}
.label {
font-size: 0.875rem;
font-weight: normal;
margin-top: 3px;
margin-bottom: 2px;
cursor: default;
}
.button {
display: flex;
align-items: center;
@ -1673,8 +1705,9 @@
}
.view-mode-icon {
margin-right: 4px !important;
margin-right: 3px !important;
margin-top: 1px;
margin-left: 6px !important;
}
.dropdown-menu {
@ -1684,7 +1717,7 @@
padding: 0;
.metadata-options-container {
max-height: 240px;
max-height: 288px;
overflow: auto;
}
.dropdown-item {
@ -1696,7 +1729,7 @@
.dropdown-item-apply {
width: 100%;
border-top: 1px solid #efefef;
padding: 8px 12px 2px 12px;
padding: 8px 12px;
text-align: right;
}
.dropdown-item-apply .button {

View File

@ -20,6 +20,7 @@
<!-- Sorting options ---- -->
<b-field class="header-item">
<label class="label">{{ $i18n.get('label_sorting') + ':' }}</label>
<b-select
class="sorting-select"
:disabled="taxonomies.length <= 0"
@ -167,7 +168,7 @@
order: 'asc',
ordeBy: 'date',
sortingOptions: [
{ label: this.$i18n.get('label_title'), value: 'title' },
{ label: this.$i18n.get('label_name'), value: 'title' },
{ label: this.$i18n.get('label_creation_date'), value: 'date' },
]
}
@ -315,6 +316,11 @@
.header-item .button .icon i{
width: 100%;
}
.header-item .label{
font-weight: normal;
font-size: 0.875rem;
margin-top: 3px;
}
@media screen and (max-width: 769px) {
height: 60px;

View File

@ -84,7 +84,9 @@
<span
@click="updateSearch()"
class="icon is-right">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-search"/>
<span class="icon">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-search"/>
</span>
</span>
</div>
</div>
@ -96,7 +98,11 @@
{{ $i18n.get('advanced_search') }}
</button> -->
<h3 class="has-text-weight-semibold">{{ $i18n.get('filters') }}</h3>
<h3
id="filters-label-landmark"
class="has-text-weight-semibold">
{{ $i18n.get('filters') }}
</h3>
<button
v-if="!isLoadingFilters &&
((filters.length >= 0 &&
@ -211,17 +217,26 @@
v-if="!isOnTheme || (registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].dynamic_metadata)"
class="search-control-item">
<b-dropdown
v-tooltip="{
delay: {
show: 500,
hide: 300,
},
content: (totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry') ? (adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry') ? $i18n.get('info_current_view_mode_metadata_not_allowed') : $i18n.get('info_cant_select_metadata_without_items') : '',
autoHide: false,
placement: 'auto-start'
}"
ref="displayedMetadataDropdown"
:mobile-modal="true"
:disabled="totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry'"
class="show">
class="show metadata-options-dropdown">
<button
class="button is-white"
:aria-label="$i18n.get('label_displayed_metadata')"
class="button is-white"
slot="trigger">
<span>{{ $i18n.get('label_displayed_metadata') }}</span>
<span class="icon">
<i class="has-text-secondary tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/>
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/>
</span>
</button>
<div class="metadata-options-container">
@ -251,30 +266,25 @@
<!-- Change OrderBy Select and Order Button-->
<div class="search-control-item">
<b-field>
<label class="label is-hidden-mobile">{{ $i18n.get('label_sorting') + ':' }}</label>
<b-dropdown
:disabled="totalItems <= 0"
:mobile-modal="true"
@input="onChangeOrderBy($event)">
<button
:aria-label="$i18n.get('label_sorting')"
class="button is-white"
slot="trigger">
<span>{{ $i18n.get('label_sorting') }}</span>
<span>{{ orderByName }}</span>
<span class="icon">
<i class="has-text-secondary tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/>
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown "/>
</span>
</button>
<b-dropdown-item
aria-controls="items-list-results"
role="button"
:class="{ 'is-active': metadatum != undefined && orderBy == metadatum.slug }"
:class="{ 'is-active': (orderBy != 'meta_value' && orderBy != 'meta_value_num' && orderBy == metadatum.slug) || ((orderBy == 'meta_value' || orderBy == 'meta_value_num') && metaKey == metadatum.id) }"
v-for="metadatum of sortingMetadata"
v-if="
totalItems > 0 &&
metadatum != undefined &&
metadatum.slug === 'creation_date' || (
metadatum.metadata_type_object &&
metadatum.metadata_type_object.related_mapped_prop == 'title'
)"
v-if="metadatum != undefined"
:value="metadatum"
:key="metadatum.slug">
{{ metadatum.name }}
@ -327,6 +337,7 @@
v-if="isOnTheme"
class="search-control-item">
<b-field>
<label class="label is-hidden-mobile">{{ $i18n.get('label_visualization') + ':&nbsp; ' }}</label>
<b-dropdown
@change="onChangeViewMode($event)"
:mobile-modal="true"
@ -334,15 +345,15 @@
:aria-label="$i18n.get('label_view_mode')">
<button
class="button is-white"
:aria-label="$i18n.get('label_view_mode')"
:aria-label="registeredViewModes[viewMode] != undefined ? registeredViewModes[viewMode].label : $i18n.get('label_visualization')"
slot="trigger">
<span
class="gray-icon view-mode-icon"
v-if="registeredViewModes[viewMode] != undefined"
v-html="registeredViewModes[viewMode].icon"/>
<span class="is-hidden-touch">&nbsp;&nbsp;&nbsp;{{ $i18n.get('label_visualization') }}</span>
<span class="is-hidden-touch">&nbsp;&nbsp;&nbsp;{{ registeredViewModes[viewMode] != undefined ? registeredViewModes[viewMode].label : $i18n.get('label_visualization') }}</span>
<span class="icon">
<i class="has-text-secondary tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/>
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown" />
</span>
</button>
<b-dropdown-item
@ -356,7 +367,7 @@
<span
class="gray-icon"
v-html="registeredViewModes[viewModeOption].icon"/>
{{ registeredViewModes[viewModeOption].label }}
<span>{{ registeredViewModes[viewModeOption].label }}</span>
</b-dropdown-item>
</b-dropdown>
</b-field>
@ -365,6 +376,7 @@
v-if="!isOnTheme"
class="search-control-item">
<b-field>
<label class="label is-hidden-mobile">{{ $i18n.get('label_visualization') + ':' }}</label>
<b-dropdown
@change="onChangeAdminViewMode($event)"
:mobile-modal="true"
@ -375,7 +387,7 @@
:aria-label="$i18n.get('label_view_mode')"
slot="trigger">
<span>
<span class="icon is-small gray-icon">
<span class="view-mode-icon icon is-small gray-icon">
<i
:class="{'tainacan-icon-viewtable' : ( adminViewMode == 'table' || adminViewMode == undefined),
'tainacan-icon-viewcards' : adminViewMode == 'cards',
@ -385,9 +397,9 @@
class="tainacan-icon"/>
</span>
</span>
&nbsp;&nbsp;&nbsp;{{ $i18n.get('label_visualization') }}
&nbsp;&nbsp;&nbsp;{{ adminViewMode != undefined ? $i18n.get('label_' + adminViewMode) : $i18n.get('label_table') }}
<span class="icon">
<i class="has-text-secondary tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/>
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-arrowdown"/>
</span>
</button>
<b-dropdown-item
@ -398,7 +410,7 @@
<span class="icon gray-icon">
<i class="tainacan-icon tainacan-icon-viewtable"/>
</span>
{{ $i18n.get('label_table') }}
<span>{{ $i18n.get('label_table') }}</span>
</b-dropdown-item>
<b-dropdown-item
aria-controls="items-list-results"
@ -408,7 +420,7 @@
<span class="icon gray-icon">
<i class="tainacan-icon tainacan-icon-viewcards"/>
</span>
{{ $i18n.get('label_cards') }}
<span>{{ $i18n.get('label_cards') }}</span>
</b-dropdown-item>
<b-dropdown-item
aria-controls="items-list-results"
@ -418,7 +430,7 @@
<span class="icon gray-icon">
<i class="tainacan-icon tainacan-icon-viewminiature"/>
</span>
{{ $i18n.get('label_thumbnails') }}
<span>{{ $i18n.get('label_thumbnails') }}</span>
</b-dropdown-item>
<b-dropdown-item
aria-controls="items-list-results"
@ -428,7 +440,7 @@
<span class="icon gray-icon">
<i class="tainacan-icon tainacan-icon-viewrecords"/>
</span>
{{ $i18n.get('label_records') }}
<span>{{ $i18n.get('label_records') }}</span>
</b-dropdown-item>
<b-dropdown-item
aria-controls="items-list-results"
@ -438,7 +450,7 @@
<span class="icon gray-icon">
<i class="tainacan-icon tainacan-icon-viewmasonry"/>
</span>
{{ $i18n.get('label_masonry') }}
<span>{{ $i18n.get('label_masonry') }}</span>
</b-dropdown-item>
</b-dropdown>
</b-field>
@ -544,7 +556,7 @@
<button
aria-controls="items-list-results"
@click="advancedSearchResults = !advancedSearchResults"
class="button is-small is-outlined">{{ $i18n.get('edit_search') }}</button>
class="button is-outlined">{{ $i18n.get('edit_search') }}</button>
</p>
<p
v-if="advancedSearchResults"
@ -552,7 +564,7 @@
<button
aria-controls="items-list-results"
@click="isDoSearch = !isDoSearch"
class="button is-small is-secondary">{{ $i18n.get('search') }}</button>
class="button is-success">{{ $i18n.get('search') }}</button>
</p>
</div>
</div>
@ -592,7 +604,7 @@
<h3
id="items-list-landmark"
class="is-hidden">
class="sr-only">
{{ $i18n.get('label_items_list') }}
</h3>
@ -838,6 +850,26 @@
},
showLoading() {
return this.isLoadingItems || this.isLoadingFilters || this.isLoadingMetadata;
},
metaKey() {
return this.getMetaKey();
},
orderByName() {
if (this.getOrderByName() != null && this.getOrderByName() != undefined && this.getOrderByName() != '') {
return this.getOrderByName();
} else {
for (let metadatum of this.sortingMetadata) {
if (
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug == 'creation_date' && (!metadatum.metadata_type_object || !metadatum.metadata_type_object.core)) && this.orderBy == 'date') ||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (metadatum.metadata_type_object != undefined && metadatum.metadata_type_object.core)) && this.orderBy == metadatum.metadata_type_object.related_mapped_prop) ||
((this.orderBy != 'meta_value' && this.orderBy != 'meta_value_num' && metadatum.slug != 'creation_date' && (!metadatum.metadata_type_object || !metadatum.metadata_type_object.core)) && this.orderBy == metadatum.slug) ||
((this.orderBy == 'meta_value' || this.orderBy == 'meta_value_num') && this.getMetaKey() == metadatum.id)
)
return metadatum.name;
}
}
}
},
components: {
@ -882,10 +914,12 @@
'getSearchQuery',
'getStatus',
'getOrderBy',
'getOrderByName',
'getOrder',
'getViewMode',
'getTotalItems',
'getAdminViewMode'
'getAdminViewMode',
'getMetaKey'
]),
onSwipeFiltersMenu($event) {
if (this.registeredViewModes[this.viewMode] == undefined ||
@ -965,7 +999,8 @@
// Updates searchControlHeight before in case we need to adjust filters position on mobile
setTimeout(() => {
this.searchControlHeight = this.$refs['search-control'].clientHeight;
if (this.$refs['search-control'] != undefined)
this.searchControlHeight = this.$refs['search-control'].clientHeight;
}, 500);
},
onChangeDisplayedMetadata() {
@ -988,12 +1023,11 @@
// Updates Search
this.$eventBusSearch.addFetchOnly(
thumbnailMetadatum != undefined && thumbnailMetadatum.display ? 'thumbnail' : null +','+
creationDateMetadatum != undefined && creationDateMetadatum.display ? 'creation_date' : null +','+
authorNameMetadatum != undefined && authorNameMetadatum.display ? 'author_name': null +','+
(this.isRepositoryLevel ? 'title' : null) +','+
(this.isRepositoryLevel && descriptionMetadatum.display ? 'description' : null)
, false, fetchOnlyMetadatumIds.toString());
((thumbnailMetadatum != undefined && thumbnailMetadatum.display) ? 'thumbnail' : null) + ',' +
((creationDateMetadatum != undefined && creationDateMetadatum.display) ? 'creation_date' : null) + ',' +
((authorNameMetadatum != undefined && authorNameMetadatum.display) ? 'author_name': null) + ',' +
(this.isRepositoryLevel ? 'title' : null) + ',' +
(this.isRepositoryLevel && descriptionMetadatum.display ? 'description' : null), false, fetchOnlyMetadatumIds.toString());
// Closes dropdown
this.$refs.displayedMetadataDropdown.toggle();
@ -1118,10 +1152,20 @@
multiple: metadatum.multiple,
});
if (display)
fetchOnlyMetadatumIds.push(metadatum.id);
if (display) {
fetchOnlyMetadatumIds.push(metadatum.id);
}
if (
metadatum.metadata_type != 'Tainacan\\Metadata_Types\\Core_Description' &&
metadatum.metadata_type != 'Tainacan\\Metadata_Types\\Taxonomy' &&
metadatum.metadata_type != 'Tainacan\\Metadata_Types\\Relationship'
) {
this.sortingMetadata.push(metadatum);
}
}
this.sortingMetadata.push(metadatum);
}
let creationDateMetadatumDisplay = prefsFetchOnlyObject ? (prefsFetchOnlyObject[1] != null) : true;
@ -1186,7 +1230,7 @@
display: authorNameMetadatumDisplay
});
}
// Loads only basic attributes necessay to view modes that do not allow custom meta
// Loads only basic attributes necessary to view modes that do not allow custom meta
} else {
this.$eventBusSearch.addFetchOnly('thumbnail,creation_date,author_name,title,description', true, '');
@ -1219,13 +1263,14 @@
this.isLoadingMetadata = false;
});
},
adjustSearchControlHeight: _.debounce( function() {
this.$nextTick(() => {
this.searchControlHeight = this.$refs['search-control'] ? this.$refs['search-control'].clientHeight : 0;
this.isFiltersMenuCompressed = jQuery(window).width() <= 768;
});
}, 500)
},
adjustSearchControlHeight: _.debounce( function() {
this.$nextTick(() => {
if (this.$refs['search-control'] != undefined)
this.searchControlHeight = this.$refs['search-control'] ? this.$refs['search-control'].clientHeight + this.$refs['search-control'].offsetTop : 0;
this.isFiltersMenuCompressed = jQuery(window).width() <= 768;
});
}, 500),
removeEventListeners() {
// Component
this.$off();
@ -1238,6 +1283,7 @@
this.$eventBusSearch.$off('hasFiltered');
this.$eventBusSearch.$off('advancedSearchResults');
this.$eventBusSearch.$off('hasToPrepareMetadataAndFilters');
},
created() {
@ -1316,7 +1362,7 @@
} else {
let prefsAdminViewMode = !this.isRepositoryLevel ? 'admin_view_mode_' + this.collectionId : 'admin_view_mode';
if (this.$userPrefs.get(prefsAdminViewMode) == undefined)
this.$eventBusSearch.setInitialAdminViewMode('cards');
this.$eventBusSearch.setInitialAdminViewMode('table');
else {
let existingViewMode = this.$userPrefs.get(prefsAdminViewMode);
if (existingViewMode == 'cards' ||
@ -1326,7 +1372,7 @@
existingViewMode == 'masonry')
this.$eventBusSearch.setInitialAdminViewMode(this.$userPrefs.get(prefsAdminViewMode));
else
this.$eventBusSearch.setInitialAdminViewMode('cards');
this.$eventBusSearch.setInitialAdminViewMode('table');
}
}
@ -1340,6 +1386,7 @@
// Cancels previous Request
if (this.$eventBusSearch.searchCancel != undefined)
this.$eventBusSearch.searchCancel.cancel('Item search Canceled.');
}
}
</script>
@ -1348,6 +1395,16 @@
@import '../../scss/_variables.scss';
@keyframes open-full-screen {
from {
opacity: 0;
transform: scale(0.6);
}
to {
opacity: 1;
transform: scale(1.0);
}
}
.is-fullscreen {
position: absolute;
@ -1359,7 +1416,8 @@
height: 100vh;
z-index: 999999999;
background-color: black;
transition: all 0.3s ease;
transition: background-color 0.3s ease, width 0.3s ease, height 0.3s ease;
animation: open-full-screen 0.4s ease;
}
.collapse-all {
@ -1374,9 +1432,9 @@
h1, h2 {
font-size: 20px;
font-weight: 500;
margin-bottom: 0;
color: $gray5;
display: inline-block;
margin-bottom: 0;
}
.field.is-grouped {
margin-left: auto;
@ -1400,9 +1458,9 @@
h1, h2 {
font-size: 20px;
font-weight: 500;
margin-bottom: 0;
color: $gray5;
display: inline-block;
margin-bottom: 0;
}
.field.is-grouped {
margin-left: auto;
@ -1569,6 +1627,14 @@
flex-basis: 100%;
}
.label {
font-size: 0.875rem;
font-weight: normal;
margin-top: 3px;
margin-bottom: 2px;
cursor: default;
}
.button {
display: flex;
align-items: center;
@ -1582,7 +1648,6 @@
color: $gray4 !important;
padding-right: 10px;
}
.gray-icon .icon i::before,
.gray-icon i::before {
font-size: 1.3125rem !important;
@ -1590,8 +1655,9 @@
}
.view-mode-icon {
margin-right: 4px !important;
margin-right: 3px !important;
margin-top: 1px;
margin-left: 6px !important;
}
.dropdown-menu {
@ -1601,7 +1667,7 @@
padding: 0;
.metadata-options-container {
max-height: 240px;
max-height: 288px;
overflow: auto;
}
.dropdown-item {
@ -1613,7 +1679,7 @@
.dropdown-item-apply {
width: 100%;
border-top: 1px solid #efefef;
padding: 8px 12px 2px 12px;
padding: 8px 12px;
text-align: right;
}
.dropdown-item-apply .button {

View File

@ -467,10 +467,12 @@
this.loadMetadata();
});
// Obtains collection name
// Obtains collection name
if (!this.isRepositoryLevel) {
this.fetchCollectionName(this.collectionId).then((collectionName) => {
this.collectionName = collectionName;
});
}
// Get attachments
this.fetchAttachments(this.itemId);

View File

@ -21,9 +21,13 @@
padding: 0px;
border-radius: 0px;
min-width: 6rem;
.dropdown-content {
padding: 6px 0px;
padding: 0px;
border-radius: 0px !important;
max-height: 240px;
overflow-y: auto;
.dropdown-item {
display: block;
text-decoration: none;
@ -67,6 +71,13 @@
}
}
// This dropdown has a particular way of dealing with scroll
.metadata-options-dropdown {
.dropdown-content {
max-height: unset !important;
}
}
.taginput-container {
padding: 0px !important;
background-color: white !important;

View File

@ -28,6 +28,9 @@
.is-has-text-secondary:focus {
color: $blue3 !important;
}
a.button.is-secondary {
color: white !important;
}
.tainacan-page-title hr{
background-color: $blue3 !important;
}

View File

@ -115,7 +115,10 @@
this.isLoading = true;
this.options = [];
let query_items = { 'current_query': this.query };
let query_items = {
'current_query': this.query,
'search': query
};
let endpoint = this.isRepositoryLevel ? '/facets/' + this.metadatum : '/collection/'+ this.collection +'/facets/' + this.metadatum;

View File

@ -10,13 +10,7 @@ class Oaipmh_Importer extends Importer {
'name' => 'Create Collections',
'progress_label' => 'Create Collections',
'callback' => 'create_collections'
],
[
'name' => 'Import Items',
'progress_label' => 'Import Items',
'callback' => 'process_collections'
]
];
protected $tainacan_api_address, $wordpress_api_address, $actual_collection;
@ -34,7 +28,6 @@ class Oaipmh_Importer extends Importer {
$this->remove_import_method('file');
$this->add_import_method('url');
$this->tainacan_api_address = "/wp-json/tainacan/v1/oai";
}
@ -43,7 +36,7 @@ class Oaipmh_Importer extends Importer {
* @return int
*/
public function process_item( $index, $collection_id ){
return true;
}
/**
@ -58,17 +51,19 @@ class Oaipmh_Importer extends Importer {
if( isset($collection_xml->ListSets) ){
foreach ($collection_xml->ListSets->set as $set) {
$setSpec = $set->setSpec;
$setName = $set->setName;
$setSpec = (string) $set->setSpec;
$setName = (string) $set->setName;
$collection = $this->create_collection( $setSpec, $setName );
$metadata_map = $this->create_collection_metadata($collection);
$total = intval($this->get_total_items_from_source($setSpec));
$this->add_log('total in collection: ' . $total);
$this->add_collection([
'id' => $collection->get_id(),
'mapping' => $metadata_map,
'total_items' => intval($this->get_total_items_from_source($setSpec)),
'total_items' => $total,
'source_id' => $setSpec
]);
}
@ -87,6 +82,7 @@ class Oaipmh_Importer extends Importer {
$info = $this->requester( $this->get_url() . "?verb=ListRecords&metadataPrefix=oai_dc&set=" . $setSpec);
if( !isset($info['body']) ){
$this->add_log('ERROR');
$this->add_error_log('Error in fetch remote total items');
$this->abort();
return false;
@ -96,22 +92,28 @@ class Oaipmh_Importer extends Importer {
$xml = new \SimpleXMLElement($info['body']);
if( isset($xml->ListRecords) && !isset($xml->ListRecords->resumptionToken) ){
$this->add_log('NO resumptiontoken ');
$cont = 0;
foreach ($xml->ListRecords->record as $record) $cont++;
return $cont;
} elseif ( isset($xml->ListRecords) && !isset($xml->ListRecords->resumptionToken) ){
$resumptionToken_attributes = $xml->ListRecords->resumptionToken->attributes();
foreach ($resumptionToken_attributes as $tag => $attribute) {
$this->add_log('resumptiontoken: ' . (string) $tag . ' ' . (string) $attribute );
if ($tag == 'completeListSize') {
return (string) $attribute;
}
}
}
} catch (Exception $e) {
$this->add_log('ERROR');
return 0;
}
$this->add_log('SKIP');
return 0;
}
@ -150,7 +152,7 @@ class Oaipmh_Importer extends Importer {
* @throws \ErrorException
*/
protected function create_collection_metadata( $collection_object ){
$Tainacan_Mappers = \Tainacan\Repositories\Mappers::get_instance();
$Tainacan_Mappers = \Tainacan\Mappers_Handler::get_instance();
$mapper_obj = $Tainacan_Mappers->check_class_name('dublin-core', true, $Tainacan_Mappers::MAPPER_CLASS_PREFIX);
$mapper = new $mapper_obj;
$array_metadata = [];
@ -173,7 +175,8 @@ class Oaipmh_Importer extends Importer {
$_meta_mapping[$mapper->slug] = $slug;
$core_meta->set_exposer_mapping($_meta_mapping);
if ($core_meta->validate()) {
$Tainacan_Metadata->insert($core_meta);
$new_metadata = $Tainacan_Metadata->insert($core_meta);
$array_metadata[$new_metadata->get_id()] = $slug;
}
}
continue;
@ -201,7 +204,7 @@ class Oaipmh_Importer extends Importer {
if($metadatum->validate()){
$new_metadata = $Tainacan_Metadata->insert($metadatum);
$array_metadata[$new_metadata->get_id()] = $mapper_metadatum['label'];
$array_metadata[$new_metadata->get_id()] = $slug;
}
}
}

View File

@ -773,9 +773,6 @@ class Old_Tainacan extends Importer{
/*Properties of metadatum*/
if(isset($meta->metadata)){
if($meta->metadata->required == 1){
$newMetadatum->set_required(true);
}
if(!empty($meta->metadata->default_value)){
$newMetadatum->set_default_value($meta->metadata->default_value);

View File

@ -47,7 +47,7 @@ export default {
},
watch: {
'$route' (to, from) {
// Should set Collection ID from URL only when in admin.
if (this.$route.name == 'CollectionItemsPage' || this.$route.name == 'ItemsPage')
this.collectionId = !this.$route.params.collectionId ? this.$route.params.collectionId : parseInt(this.$route.params.collectionId);
@ -84,7 +84,7 @@ export default {
this.$userPrefs.set(orderKey, 'DESC');
}
}
// Order By (required extra work to deal with custom metadata ordering)
if (this.$route.query.orderby == undefined || to.params.collectionId != from.params.collectionId) {
let orderByKey = (this.collectionId != undefined ? 'order_by_' + this.collectionId : 'order_by');
@ -92,23 +92,22 @@ export default {
if (orderBy) {
if (orderBy.slug == 'creation_date') {
this.$route.query.orderby = 'date';
this.$route.query.orderby = 'date';
} else if (orderBy.slug == 'author_name') {
this.$route.query.orderby = 'author_name';
this.$route.query.orderby = 'author_name';
} else if (orderBy.metadata_type_object.primitive_type == 'float' || orderBy.metadata_type_object.primitive_type == 'int') {
this.$route.query.orderby = 'meta_value_num';
this.$route.query.meta_key = orderBy.id;
this.$route.query.orderby = 'meta_value_num';
this.$route.query.meta_key = orderBy.id;
} else if (orderBy.metadata_type_object.primitive_type == 'date') {
this.$route.query.orderby = 'meta_value';
this.$route.query.meta_key = orderBy.id;
this.$route.query.meta_type = 'DATETIME';
this.$route.query.orderby = 'meta_value';
this.$route.query.meta_key = orderBy.id;
this.$route.query.meta_type = 'DATETIME';
} else if (orderBy.metadata_type_object.core) {
this.$route.query.orderby = orderBy.metadata_type_object.related_mapped_prop;
this.$route.query.orderby = orderBy.metadata_type_object.related_mapped_prop;
} else {
this.$route.query.orderby = 'meta_value';
this.$route.query.meta_key = orderBy.id;
this.$route.query.orderby = 'meta_value';
this.$route.query.meta_key = orderBy.id;
}
this.$route.query.orderby = orderBy.slug;
} else {
this.$route.query.orderby = 'date';

View File

@ -85,22 +85,32 @@ export const setOrderBy = ({ state, commit }, orderBy ) => {
// Primitive Types: string, date, item, term, compound, float
if (orderBy.slug == 'creation_date') {
commit('setPostQueryAttribute', { attr: 'orderby', value: 'date' } );
commit('removePostQueryAttribute', 'meta_key');
commit('removePostQueryAttribute', 'meta_type');
} else if (orderBy.slug == 'author_name') {
commit('setPostQueryAttribute', { attr: 'orderby', value: 'author_name' } );
commit('removePostQueryAttribute', 'meta_key');
commit('removePostQueryAttribute', 'meta_type');
} else if (orderBy.metadata_type_object.primitive_type == 'float' || orderBy.metadata_type_object.primitive_type == 'int') {
commit('setPostQueryAttribute', { attr: 'metakey', value: orderBy.id } );
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value_num' } );
commit('setPostQueryAttribute', { attr: 'meta_key', value: orderBy.id } );
commit('removePostQueryAttribute', 'meta_type');
} else if (orderBy.metadata_type_object.primitive_type == 'date') {
commit('setPostQueryAttribute', { attr: 'metakey', value: orderBy.id } );
commit('setPostQueryAttribute', { attr: 'metatype', value: 'DATETIME' } );
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } );
commit('setPostQueryAttribute', { attr: 'meta_key', value: orderBy.id } );
commit('setPostQueryAttribute', { attr: 'meta_type', value: 'DATETIME' } );
} else if (orderBy.metadata_type_object.core) {
commit('setPostQueryAttribute', { attr: 'orderby', value: orderBy.metadata_type_object.related_mapped_prop } );
commit('removePostQueryAttribute', 'meta_key');
commit('removePostQueryAttribute', 'meta_type');
} else {
commit('setPostQueryAttribute', { attr: 'metakey', value: orderBy.id } );
commit('setPostQueryAttribute', { attr: 'orderby', value: 'meta_value' } );
commit('setPostQueryAttribute', { attr: 'meta_key', value: orderBy.id } );
commit('removePostQueryAttribute', 'meta_type');
}
commit('setOrderByName', orderBy.name);
};
export const setOrder = ({ commit }, order ) => {

View File

@ -64,6 +64,14 @@ export const getFetchOnly = state => {
return state.postquery.fetch_only;
};
export const getOrderByName = state => {
return state.orderByName;
};
export const getMetaKey = state => {
return state.postquery.meta_key;
};
export const getFetchOnlyMeta = state => {
return ( ! state.postquery.fetch_only_meta ) ? '' : state.postquery.fetch_only_meta;
};

View File

@ -22,7 +22,8 @@ const state = {
totalItems: 0,
totalPages: 0,
itemsPerPage: 12, // Not the same as postquery.perpage as API may have limited it's value
facets: {}
facets: {},
orderByName: ''
};
export default {

View File

@ -143,6 +143,10 @@ export const setAdminViewMode = ( state, adminViewMode ) => {
state.postquery.admin_view_mode = adminViewMode;
};
export const setOrderByName = ( state, orderByName ) => {
state.orderByName = orderByName;
};
export const addFilterTag = ( state, filterTag ) => {
state.filter_tags = ( ! state.filter_tags) ? [] : state.filter_tags;