Merge branch 'release/0.13' of https://github.com/tainacan/tainacan into release/0.13

This commit is contained in:
vnmedeiros 2019-10-16 16:40:18 -03:00
commit d38d4350aa
9 changed files with 134 additions and 127 deletions

View File

@ -154,9 +154,9 @@
'approve',
'notApprove'
]),
getThis(){
return this;
},
// getThis(){
// return this;
// },
approveActivity(activity) {
this.approve(activity.id)
.then(data => {

View File

@ -456,7 +456,7 @@
<style lang="scss" scoped>
@import '../../scss/_variables.scss';
.sub-header {
.sub-header {
min-height: $subheader-height;
height: $header-height;
padding-left: 0;
@ -509,7 +509,7 @@
color: $blue5;
height: 27px;
font-size: 18px !important;
height: 1.5rem !important;
height: 1.75rem !important;
}
}

View File

@ -122,6 +122,25 @@
</option>
</b-select>
</b-field>
<!-- Textual Search -------------->
<b-field class="header-item">
<div class="control has-icons-right is-small is-clearfix">
<input
class="input is-small"
:placeholder="$i18n.get('instruction_search')"
type="search"
:aria-label="$i18n.get('instruction_search') + ' ' + $i18n.get('collections')"
autocomplete="on"
v-model="searchQuery"
@keyup.enter="searchCollections()">
<span
@click="searchCollections()"
class="icon is-right">
<i class="tainacan-icon tainacan-icon-search" />
</span>
</div>
</b-field>
</div>
<div class="above-subheader">
@ -310,6 +329,7 @@ export default {
status: '',
order: 'desc',
ordeBy: 'date',
searchQuery: '',
sortingOptions: [
{ label: this.$i18n.get('label_title'), value: 'title' },
{ label: this.$i18n.get('label_creation_date'), value: 'date' },
@ -405,7 +425,8 @@ export default {
status: this.status,
contextEdit: true,
order: this.order,
orderby: this.orderBy
orderby: this.orderBy,
search: this.searchQuery
})
.then((res) => {
this.isLoading = false;
@ -427,7 +448,11 @@ export default {
hasModalCard: true,
trapFocus: true
});
}
},
searchCollections() {
this.page = 1;
this.loadCollections();
},
},
created() {
this.collectionsPerPage = this.$userPrefs.get('collections_per_page');
@ -473,18 +498,23 @@ export default {
@import '../../scss/_variables.scss';
.sub-header {
min-height: $subheader-height;
height: $header-height;
min-height: $header-height;
height: auto;
padding-left: 0;
padding-right: 0;
border-bottom: 1px solid #ddd;
display: inline-flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
width: 100%;
.header-item {
margin-bottom: 0 !important;
&:first-child {
margin-right: auto;
}
&:not(:last-child) {
padding-right: 0.5em;
}
@ -497,9 +527,13 @@ export default {
cursor: default;
}
.button {
display: flex;
align-items: center;
&:not(:first-child) {
.button {
display: flex;
align-items: center;
border-radius: 0 !important;
height: 1.95rem !important;
}
}
.field {
@ -515,14 +549,23 @@ export default {
font-size: 1.3125rem !important;
max-width: 26px;
}
.icon {
pointer-events: all;
cursor: pointer;
color: $blue5;
height: 27px;
font-size: 18px !important;
height: 1.75rem !important;
}
}
@media screen and (max-width: 769px) {
height: 60px;
height: 120px;
margin-top: -0.5em;
padding-top: 0.9em;
.header-item {
.header-item:not(:last-child) {
padding-right: 0.2em;
}
}

View File

@ -84,6 +84,25 @@
</option>
</b-select>
</b-field>
<!-- Textual Search -------------->
<b-field class="header-item">
<div class="control has-icons-right is-small is-clearfix">
<input
class="input is-small"
:placeholder="$i18n.get('instruction_search')"
type="search"
:aria-label="$i18n.get('instruction_search') + ' ' + $i18n.get('taxonomies')"
autocomplete="on"
v-model="searchQuery"
@keyup.enter="searchTaxonomies()">
<span
@click="searchTaxonomies()"
class="icon is-right">
<i class="tainacan-icon tainacan-icon-search" />
</span>
</div>
</b-field>
</div>
<div class="above-subheader">
@ -231,6 +250,7 @@
status: '',
order: 'asc',
ordeBy: 'date',
searchQuery: '',
sortingOptions: [
{ label: this.$i18n.get('label_title'), value: 'title' },
{ label: this.$i18n.get('label_creation_date'), value: 'date' },
@ -305,7 +325,8 @@
taxonomiesPerPage: this.taxonomiesPerPage,
status: this.status,
order: this.order,
orderby: this.orderBy
orderby: this.orderBy,
search: this.searchQuery
})
.then((res) => {
this.isLoading = false;
@ -318,6 +339,10 @@
getLastTaxonomyNumber() {
let last = (Number(this.taxonomiesPerPage * (this.page - 1)) + Number(this.taxonomiesPerPage));
return last > this.total ? this.total : last;
},
searchTaxonomies() {
this.page = 1;
this.load();
}
},
computed: {
@ -371,10 +396,15 @@
display: inline-flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
width: 100%;
.header-item {
margin-bottom: 0 !important;
&:first-child {
margin-right: auto;
}
&:not(:last-child) {
padding-right: 0.5em;
}
@ -387,9 +417,13 @@
cursor: default;
}
.button {
display: flex;
align-items: center;
&:not(:first-child) {
.button {
display: flex;
align-items: center;
border-radius: 0 !important;
height: 1.95rem !important;
}
}
.field {
@ -405,10 +439,19 @@
font-size: 1.3125rem !important;
max-width: 26px;
}
.icon {
pointer-events: all;
cursor: pointer;
color: $blue5;
height: 27px;
font-size: 18px !important;
height: 1.75rem !important;
}
}
@media screen and (max-width: 769px) {
height: 60px;
height: 160px;
margin-top: -0.5em;
padding-top: 0.9em;

View File

@ -85,10 +85,8 @@
<script>
import { tainacan as axios } from '../../../js/axios/axios';
import BCheckbox from "../../../../node_modules/buefy/src/components/checkbox/Checkbox.vue";
export default {
components: {BCheckbox},
props: {
value: [ String, Object, Array ],
metadatum: [ String, Object ],

View File

@ -6,7 +6,6 @@ export default {
router: options.router,
store: options.store,
data: {
componentsTag: [],
errors : [],
query: {},
collectionId: undefined,
@ -381,26 +380,7 @@ export default {
this.$store.dispatch('search/cleanMetaQueries');
this.$store.dispatch('search/cleanTaxQueries');
this.updateURLQueries();
},
/* Dev interfaces methods */
registerComponent( name ){
if (this.componentsTag.indexOf(name) < 0) {
this.componentsTag.push( name );
}
},
getAllComponents(){
const components = [];
for( let component of this.componentsTag ){
const eventElements = document.getElementsByTagName( component );
if( eventElements ) {
for (let eventElement of eventElements){
components.push( eventElement );
}
}
}
return components;
},
}
}
});
}

View File

@ -4,14 +4,10 @@ import store from './store/store'
export const eventBus = new Vue({
store,
data: {
componentsTag: [],
errors : []
},
created(){
if( tainacan_plugin.components ){
this.componentsTag = tainacan_plugin.components;
}
this.$on('input', this.updateValue );
created() {
this.$on('input', this.updateValue);
},
watch: {
errors() {
@ -19,26 +15,6 @@ export const eventBus = new Vue({
}
},
methods : {
registerComponent( name ){
if (this.componentsTag.indexOf(name) < 0) {
this.componentsTag.push( name );
}
},
// listener(){
// const components = this.getAllComponents();
// for (let eventElement of components){
// eventElement.addEventListener('input', (event) => {
// if (event.detail && event.detail[0] ){
// this.updateValue({
// item_id: $(eventElement).attr("item_id"),
// metadatum_id: $(eventElement).attr("metadatum_id"),
// values: event.detail
// })
// }
// });
// }
// },
updateValue(data){
this.$emit('isUpdatingValue', true);
@ -86,51 +62,12 @@ export const eventBus = new Vue({
let error = this.errors.find( errorItem => errorItem.metadatum_id == metadatum_id );
return ( error ) ? error.errors : false
},
clearAllErrors(){
clearAllErrors() {
this.errors = [];
},
setValues(){
const metadatum = this.$store.getters['item/getMetadata'];
if( metadatum ){
for(let singleMetadata of metadatum){
const eventElement = this.getComponentById( singleMetadata.metadatum_id );
eventElement.value = singleMetadata.values;
}
}
},
getAllComponents(){
const components = [];
for( let component of this.componentsTag ){
const eventElements = document.getElementsByTagName( component );
if( eventElements ) {
for (let eventElement of eventElements){
components.push( eventElement );
}
}
}
let elements = document.querySelectorAll('[web-component="true"]');
if( elements ) {
for (let eventElement of elements){
components.push( eventElement );
}
}
return components;
},
getComponentById( metadatum_id ){
for( let component of this.componentsTag ){
const eventElements = document.getElementsByTagName( component );
if( eventElements ) {
for (let eventElement of eventElements){
if( eventElement.metadatum_id === metadatum_id ){
return eventElement;
}
}
}
}
}
},
beforeUpdate() {
this.$off('input', this.updateValue );
this.$off('input', this.updateValue);
}
});

View File

@ -137,7 +137,7 @@ export const deleteItem = ({ commit }, { itemId, isPermanently }) => {
});
};
export const fetchCollections = ({commit} , { page, collectionsPerPage, status, contextEdit, order, orderby }) => {
export const fetchCollections = ({commit} , { page, collectionsPerPage, status, contextEdit, order, orderby, search }) => {
return new Promise((resolve, reject) => {
let endpoint = '/collections?paged='+page+'&perpage='+collectionsPerPage;
@ -150,25 +150,28 @@ export const fetchCollections = ({commit} , { page, collectionsPerPage, status,
if (order != undefined && order != '' && orderby != undefined && orderby != '')
endpoint = endpoint + '&order=' + order + '&orderby=' + orderby;
if (search != undefined && search != '')
endpoint = endpoint + '&search=' + search;
axios.tainacan.get(endpoint)
.then(res => {
let collections = res.data;
commit('setCollections', collections);
.then(res => {
let collections = res.data;
commit('setCollections', collections);
commit('setRepositoryTotalCollections', {
draft: res.headers['x-tainacan-total-collections-draft'],
trash: res.headers['x-tainacan-total-collections-trash'],
publish: res.headers['x-tainacan-total-collections-publish'],
private: res.headers['x-tainacan-total-collections-private'],
commit('setRepositoryTotalCollections', {
draft: res.headers['x-tainacan-total-collections-draft'],
trash: res.headers['x-tainacan-total-collections-trash'],
publish: res.headers['x-tainacan-total-collections-publish'],
private: res.headers['x-tainacan-total-collections-private'],
});
resolve({'collections': collections, 'total': res.headers['x-wp-total'] });
})
.catch(error => {
console.log(error);
reject(error);
});
resolve({'collections': collections, 'total': res.headers['x-wp-total'] });
})
.catch(error => {
console.log(error);
reject(error);
});
});
};

View File

@ -45,7 +45,7 @@ export const updateTaxonomy = ({ commit }, taxonomy) => {
});
};
export const fetch = ({ commit }, { page, taxonomiesPerPage, status, order, orderby } ) => {
export const fetch = ({ commit }, { page, taxonomiesPerPage, status, order, orderby, search } ) => {
return new Promise((resolve, reject) => {
let endpoint = `/taxonomies?paged=${page}&perpage=${taxonomiesPerPage}&context=edit`;
@ -54,6 +54,9 @@ export const fetch = ({ commit }, { page, taxonomiesPerPage, status, order, orde
if (order != undefined && order != '' && orderby != undefined && orderby != '')
endpoint = endpoint + '&order=' + order + '&orderby=' + orderby;
if (search != undefined && search != '')
endpoint = endpoint + '&search=' + search;
axios.tainacan.get(endpoint)
.then(res => {