Adds check for permalinks structure before loading the Tainacan Admin.
This commit is contained in:
parent
5a79068796
commit
3b91a5159a
|
@ -5,6 +5,7 @@
|
||||||
:class="{
|
:class="{
|
||||||
'tainacan-admin-mobile-app-mode': $adminOptions.mobileAppMode
|
'tainacan-admin-mobile-app-mode': $adminOptions.mobileAppMode
|
||||||
}">
|
}">
|
||||||
|
<template v-if="hasPermalinksStructure">
|
||||||
<template v-if="activeRoute == 'HomePage'">
|
<template v-if="activeRoute == 'HomePage'">
|
||||||
<tainacan-header v-if="!$adminOptions.hideTainacanHeader" />
|
<tainacan-header v-if="!$adminOptions.hideTainacanHeader" />
|
||||||
<router-view />
|
<router-view />
|
||||||
|
@ -46,6 +47,7 @@
|
||||||
<router-view />
|
<router-view />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -70,7 +72,8 @@
|
||||||
return {
|
return {
|
||||||
isMenuCompressed: false,
|
isMenuCompressed: false,
|
||||||
isRepositoryLevel : true,
|
isRepositoryLevel : true,
|
||||||
activeRoute: '/collections'
|
activeRoute: '/collections',
|
||||||
|
hasPermalinksStructure: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -109,20 +112,46 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
||||||
|
wp.hooks.doAction('tainacan_navigation_path_updated', this.$route);
|
||||||
|
|
||||||
|
this.hasPermalinksStructure = tainacan_plugin.has_permalinks_structure;
|
||||||
|
|
||||||
|
if ( this.hasPermalinksStructure ) {
|
||||||
this.$statusHelper.loadStatuses();
|
this.$statusHelper.loadStatuses();
|
||||||
this.$userPrefs.init();
|
this.$userPrefs.init();
|
||||||
this.isMenuCompressed = (this.$route.params.collectionId != undefined);
|
this.isMenuCompressed = (this.$route.params.collectionId != undefined);
|
||||||
this.activeRoute = this.$route.name;
|
this.activeRoute = this.$route.name;
|
||||||
this.isRepositoryLevel = this.$route.params.collectionId == undefined;
|
this.isRepositoryLevel = this.$route.params.collectionId == undefined;
|
||||||
|
|
||||||
wp.hooks.doAction('tainacan_navigation_path_updated', this.$route);
|
if (jQuery && jQuery( document )) {
|
||||||
|
|
||||||
if (jQuery && jQuery( document ))
|
|
||||||
jQuery( document ).ajaxError(this.onHeartBitError);
|
jQuery( document ).ajaxError(this.onHeartBitError);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.onPermalinksError();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
onPermalinksError() {
|
||||||
|
this.$buefy.modal.open({
|
||||||
|
component: CustomDialog,
|
||||||
|
props: {
|
||||||
|
title: this.$i18n.get('error_permalinks_label'),
|
||||||
|
message: this.$i18n.getWithVariables('error_permalinks_detail', [ '<a href="' + tainacan_plugin.admin_url + 'options-permalink.php">', '</a>' ]),
|
||||||
|
hideCancel: true,
|
||||||
|
confirmText: this.$i18n.get('label_go_to_permalinks'),
|
||||||
|
onConfirm: () => {
|
||||||
|
window.location.href = tainacan_plugin.admin_url + 'options-permalink.php';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ariaRole: 'alertdialog',
|
||||||
|
ariaModal: true,
|
||||||
|
customClass: 'tainacan-modal',
|
||||||
|
canCancel: false,
|
||||||
|
});
|
||||||
|
},
|
||||||
onHeartBitError(event, jqxhr, settings) {
|
onHeartBitError(event, jqxhr, settings) {
|
||||||
if (settings && settings.url == '/wp-admin/admin-ajax.php') {
|
if (settings && settings.url == tainacan_plugin.admin_url + 'admin-ajax.php') {
|
||||||
this.$buefy.snackbar.open({
|
this.$buefy.snackbar.open({
|
||||||
message: this.$i18n.get('error_connectivity'),
|
message: this.$i18n.get('error_connectivity'),
|
||||||
type: 'is-danger',
|
type: 'is-danger',
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
type="submit"
|
type="submit"
|
||||||
class="button is-success"
|
class="button is-success"
|
||||||
@click="onConfirm(); $emit('close');">
|
@click="onConfirm(); $emit('close');">
|
||||||
{{ $i18n.get('continue') }}
|
{{ confirmText ? confirmText : $i18n.get('continue') }}
|
||||||
</button>
|
</button>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
@ -66,6 +66,10 @@
|
||||||
title: String,
|
title: String,
|
||||||
message: String,
|
message: String,
|
||||||
icon: String,
|
icon: String,
|
||||||
|
confirmText: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
onConfirm: {
|
onConfirm: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: () => {}
|
default: () => {}
|
||||||
|
|
|
@ -179,7 +179,8 @@ abstract class Pages {
|
||||||
'tainacan_enable_relationship_metaquery' => (
|
'tainacan_enable_relationship_metaquery' => (
|
||||||
defined('TAINACAN_ENABLE_RELATIONSHIP_METAQUERY') &&
|
defined('TAINACAN_ENABLE_RELATIONSHIP_METAQUERY') &&
|
||||||
true === TAINACAN_ENABLE_RELATIONSHIP_METAQUERY
|
true === TAINACAN_ENABLE_RELATIONSHIP_METAQUERY
|
||||||
)
|
),
|
||||||
|
'has_permalinks_structure' => get_option('permalink_structure') !== ''
|
||||||
];
|
];
|
||||||
|
|
||||||
$maps = [
|
$maps = [
|
||||||
|
|
|
@ -709,6 +709,7 @@ return apply_filters( 'tainacan-i18n', [
|
||||||
'label_item_submission_options' => __( 'Item submission options', 'tainacan' ),
|
'label_item_submission_options' => __( 'Item submission options', 'tainacan' ),
|
||||||
'label_metadata_related_features' => __( 'Metadata related features', 'tainacan' ),
|
'label_metadata_related_features' => __( 'Metadata related features', 'tainacan' ),
|
||||||
'label_preview' => __( 'Preview', 'tainacan' ),
|
'label_preview' => __( 'Preview', 'tainacan' ),
|
||||||
|
'label_go_to_permalinks' => __( 'Go to permalinks', 'tainacan' ),
|
||||||
|
|
||||||
// Instructions. More complex sentences to guide user and placeholders
|
// Instructions. More complex sentences to guide user and placeholders
|
||||||
'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ),
|
'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ),
|
||||||
|
@ -1118,6 +1119,7 @@ return apply_filters( 'tainacan-i18n', [
|
||||||
/* Errors displayed on the interface bottom notifications */
|
/* Errors displayed on the interface bottom notifications */
|
||||||
'error_connectivity_label' => __('Connectivity issue', 'tainacan'),
|
'error_connectivity_label' => __('Connectivity issue', 'tainacan'),
|
||||||
'error_connectivity' => __('It is possible that you are disconnected or the server is not working properly.', 'tainacan'),
|
'error_connectivity' => __('It is possible that you are disconnected or the server is not working properly.', 'tainacan'),
|
||||||
|
'error_permalinks_label' => __('Permalinks issue', 'tainacan'),
|
||||||
'error_400' => __('Some request went wrong due to invalid syntax.', 'tainacan'),
|
'error_400' => __('Some request went wrong due to invalid syntax.', 'tainacan'),
|
||||||
'error_401' => __('You must authenticate to access this information. Try logging in again on the WordPress Admin panel.', 'tainacan'),
|
'error_401' => __('You must authenticate to access this information. Try logging in again on the WordPress Admin panel.', 'tainacan'),
|
||||||
'error_403' => __('It seems that you are not allowed to access this content.', 'tainacan'),
|
'error_403' => __('It seems that you are not allowed to access this content.', 'tainacan'),
|
||||||
|
@ -1130,6 +1132,7 @@ return apply_filters( 'tainacan-i18n', [
|
||||||
'error_511' => __('You must authenticate to get access this information. Try logging in again on the WordPress Admin panel.', 'tainacan'),
|
'error_511' => __('You must authenticate to get access this information. Try logging in again on the WordPress Admin panel.', 'tainacan'),
|
||||||
'error_other' => __('Something went wrong here. You may want to try again or contact the Administrator.', 'tainacan'),
|
'error_other' => __('Something went wrong here. You may want to try again or contact the Administrator.', 'tainacan'),
|
||||||
'error_connectivity_detail' => __('The WordPress Heartbit API sends requests periodically to the server to update some information. The latest request failed for some reason. It can be the case of a lost connection or bad communication between the browser and the server.', 'tainacan'),
|
'error_connectivity_detail' => __('The WordPress Heartbit API sends requests periodically to the server to update some information. The latest request failed for some reason. It can be the case of a lost connection or bad communication between the browser and the server.', 'tainacan'),
|
||||||
|
'error_permalinks_detail' => __( 'Tainacan requires your Permalink settings to be configured. Please visit %sPermalink settings%s and define it to an option such as "postname".', 'tainacan' ),
|
||||||
'error_400_detail' => __('The server could not understand the request due to invalid syntax. This is possibly an issue with Tainacan and should be reported to its developers.', 'tainacan'),
|
'error_400_detail' => __('The server could not understand the request due to invalid syntax. This is possibly an issue with Tainacan and should be reported to its developers.', 'tainacan'),
|
||||||
'error_401_detail' => __('You must authenticate to get access this information. Even if you have access to the Tainacan admin panel, it may be the case that your session cookies were lost. Try reloading the page or logging again on the WordPress Admin panel.', 'tainacan'),
|
'error_401_detail' => __('You must authenticate to get access this information. Even if you have access to the Tainacan admin panel, it may be the case that your session cookies were lost. Try reloading the page or logging again on the WordPress Admin panel.', 'tainacan'),
|
||||||
'error_403_detail' => __('It seems that you are not allowed to access this content. Your user might have a role with insufficient capabilities. If that is not the case, check if you are correctly logged in on the WordPress Admin panel.', 'tainacan'),
|
'error_403_detail' => __('It seems that you are not allowed to access this content. Your user might have a role with insufficient capabilities. If that is not the case, check if you are correctly logged in on the WordPress Admin panel.', 'tainacan'),
|
||||||
|
|
Loading…
Reference in New Issue