Moves url links to another position on amdin.

This commit is contained in:
Mateus Machado Luna 2018-12-04 11:58:46 -02:00
parent da6c46cc68
commit 38f4be3a39
8 changed files with 48 additions and 36 deletions

View File

@ -171,8 +171,8 @@ class Admin {
}
$settings = [
'root' => esc_url_raw( rest_url() ) . 'tainacan/v2',
'root_wp_api' => esc_url_raw( rest_url() ) . 'wp/v2/',
'tainacan_api_url' => esc_url_raw( rest_url() ) . 'tainacan/v2',
'wp_api_url' => esc_url_raw( rest_url() ) . 'wp/v2/',
'wp_ajax_url' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'wp_rest' ),
'components' => $components,

View File

@ -25,7 +25,7 @@
</span>
</div>
<div class="field is-pulled-right">
<div class="field">
<b-dropdown
:mobile-modal="true"
position="is-bottom-left"
@ -64,6 +64,18 @@
</b-dropdown-item>
</b-dropdown>
</div>
<!-- Exposers or alternativa links modal button -->
<div class="field">
<button
class="button is-white"
@click="openExposersModal()">
<span class="gray-icon">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-url"/>
</span>
<span class="is-hidden-touch">{{ $i18n.get('label_urls') }}</span>
</button>
</div>
</div>
<div class="table-wrapper">
@ -661,6 +673,7 @@
import { mapActions, mapGetters } from 'vuex';
import CustomDialog from '../other/custom-dialog.vue';
import BulkEditionModal from '../bulk-edition/bulk-edition-modal.vue';
import ExposersModal from '../other/exposers-modal.vue';
export default {
name: 'ItemsList',
@ -924,16 +937,16 @@ export default {
let maxCharacter = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) <= 480 ? 100 : 210;
return description.length > maxCharacter ? description.substring(0, maxCharacter - 3) + '...' : description;
},
randomHeightForMasonryItem() {
let min = 255;
let max = 255;
min = 140;
max = 420;
return Math.floor(Math.random()*(max-min+1)+min);
}
openExposersModal() {
this.$modal.open({
parent: this,
component: ExposersModal,
hasModalCard: true,
props: {
collectionId: this.collectionId
}
})
},
}
}
</script>
@ -951,10 +964,13 @@ export default {
padding: 6px 0px 0px 12px;
background: white;
height: 40px;
display: flex;
.select-all {
color: $gray4;
font-size: 0.875rem;
margin-right: auto;
&:hover {
color: $gray4;
}

View File

@ -4,7 +4,7 @@
class="tainacan-modal-content"
style="width: auto">
<header class="tainacan-modal-title">
<h2>{{ this.$i18n.get('label_alternative_exposer_urls') }}</h2>
<h2>{{ this.$i18n.get('label_urls') }}</h2>
<hr>
</header>
<section class="tainacan-form">
@ -46,13 +46,6 @@
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-url"/>
</span>
</a>
<a
:href="exposerBaseURL + '&exposer=' + exposerType.slug + '&mapper=' + exposerMapper"
download>
<span class="gray-icon">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-download"/>
</span>
</a>
</span>
</div>
<div
@ -68,13 +61,6 @@
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-url"/>
</span>
</a>
<a
:href="exposerBaseURL + '&exposer=' + exposerType.slug + '&mapper=' + exposerMapper"
download>
<span class="gray-icon">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-download"/>
</span>
</a>
</span>
</div>
</div>
@ -120,9 +106,17 @@ export default {
exposerBaseURL() {
let baseURL = this.collectionId != undefined ? '/collection/' + this.collectionId + '/items/' : 'items';
let currentParams = this.$route.query;
// Removes Fetch Only
if (currentParams.fetch_only != undefined)
delete currentParams.fetch_only;
return tainacan_plugin.root + baseURL + '?' + qs.stringify(currentParams);
// Handles pagination of this link
if (currentParams.paged != 1)
currentParams.paged = 1;
currentParams.perpage = 100;
return tainacan_plugin.tainacan_api_url + baseURL + '?' + qs.stringify(currentParams);
}
},
methods: {

View File

@ -2,7 +2,7 @@ import qs from 'qs';
import axios from 'axios';
const wpApi = axios.create({
baseURL: tainacan_plugin.root_wp_api
baseURL: tainacan_plugin.wp_api_url
});
wpApi.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce;

View File

@ -446,14 +446,16 @@
</div>
<!-- Exposers or alternativa links modal button -->
<div class="search-control-item">
<div
v-if="isOnTheme"
class="search-control-item">
<button
class="button is-white"
@click="openExposersModal()">
<span class="gray-icon">
<i class="tainacan-icon tainacan-icon-20px tainacan-icon-url"/>
</span>
<span class="is-hidden-touch">{{ $i18n.get('label_exposer_urls') }}</span>
<span class="is-hidden-touch">{{ $i18n.get('label_urls') }}</span>
</button>
</div>

View File

@ -337,7 +337,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'label_available_exporters' => __( 'Available Exporters', 'tainacan' ),
'label_origin_collection' => __( 'Origin collection', 'tainacan'),
'label_send_email' => __( 'Send a email after exportation completed', 'tainacan' ),
'label_alternative_exposer_urls' => __( 'Alternative Exposer URLs', 'tainacan' ),
'label_urls' => __( 'URLs', 'tainacan' ),
// Instructions. More complex sentences to guide user and placeholders
'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ),

View File

@ -1,7 +1,7 @@
import axios from 'axios';
const tainacan = axios.create({
baseURL: tainacan_plugin.root
baseURL: tainacan_plugin.tainacan_api_url
});
tainacan.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce;

View File

@ -1,13 +1,13 @@
import axios from 'axios';
export const tainacan = axios.create({
baseURL: tainacan_plugin.root
baseURL: tainacan_plugin.tainacan_api_url
});
tainacan.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce;
export const wp = axios.create({
baseURL: tainacan_plugin.root_wp_api
baseURL: tainacan_plugin.wp_api_url
});
wp.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce;