First updates to support breaking changes on Vue Router and Vuex, at least in the admin build. #794.

This commit is contained in:
mateuswetah 2023-07-10 18:04:58 -03:00
parent d3491e91cf
commit b3e834e73c
23 changed files with 271 additions and 258 deletions

23
package-lock.json generated
View File

@ -1939,6 +1939,11 @@
"@vue/shared": "3.3.4"
}
},
"@vue/devtools-api": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.0.tgz",
"integrity": "sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q=="
},
"@vue/reactivity": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.3.4.tgz",
@ -6879,9 +6884,12 @@
}
},
"vue-router": {
"version": "3.6.5",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.6.5.tgz",
"integrity": "sha512-VYXZQLtjuvKxxcshuRAwjHnciqZVoXAjTjcqBTz4rKc8qih9g9pI3hbDjmqXaHdgL3v8pV6P8Z335XvHzESxLQ=="
"version": "4.2.4",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.2.4.tgz",
"integrity": "sha512-9PISkmaCO02OzPVOMq2w82ilty6+xJmQrarYZDkjZBfl4RvYAlt4PKnEX21oW4KTtWfa9OuO/b3qk1Od3AEdCQ==",
"requires": {
"@vue/devtools-api": "^6.5.0"
}
},
"vue-the-mask": {
"version": "0.11.1",
@ -6902,9 +6910,12 @@
}
},
"vuex": {
"version": "3.6.2",
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz",
"integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw=="
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/vuex/-/vuex-4.1.0.tgz",
"integrity": "sha512-hmV6UerDrPcgbSy9ORAtNXDr9M4wlNP4pEFKye4ujJF8oqgFFuxDCdOLS3eNoRTtq5O3hoBDh9Doj1bQMYHRbQ==",
"requires": {
"@vue/devtools-api": "^6.0.0-beta.11"
}
},
"watchpack": {
"version": "2.4.0",

View File

@ -32,11 +32,11 @@
"vue-apexcharts": "^1.6.2",
"vue-blurhash": "^0.1.4",
"vue-countup-v2": "^4.0.0",
"vue-router": "^3.6.5",
"vue-router": "^4.2.4",
"vue-the-mask": "^0.11.1",
"vue2-leaflet": "^2.7.1",
"vuedraggable": "^2.24.3",
"vuex": "^3.6.2"
"vuex": "^4.1.0"
},
"devDependencies": {
"@babel/core": "^7.21.0",

View File

@ -121,7 +121,6 @@
</b-select>
<router-link
v-if="$userCaps.hasCapability('tnc_rep_edit_collections')"
tag="a"
style="font-size: 0.875em;"
class="add-link"
:to="{ path: $routerHelper.getNewCollectionPath(), query: { fromImporter: true }}">

View File

@ -11,16 +11,12 @@
<hr>
<nav class="breadcrumbs">
<router-link
tag="a"
:to="$routerHelper.getCollectionsPath()">{{ $i18n.get('repository') }}</router-link> >
<router-link
tag="a"
:to="$routerHelper.getAvailableImportersPath()">{{ $i18n.get('importers') }}</router-link> >
<router-link
tag="a"
:to="$routerHelper.getImporterPath(importerType, sessionId)">{{ importerType != undefined ? (importerName != undefined ? importerName :importerType) : $i18n.get('title_importer_page') }}</router-link> >
<router-link
tag="a"
:to="$routerHelper.getImporterMappingPath(importerType, sessionId, collectionId)">{{ $i18n.get('label_metadata_mapping') }}</router-link>
</nav>

View File

@ -7,7 +7,6 @@
class="new-collection-menu">
<li>
<router-link
tag="a"
:to="$routerHelper.getNewCollectionPath()"
class="first-card">
<div class="list-metadata">
@ -20,7 +19,6 @@
</li>
<li>
<router-link
tag="a"
:to="{ path: $routerHelper.getNewCollectionPath() }"
:aria-label="$i18n.get('label_collection_items')">
<span
@ -38,7 +36,6 @@
</li>
<li>
<router-link
tag="a"
:to="{ path: $routerHelper.getNewCollectionPath() }"
:aria-label="$i18n.get('label_collection_metadata')">
<span
@ -56,7 +53,6 @@
</li>
<li>
<router-link
tag="a"
:to="{ path: $routerHelper.getNewCollectionPath() }"
:aria-label="$i18n.get('label_collection_filters')">
<span
@ -76,7 +72,6 @@
<ul v-if="collections.length > 0 && !isLoading">
<li v-if="!$adminOptions.hideHomeCollectionCreateNewButton && $userCaps.hasCapability('tnc_rep_edit_collections')">
<router-link
tag="a"
:to="$routerHelper.getNewCollectionPath()"
class="tainacan-card new-card">
<div class="list-metadata">
@ -88,7 +83,6 @@
<ul class="menu-list">
<li>
<router-link
tag="a"
:to="{ path: $routerHelper.getNewCollectionPath() }"
:aria-label="$i18n.get('label_collection_items')">
<span
@ -105,7 +99,6 @@
</li>
<li>
<router-link
tag="a"
:to="{ path: $routerHelper.getNewCollectionPath() }"
:aria-label="$i18n.get('label_collection_metadata')">
<span
@ -122,7 +115,6 @@
</li>
<li>
<router-link
tag="a"
:to="{ path: $routerHelper.getNewCollectionPath() }"
:aria-label="$i18n.get('label_collection_filters')">
<span
@ -148,7 +140,6 @@
<ul class="menu-list">
<li>
<router-link
tag="a"
:to="{ path: $routerHelper.getCollectionItemsPath(collection.id, '') }"
:aria-label="$i18n.get('label_collection_items')">
<span
@ -165,7 +156,6 @@
</li>
<li v-if="collection.current_user_can_edit_items && $adminOptions.showHomeCollectionCreateItemButton">
<router-link
tag="a"
:to="{ path: $routerHelper.getNewItemPath(collection.id) }"
:aria-label="$i18n.get('add_one_item')">
<span
@ -182,7 +172,6 @@
</li>
<li v-if="collection.current_user_can_edit && !$adminOptions.hideHomeCollectionSettingsButton">
<router-link
tag="a"
:to="{ path: $routerHelper.getCollectionEditPath(collection.id) }"
:aria-label="$i18n.get('label_settings')">
<span
@ -199,7 +188,6 @@
</li>
<li v-if="collection.current_user_can_edit_metadata && !$adminOptions.hideHomeCollectionMetadataButton">
<router-link
tag="a"
:to="{ path: $routerHelper.getCollectionMetadataPath(collection.id) }"
:aria-label="$i18n.get('label_collection_metadata')">
<span
@ -216,7 +204,6 @@
</li>
<li v-if="collection.current_user_can_edit_filters && !$adminOptions.hideHomeCollectionFiltersButton">
<router-link
tag="a"
:to="{ path: $routerHelper.getCollectionFiltersPath(collection.id) }"
:aria-label="$i18n.get('label_collection_filters')">
<span
@ -233,7 +220,6 @@
</li>
<li v-if="$userCaps.hasCapability('tnc_rep_read_logs') && !$adminOptions.hideHomeCollectionActivitiesButton">
<router-link
tag="a"
:to="{ path: $routerHelper.getCollectionActivitiesPath(collection.id) }"
:aria-label="$i18n.get('label_collection_activities')">
<span
@ -266,7 +252,6 @@
</li>
</ul>
<router-link
tag="a"
:to="$routerHelper.getCollectionPath(collection.id)"
class="card-body">
<img

View File

@ -12,7 +12,6 @@
v-if="!$adminOptions.hidePrimaryMenuRepositoryButton"
class="repository-label">
<router-link
tag="a"
:to="$routerHelper.getCollectionsPath()"
:aria-label="$i18n.get('repository')">
<span v-if="!isMenuCompressed">{{ $i18n.get('repository') }}</span>
@ -25,7 +24,6 @@
</li>
<li v-if="!$adminOptions.hidePrimaryMenuCollectionsButton">
<router-link
tag="a"
:to="$routerHelper.getCollectionsPath()"
:class="activeRoute == 'CollectionsPage' || $route.params.collectionId != undefined ? 'is-active':''">
<span class="icon">
@ -36,7 +34,6 @@
</li>
<li v-if="!$adminOptions.hidePrimaryMenuItemsButton">
<router-link
tag="a"
:to="$routerHelper.getItemsPath()"
:class="activeRoute == 'ItemsPage' ? 'is-active':''">
<span class="icon">
@ -48,7 +45,6 @@
<li class="separator"/>
<li v-if="$userCaps.hasCapability('tnc_rep_edit_metadata') && !$adminOptions.hidePrimaryMenuMetadataButton">
<router-link
tag="a"
to="/metadata"
:class="activeRoute == 'MetadataPage' ? 'is-active':''">
<span class="icon">
@ -59,7 +55,6 @@
</li>
<li v-if="$userCaps.hasCapability('tnc_rep_edit_filters') && !$adminOptions.hidePrimaryMenuFiltersButton">
<router-link
tag="a"
to="/filters"
:class="activeRoute == 'FiltersPage' ? 'is-active':''">
<span class="icon">
@ -70,7 +65,6 @@
</li>
<li v-if="!$adminOptions.hidePrimaryMenuTaxonomiesButton">
<router-link
tag="a"
to="/taxonomies"
:class="activeRoute == 'Page' ? 'is-active':''">
<span class="icon">
@ -81,7 +75,6 @@
</li>
<li v-if="!$adminOptions.hidePrimaryMenuActivitiesButton">
<router-link
tag="a"
to="/activities"
:class="activeRoute == 'ActivitiesPage' ? 'is-active':''">
<span class="icon">
@ -94,7 +87,6 @@
class="is-hidden-mobile"
v-if="$userCaps.hasCapability('tnc_rep_edit_users') && !$adminOptions.hidePrimaryMenuCapabilitiesButton">
<router-link
tag="a"
:to="$routerHelper.getCapabilitiesPath()"
:class="activeRoute == 'CapabilitiesPage' ? 'is-active':''">
<span class="icon">
@ -105,7 +97,6 @@
</li>
<li v-if="!$adminOptions.hidePrimaryMenuImportersButton">
<router-link
tag="a"
to="/importers"
:class="(
activeRoute == 'AvailableImportersPage' ||
@ -120,7 +111,6 @@
</li>
<li v-if="!$adminOptions.hidePrimaryMenuExportersButton">
<router-link
tag="a"
to="/exporters"
:class="(
activeRoute == 'ExportersPage' ||

View File

@ -7,12 +7,18 @@
<router-link
v-if="activeRoute == 'ItemPage' || activeRoute == 'ItemEditionForm' || activeRoute == 'ItemCreatePage'"
:to="{ path: collection && collection.id ? $routerHelper.getCollectionItemsPath(collection.id, '') : '', query: activeRoute == 'CollectionItemsPage' ? $route.query : '' }"
class="button is-turquoise4"
tag="button"
:aria-label="$i18n.get('back')">
<span class="icon">
<i class="tainacan-icon tainacan-icon-previous"/>
</span>
custom
v-slot="{ navigate }">
<button
@click="navigate()"
role="link"
:aria-label="$i18n.get('back')"
type="button"
class="button is-turquoise4">
<span class="icon">
<i class="tainacan-icon tainacan-icon-previous"/>
</span>
</button>
</router-link>
</div>
<div class="level">
@ -21,12 +27,18 @@
<router-link
v-if="activeRoute == 'ItemPage' || activeRoute == 'ItemEditionForm' || activeRoute == 'ItemCreatePage'"
:to="{ path: collection && collection.id ? $routerHelper.getCollectionItemsPath(collection.id, '') : '', query: activeRoute == 'CollectionItemsPage' ? $route.query : '' }"
class="button is-turquoise4"
tag="button"
:aria-label="$i18n.get('back')">
<span class="icon">
<i class="tainacan-icon tainacan-icon-previous"/>
</span>
custom
v-slot="{ navigate }">
<button
@click="navigate()"
role="link"
:aria-label="$i18n.get('back')"
type="button"
class="button is-turquoise4">
<span class="icon">
<i class="tainacan-icon tainacan-icon-previous"/>
</span>
</button>
</router-link>
</div>
</div>
@ -36,7 +48,6 @@
:class="activeRoute == 'ItemPage' || activeRoute == 'CollectionItemsPage' || activeRoute == 'ItemEditionForm' || activeRoute == 'ItemCreatePage' ? 'is-active':''"
class="level-item">
<router-link
tag="a"
:to="{ path: collection && collection.id ? $routerHelper.getCollectionItemsPath(collection.id, '') : '', query: activeRoute == 'CollectionItemsPage' ? $route.query : '' }"
:aria-label="$i18n.get('label_collection_items')">
<span class="icon">
@ -50,7 +61,6 @@
:class="activeRoute == 'CollectionEditionForm' ? 'is-active':''"
class="level-item">
<router-link
tag="a"
:to="{ path: collection && collection.id ? $routerHelper.getCollectionEditPath(collection.id) : '' }"
:aria-label="$i18n.get('label_settings')">
<span class="icon">
@ -65,7 +75,6 @@
:class="activeRoute == 'CollectionMetadataPage' ? 'is-active':''"
class="level-item">
<router-link
tag="a"
:to="{ path: collection && collection.id ? $routerHelper.getCollectionMetadataPath(collection.id) : '' }"
:aria-label="$i18n.get('label_collection_metadata')">
<span class="icon">
@ -79,7 +88,6 @@
:class="activeRoute == 'CollectionFiltersPage' ? 'is-active':''"
class="level-item">
<router-link
tag="a"
:to="{ path: collection && collection.id ? $routerHelper.getCollectionFiltersPath(collection.id) : ''}"
:aria-label="$i18n.get('label_collection_filters')">
<span class="icon">
@ -93,7 +101,6 @@
:class="activeRoute == 'CollectionActivitiesPage' ? 'is-active':''"
class="level-item">
<router-link
tag="a"
:to="{ path: collection && collection.id ? $routerHelper.getCollectionActivitiesPath(collection.id) : '' }"
:aria-label="$i18n.get('label_collection_activities')">
<span class="icon">
@ -107,7 +114,6 @@
:class="activeRoute == 'CollectionCapabilitiesPage' ? 'is-active':''"
class="level-item is-hidden-mobile">
<router-link
tag="a"
:to="{ path: collection && collection.id ? $routerHelper.getCollectionCapabilitiesPath(collection.id) : '' }"
:aria-label="$i18n.get('label_collection_capabilities')">
<span class="icon">

View File

@ -7,7 +7,6 @@
v-if="!$adminOptions.hideTainacanHeaderHomeButton"
class="level-item home-area">
<router-link
tag="a"
to="/"
:aria-label="$i18n.get('label_plugin_home_page')">
<span
@ -24,7 +23,6 @@
</div>
<div class="level-item logo-area">
<router-link
tag="a"
to="/"
:aria-label="$i18n.get('label_plugin_home_page')">
<h1>

View File

@ -10,12 +10,18 @@
<router-link
v-if="activeRoute == 'ItemPage' || activeRoute == 'ItemEditionForm' || activeRoute == 'ItemCreatePage'"
:to="{ path: collection && collection.id ? $routerHelper.getCollectionItemsPath(collection.id, '') : '', query: activeRoute == 'CollectionItemsPage' ? $route.query : '' }"
class="button is-turquoise4"
tag="button"
:aria-label="$i18n.get('back')">
<span class="icon">
<i class="tainacan-icon tainacan-icon-previous"/>
</span>
custom
v-slot="{ navigate }">
<button
role="link"
class="button is-turquoise4"
type="button"
:aria-label="$i18n.get('back')"
@click="navigate()">
<span class="icon">
<i class="tainacan-icon tainacan-icon-previous"/>
</span>
</button>
</router-link>
</div>

View File

@ -14,16 +14,13 @@
<nav
v-if="isRepositoryLevel"
class="breadcrumbs">
<router-link
tag="a"
:to="$routerHelper.getCollectionsPath()">{{ $i18n.get('repository') }}</router-link>
<router-link :to="$routerHelper.getCollectionsPath()">{{ $i18n.get('repository') }}</router-link>
<template
v-for="(breadCrumbItem, index) of breadCrumbItems"
:key="index">
<span>&nbsp;>&nbsp;</span>
<router-link
v-if="breadCrumbItem.path != ''"
tag="a"
:to="breadCrumbItem.path">{{ breadCrumbItem.label }}</router-link>
<span v-else>{{ breadCrumbItem.label }}</span>
</template>
@ -32,15 +29,12 @@
v-else
class="breadcrumbs">
<router-link
tag="a"
:to="$routerHelper.getCollectionsPath()">{{ $i18n.get('repository') }}</router-link>
&nbsp;>&nbsp;
<router-link
tag="a"
:to="$routerHelper.getCollectionsPath()">{{ $i18n.get('collections') }}</router-link>
&nbsp;>&nbsp;
<router-link
tag="a"
:to="{ path: collectionBreadCrumbItem.url, query: { fromBreadcrumb: true }}">{{ collectionBreadCrumbItem.name }}</router-link>
<template
v-for="(childBreadCrumbItem, index) of childrenBreadCrumbItems"
@ -48,7 +42,6 @@
<span>&nbsp;>&nbsp;</span>
<router-link
v-if="childBreadCrumbItem.path != ''"
tag="a"
:to="{ path: childBreadCrumbItem.path, query: index === $i18n.get('items') ? { fromBreadcrumb: true } : null }">{{ childBreadCrumbItem.label }}</router-link>
<span v-else>{{ childBreadCrumbItem.label }}</span>
</template>

View File

@ -33,7 +33,6 @@
<li class="popup-list-subheader">
{{ $i18n.get('label_last_processed_on') + ' ' + getDate(bgProcesses[0].processed_last) }}
<router-link
tag="a"
:to="$routerHelper.getProcessesPage()"
class="is-secondary">
{{ $i18n.get('label_view_more') }}

View File

@ -283,11 +283,17 @@
<p>{{ $i18n.get('info_there_is_no_filter' ) }}</p>
<router-link
v-if="!$adminOptions.hideItemsListFilterCreationButton && $route.name != null && ((isRepositoryLevel && $userCaps.hasCapability('tnc_rep_edit_filters')) || (!isRepositoryLevel && collection && collection.current_user_can_edit_filters))"
id="button-create-filter"
:to="isRepositoryLevel && $routerHelper ? $routerHelper.getNewFilterPath() : $routerHelper.getNewCollectionFilterPath(collectionId)"
tag="button"
class="button is-secondary is-centered">
{{ $i18n.getFrom('filters', 'new_item') }}
custom
v-slot="{ navigate }">
<button
type="button"
role="button"
@click="navigate()"
id="button-create-filter"
class="button is-secondary is-centered">
{{ $i18n.getFrom('filters', 'new_item') }}
</button>
</router-link>
</div>
</section>

View File

@ -3,7 +3,7 @@
//window.underscore = _.noConflict();
// Main imports
import Vue from 'vue';
import { createApp } from 'vue';
import {
Field,
Input,
@ -90,9 +90,6 @@ import {
export default (element) => {
// Vue Dev Tools!
Vue.config.devtools = TAINACAN_ENV === 'development';
function renderTainacanAdminPage() {
// Gets the div with the content of the page
@ -101,37 +98,47 @@ export default (element) => {
// Mount only if the div exists and it is not already mounted
if ( pageElement && pageElement.classList && !pageElement.classList.contains('has-mounted') ) {
const app = createApp({
el: '#tainacan-admin-app',
router,
store,
render: h => h(AdminPage)
});
app.use(router);
app.use(store);
/* Registers Extra Vue Plugins passed to the window.tainacan_extra_plugins */
if (typeof window.tainacan_extra_plugins != "undefined") {
for (let [extraVuePluginName, extraVuePluginObject] of Object.entries(window.tainacan_extra_plugins))
Vue.use(extraVuePluginObject);
app.use(extraVuePluginObject);
}
// Configure and Register Plugins
Vue.use(Field);
Vue.use(Input);
Vue.use(Autocomplete);
Vue.use(Taginput);
Vue.use(Collapse);
Vue.use(Button);
Vue.use(Datepicker);
Vue.use(Select);
Vue.use(Switch);
Vue.use(Upload);
Vue.use(Icon);
Vue.use(Pagination);
Vue.use(Checkbox);
Vue.use(Radio);
Vue.use(Tag);
Vue.use(Tabs);
Vue.use(Loading);
Vue.use(Dropdown);
Vue.use(Modal);
Vue.use(Dialog);
Vue.use(Snackbar);
Vue.use(Toast);
Vue.use(Numberinput);
Vue.use(VTooltip, {
app.use(Field);
app.use(Input);
app.use(Autocomplete);
app.use(Taginput);
app.use(Collapse);
app.use(Button);
app.use(Datepicker);
app.use(Select);
app.use(Switch);
app.use(Upload);
app.use(Icon);
app.use(Pagination);
app.use(Checkbox);
app.use(Radio);
app.use(Tag);
app.use(Tabs);
app.use(Loading);
app.use(Dropdown);
app.use(Modal);
app.use(Dialog);
app.use(Snackbar);
app.use(Toast);
app.use(Numberinput);
app.use(VTooltip, {
popperTriggers: ['hover', 'touch'],
themes: {
'taianacan-tooltip': {
@ -166,67 +173,67 @@ export default (element) => {
}
}
});
Vue.use(VueBlurHash);
Vue.use(I18NPlugin);
Vue.use(UserPrefsPlugin);
Vue.use(RouterHelperPlugin);
Vue.use(UserCapabilitiesPlugin);
Vue.use(ThumbnailHelperPlugin);
Vue.use(OrderByHelperPlugin);
Vue.use(StatusHelperPlugin);
Vue.use(ConsolePlugin, {visual: false});
Vue.use(VueTheMask);
Vue.use(CommentsStatusHelperPlugin);
Vue.use(AdminOptionsHelperPlugin, pageElement.dataset['options']);
app.use(VueBlurHash);
app.use(I18NPlugin);
app.use(UserPrefsPlugin);
app.use(RouterHelperPlugin);
app.use(UserCapabilitiesPlugin);
app.use(ThumbnailHelperPlugin);
app.use(OrderByHelperPlugin);
app.use(StatusHelperPlugin);
app.use(ConsolePlugin, {visual: false});
app.use(VueTheMask);
app.use(CommentsStatusHelperPlugin);
app.use(AdminOptionsHelperPlugin, pageElement.dataset['options']);
/* Registers Extra Vue Components passed to the window.tainacan_extra_components */
if (typeof window.tainacan_extra_components != "undefined") {
for (let [extraVueComponentName, extraVueComponentObject] of Object.entries(window.tainacan_extra_components)) {
Vue.component(extraVueComponentName, extraVueComponentObject);
app.component(extraVueComponentName, extraVueComponentObject);
}
}
/* Metadata */
Vue.component('tainacan-text', Text);
Vue.component('tainacan-textarea', Textarea);
Vue.component('tainacan-selectbox', Selectbox);
Vue.component('tainacan-numeric', Numeric);
Vue.component('tainacan-date', Date);
Vue.component('tainacan-relationship', Relationship);
Vue.component('tainacan-taxonomy', Taxonomy);
Vue.component('tainacan-compound', Compound);
Vue.component('tainacan-user', User);
Vue.component('tainacan-geocoordinate', GeoCoordinate);
app.component('tainacan-text', Text);
app.component('tainacan-textarea', Textarea);
app.component('tainacan-selectbox', Selectbox);
app.component('tainacan-numeric', Numeric);
app.component('tainacan-date', Date);
app.component('tainacan-relationship', Relationship);
app.component('tainacan-taxonomy', Taxonomy);
app.component('tainacan-compound', Compound);
app.component('tainacan-user', User);
app.component('tainacan-geocoordinate', GeoCoordinate);
/* Metadata Option forms */
Vue.component('tainacan-form-text', FormText);
Vue.component('tainacan-form-relationship', FormRelationship);
Vue.component('tainacan-form-taxonomy', FormTaxonomy);
Vue.component('tainacan-form-selectbox', FormSelectbox);
Vue.component('tainacan-form-numeric', FormNumeric);
Vue.component('tainacan-form-user', FormUser);
Vue.component('term-edition-form', TermEditionForm);
Vue.component('tainacan-form-geocoordinate', FormGeoCoordinate);
app.component('tainacan-form-text', FormText);
app.component('tainacan-form-relationship', FormRelationship);
app.component('tainacan-form-taxonomy', FormTaxonomy);
app.component('tainacan-form-selectbox', FormSelectbox);
app.component('tainacan-form-numeric', FormNumeric);
app.component('tainacan-form-user', FormUser);
app.component('term-edition-form', TermEditionForm);
app.component('tainacan-form-geocoordinate', FormGeoCoordinate);
/* Filter Metadata Option forms */
Vue.component('tainacan-filter-form-numeric', FormFilterNumeric);
Vue.component('tainacan-filter-form-numeric-interval', FormFilterNumericInterval);
Vue.component('tainacan-filter-form-numeric-list-interval', FormFilterNumericListInterval);
// Vue.component('tainacan-filter-form-date', FormDate);
app.component('tainacan-filter-form-numeric', FormFilterNumeric);
app.component('tainacan-filter-form-numeric-interval', FormFilterNumericInterval);
app.component('tainacan-filter-form-numeric-list-interval', FormFilterNumericListInterval);
// app.component('tainacan-filter-form-date', FormDate);
// Metadadum parent containers
Vue.component('tainacan-form-item', TainacanFormItem);
app.component('tainacan-form-item', TainacanFormItem);
/* Others */
Vue.component('help-button', HelpButton);
Vue.component('draggable', draggable);
Vue.component('tainacan-title', TainacanTitle);
app.component('help-button', HelpButton);
app.component('draggable', draggable);
app.component('tainacan-title', TainacanTitle);
// Event bus are needed to facilate comunication between child-parent-child components
Vue.use(eventBusMetadataList, {});
Vue.use(eventBusSearch, { store: store, router: router});
app.use(eventBusMetadataList, {});
app.use(eventBusSearch, { store: store, router: router });
// Changing title of pages
router.beforeEach((to, from, next) => {
@ -235,12 +242,7 @@ export default (element) => {
next();
});
new Vue({
el: '#tainacan-admin-app',
store,
router,
render: h => h(AdminPage)
});
app.mount();
// Initialize Ponyfill for Custom CSS properties
cssVars({

View File

@ -1,5 +1,4 @@
import Vue from 'vue';
import VueRouter from 'vue-router'
import { createRouter } from 'vue-router'
import qs from 'qs';
// Main Pages
@ -25,8 +24,6 @@ import ItemBulkEditionForm from '../components/edition/item-bulk-edition-form.vu
import TaxonomyEditionForm from '../components/edition/taxonomy-edition-form.vue'
import ExporterEditionForm from '../components/edition/exporter-edition-form.vue'
Vue.use(VueRouter);
const i18nGet = function (key) {
let string = tainacan_plugin.i18n[key];
return (string !== undefined && string !== null && string !== '' ) ? string : "ERROR: Invalid i18n key!";
@ -42,7 +39,7 @@ const routes = [
{ path: '/collections/:collectionId', component: CollectionPage, meta: {title: i18nGet('title_collection_page') },
children: [
{ path: '', redirect: 'items'},
{ path: '/', redirect: 'items'},
{ path: 'items', component: ItemsPage, name: 'CollectionItemsPage', meta: {title: i18nGet('title_collection_page') }, props: { isOnTheme: false } },
{ path: 'items/:itemId/edit', name: 'ItemEditionForm', component: ItemEditionForm, meta: {title: i18nGet('title_edit_item') } },
{ path: 'items/new', name: 'CollectionItemCreatePage', component: ItemEditionForm, meta: {title: i18nGet('title_create_item_collection') } },
@ -68,7 +65,7 @@ const routes = [
{ path: '/taxonomies', name: 'TaxonomyPage', component: TaxonomyPage, meta: {title: i18nGet('title_taxonomies_page') } },
{ path: '/taxonomies/new', name: 'TaxonomyCreationForm', component: TaxonomyEditionForm, meta: {title: i18nGet('title_create_taxonomy_page') } },
{ path: '/taxonomies/:taxonomyId/edit', name: 'TaxonomyEditionForm', component: TaxonomyEditionForm, meta: {title: i18nGet('title_taxonomy_edit_page') } },
{ path: '/taxonomies/:taxonomyId', redirect: '/taxonomies/:taxonomyId/edit' },
{ path: '/taxonomies/:taxonomyId', redirect: { name: 'TaxonomyEditionForm' } },
{ path: '/activities', name: 'ActivitiesPage', component: ActivitiesPage, meta: {title: i18nGet('title_repository_activities_page') } },
@ -82,10 +79,9 @@ const routes = [
{ path: '/exporters/', name: 'ExportersPage', component: AvailableExportersPage, meta: {title: i18nGet('title_exporters_page') } },
{ path: '/exporters/:exporterSlug', name: 'ExporterEditionForm', component: ExporterEditionForm, meta: {title: i18nGet('title_exporter_page') }},
{ path: '*', redirect: '/'}
];
export default new VueRouter ({
export default createRouter({
routes,
// set custom query resolver
parseQuery(query) {

View File

@ -1,5 +1,4 @@
import Vue from 'vue';
import Vuex from 'vuex';
import { createStore } from 'vuex';
import item from './modules/item';
import collection from './modules/collection';
@ -16,11 +15,7 @@ import exposer from './modules/exposer';
import capability from './modules/capability';
import report from './modules/report';
// Vue Dev Tools!
Vue.config.devtools = TAINACAN_ENV === 'development';
Vue.use(Vuex);
export default new Vuex.Store({
export default createStore({
/*
In strict mode, whenever Vuex state is mutated outside of mutation handlers, an error will be thrown

View File

@ -30,7 +30,6 @@
<ul class="repository-menu-list">
<!-- <li>
<router-link
tag="a"
to="/collections">
<span class="icon is-medium">
<i class="tainacan-icon tainacan-icon-36px tainacan-icon-collections"/>
@ -40,7 +39,6 @@
</li> -->
<!-- <li>
<router-link
tag="a"
to="/items">
<span class="icon is-medium">
<i class="tainacan-icon tainacan-icon-36px tainacan-icon-items"/>
@ -50,7 +48,6 @@
</li> -->
<li v-if="$userCaps.hasCapability('tnc_rep_edit_metadata') && !$adminOptions.hideHomeMetadataButton">
<router-link
tag="a"
to="/metadata">
<span class="icon is-medium">
<i class="tainacan-icon tainacan-icon-36px tainacan-icon-metadata"/>
@ -60,7 +57,6 @@
</li>
<li v-if="$userCaps.hasCapability('tnc_rep_edit_filters') && !$adminOptions.hideHomeFiltersButton">
<router-link
tag="a"
to="/filters">
<span class="icon is-medium">
<i class="tainacan-icon tainacan-icon-36px tainacan-icon-filters"/>
@ -70,7 +66,6 @@
</li>
<li v-if="!$adminOptions.hideHomeTaxonomiesButton">
<router-link
tag="a"
to="/taxonomies">
<span class="icon is-medium">
<i class="tainacan-icon tainacan-icon-36px tainacan-icon-taxonomies"/>
@ -80,7 +75,6 @@
</li>
<li v-if="!$adminOptions.hideHomeActivitiesButton">
<router-link
tag="a"
to="/activities">
<span class="icon is-medium">
<i class="tainacan-icon tainacan-icon-36px tainacan-icon-activities"/>
@ -90,7 +84,6 @@
</li>
<li v-if="!$adminOptions.hideHomeImportersButton">
<router-link
tag="a"
to="/importers">
<span class="icon is-medium">
<i class="tainacan-icon tainacan-icon-36px tainacan-icon-importers"/>
@ -100,7 +93,6 @@
</li>
<li v-if="!$adminOptions.hideHomeExportersButton">
<router-link
tag="a"
to="/exporters">
<span class="icon is-medium">
<i class="tainacan-icon tainacan-icon-36px tainacan-icon-export"/>
@ -122,10 +114,14 @@
<div class="home-section-header collections-section-header">
<div class="home-section-icon">
<router-link
tag="span"
class="icon"
to="/collections">
<i class="tainacan-icon tainacan-icon-collections"/>
to="/collections"
custom
v-slot="{ navigate }">
<span
@click="navigate()"
class="icon">
<i class="tainacan-icon tainacan-icon-collections"/>
</span>
</router-link>
</div>
<h1>{{ $i18n.get('label_recent_collections') }}</h1>
@ -147,7 +143,6 @@
<router-link
v-if="!$adminOptions.hideHomeCollectionsButton"
class="collections-see-more"
tag="a"
to="/collections">
<span class="icon">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-viewtable"/>

View File

@ -23,12 +23,16 @@
</button>
<b-dropdown-item aria-role="listitem">
<router-link
id="a-create-collection"
tag="div"
:to="{ path: $routerHelper.getNewCollectionPath() }">
{{ $i18n.get('new_blank_collection') }}
<br>
<small class="is-small">{{ $i18n.get('info_choose_your_metadata') }}</small>
:to="{ path: $routerHelper.getNewCollectionPath() }"
custom
v-slot="{ navigate }">
<div
id="a-create-collection"
@click="navigate()">
{{ $i18n.get('new_blank_collection') }}
<br>
<small class="is-small">{{ $i18n.get('info_choose_your_metadata') }}</small>
</div>
</router-link>
</b-dropdown-item>
<b-dropdown-item aria-role="listitem">
@ -267,12 +271,16 @@
</button>
<b-dropdown-item aria-role="listitem">
<router-link
id="a-create-collection"
tag="div"
:to="{ path: $routerHelper.getNewCollectionPath() }">
{{ $i18n.get('new_blank_collection') }}
<br>
<small class="is-small">{{ $i18n.get('info_choose_your_metadata') }}</small>
:to="{ path: $routerHelper.getNewCollectionPath() }"
custom
v-slot="{ navigate }">
<div
id="a-create-collection"
@click="navigate()">
{{ $i18n.get('new_blank_collection') }}
<br>
<small class="is-small">{{ $i18n.get('info_choose_your_metadata') }}</small>
</div>
</router-link>
</b-dropdown-item>
<b-dropdown-item aria-role="listitem">

View File

@ -330,11 +330,18 @@
</p>
<p>{{ $i18n.get('info_there_is_no_metadatum' ) }}</p>
<router-link
id="button-create-metadatum"
:to="isRepositoryLevel ? $routerHelper.getNewMetadatumPath() : $routerHelper.getNewCollectionMetadatumPath(collectionId)"
tag="button"
class="button is-secondary is-centered">
{{ $i18n.getFrom('metadata', 'new_item') }}</router-link>
custom
v-slot="{ navigate }">
<button
role="link"
ttype="button"
@click="navigate()"
id="button-create-metadatum"
class="button is-secondary is-centered">
{{ $i18n.getFrom('metadata', 'new_item') }}
</button>
</router-link>
</div>
</section>
</div>

View File

@ -128,16 +128,22 @@
collection.current_user_can_edit_items"
class="search-control-item">
<router-link
id="item-creation-options-dropdown"
:to="{ path: $routerHelper.getNewItemPath(collectionId) }"
v-if="$adminOptions.hideItemsListCreationDropdownBulkAdd && $adminOptions.hideItemsListCreationDropdownImport"
class="button is-secondary"
tag="button"
:to="{ path: $routerHelper.getNewItemPath(collectionId) }">
<span class="is-hidden-touch">{{ $i18n.getFrom('items','add_new') }}</span>
<span class="is-hidden-desktop">{{ $i18n.get('add') }}</span>
<span class="icon">
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-add" />
</span>
custom
v-slot="{ navigate }">
<button
type="button"
role="link"
@click="navigate()"
class="button is-secondary"
id="item-creation-options-dropdown">
<span class="is-hidden-touch">{{ $i18n.getFrom('items','add_new') }}</span>
<span class="is-hidden-desktop">{{ $i18n.get('add') }}</span>
<span class="icon">
<i class="tainacan-icon tainacan-icon-1-125em tainacan-icon-add" />
</span>
</button>
</router-link>
<b-dropdown
v-else
@ -159,10 +165,15 @@
v-if="!isRepositoryLevel"
aria-role="listitem">
<router-link
id="a-create-item"
tag="div"
:to="{ path: $routerHelper.getNewItemPath(collectionId) }">
{{ $i18n.get('add_one_item') }}
:to="{ path: $routerHelper.getNewItemPath(collectionId) }"
custom
v-slot="{ navigate }">
<div
role="link"
id="a-create-item"
@click="navigate()" >
{{ $i18n.get('add_one_item') }}
</div>
</router-link>
</b-dropdown-item>
<b-dropdown-item
@ -179,12 +190,17 @@
v-if="!isRepositoryLevel && !$adminOptions.hideItemsListCreationDropdownBulkAdd"
aria-role="listitem">
<router-link
id="a-item-add-bulk"
tag="div"
:to="{ path: $routerHelper.getNewItemBulkAddPath(collectionId) }">
{{ $i18n.get('add_items_bulk') }}
<br>
<small class="is-small">{{ $i18n.get('info_bulk_add_items') }}</small>
:to="{ path: $routerHelper.getNewItemBulkAddPath(collectionId) }"
custom
v-slot="{ navigate }">
<button
role="link"
@click="navigate()"
id="a-item-add-bulk">
{{ $i18n.get('add_items_bulk') }}
<br>
<small class="is-small">{{ $i18n.get('info_bulk_add_items') }}</small>
</button>
</router-link>
</b-dropdown-item>
<b-dropdown-item
@ -638,11 +654,17 @@
<router-link
v-if="!isRepositoryLevel && !isSortingByCustomMetadata && !hasFiltered && (status == undefined || status == '') && !$adminOptions.hideItemsListCreationDropdown"
id="button-create-item"
tag="button"
class="button is-secondary"
:to="{ path: $routerHelper.getNewItemPath(collectionId) }">
{{ $i18n.getFrom('items', 'add_new') }}
:to="{ path: $routerHelper.getNewItemPath(collectionId) }"
custom
v-slot="{ navigate }">
<button
id="button-create-item"
type="button"
@click="navigate()"
role="link"
class="button is-secondary">
{{ $i18n.getFrom('items', 'add_new') }}
</button>
</router-link>
<button
v-else-if="isRepositoryLevel && !isSortingByCustomMetadata && !hasFiltered && (status == undefined || status == '') && !$adminOptions.hideItemsListCreationDropdown"

View File

@ -10,11 +10,18 @@
v-if="$userCaps.hasCapability('tnc_rep_edit_taxonomies')"
class="header-item">
<router-link
id="button-create-taxonomy"
tag="button"
class="button is-secondary"
:to="{ path: $routerHelper.getNewTaxonomyPath() }">
{{ $i18n.getFrom('taxonomies', 'new_item') }}
:to="{ path: $routerHelper.getNewTaxonomyPath() }"
custom
v-slot="{ navigate }">
<button
type="button"
role="link"
id="button-create-taxonomy"
class="button is-secondary"
@click="navigate()">
{{ $i18n.getFrom('taxonomies', 'new_item') }}
</button>
</router-link>
</div>
@ -175,11 +182,17 @@
</p>
<router-link
v-if="status == undefined || status == ''"
id="button-create-taxonomy"
tag="button"
class="button is-secondary"
:to="{ path: $routerHelper.getNewTaxonomyPath() }">
{{ $i18n.getFrom('taxonomies', 'new_item') }}
:to="{ path: $routerHelper.getNewTaxonomyPath() }"
custom
v-slot="{ navigate }">
<button
role="link"
id="button-create-taxonomy"
type="button"
class="button is-secondary"
@click="navigate()">
{{ $i18n.getFrom('taxonomies', 'new_item') }}
</button>
</router-link>
</div>
</section>

View File

@ -1,14 +1,11 @@
import Vue from 'vue';
import VueRouter from 'vue-router'
import { createRouter, createWebHistory } from 'vue-router';
import qs from 'qs';
Vue.use(VueRouter);
const themeRoutes = [];
export default new VueRouter ({
mode: 'history',
themeRoutes,
export default createRouter ({
history: createWebHistory(),
routes: themeRoutes,
// set custom query resolver
parseQuery(query) {
return qs.parse(query);

View File

@ -1,21 +1,15 @@
import Vue from 'vue';
import VueRouter from 'vue-router'
import { createRouter } from 'vue-router';
import qs from 'qs';
import ReportsList from '../pages/reports-list.vue';
const { __ } = wp.i18n;
Vue.use(VueRouter);
const routes = [
{ path: '/', redirect:'/reports' },
{ path: '/reports', name: 'ReportsList', component: ReportsList, meta: { title: __('Tainacan Reports') } },
{ path: '*', redirect: '/'}
];
export default new VueRouter ({
export default createRouter({
routes,
// set custom query resolver
parseQuery(query) {

View File

@ -1,5 +1,4 @@
import Vue from 'vue';
import VueRouter from 'vue-router'
import { createRouter } from 'vue-router';
import qs from 'qs';
import RolesList from '../pages/roles-list.vue';
@ -7,17 +6,13 @@ import RoleEditionForm from '../pages/role-edition-form.vue'
const { __ } = wp.i18n;
Vue.use(VueRouter);
const routes = [
{ path: '/', redirect:'/roles' },
{ path: '/roles', name: 'RolesList', component: RolesList, meta: { title: __('Tainacan User Roles') } },
{ path: '/roles/:roleSlug', name: 'RoleEditionForm', component: RoleEditionForm, meta: { title: __('Editing User Role') } },
{ path: '*', redirect: '/'}
];
export default new VueRouter ({
export default createRouter({
routes,
// set custom query resolver
parseQuery(query) {