Fixes thumnail exhibition, Implements UpdateMetadata
This commit is contained in:
parent
badfb6e655
commit
33d3f06651
10
build.sh
10
build.sh
|
@ -8,21 +8,21 @@ current_OS=`uname`
|
||||||
|
|
||||||
# For macOS (Darwin)
|
# For macOS (Darwin)
|
||||||
if [ $current_OS == "Darwin" ]; then
|
if [ $current_OS == "Darwin" ]; then
|
||||||
find src -type f \( -name "*.js" -or -name "*.vue" \) -exec md5 {} \; | sort -k 2 | md5 > last-js-build.md5
|
find src -type f \( -name "*.js" -or -name "*.vue" -or -name "*.scss" \) -exec md5 {} \; | sort -k 2 | md5 > last-js-build.md5
|
||||||
else
|
else
|
||||||
find src -type f \( -name "*.js" -or -name "*.vue" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-js-build.md5
|
find src -type f \( -name "*.js" -or -name "*.vue" -or -name "*.scss" \) -exec md5sum {} \; | sort -k 2 | md5sum > last-js-build.md5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new_md5=$(<last-js-build.md5)
|
new_md5=$(<last-js-build.md5)
|
||||||
if [ "$current_md5" != "$new_md5" ]
|
if [ "$current_md5" != "$new_md5" ]
|
||||||
then
|
then
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
|
## Compile SASS
|
||||||
|
sh compile-sass.sh
|
||||||
fi
|
fi
|
||||||
### END npm build ###
|
### END npm build ###
|
||||||
|
|
||||||
## Compile SASS
|
|
||||||
sh compile-sass.sh
|
|
||||||
|
|
||||||
## Install composer dependencies
|
## Install composer dependencies
|
||||||
composer install
|
composer install
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class TAINACAN_REST_Controller extends WP_REST_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(array_key_exists('columns', $map)){
|
if(array_key_exists('columns', $map)){
|
||||||
$entity_prepared['featured_image'] = $entity->get_columns();
|
$entity_prepared['columns'] = $entity->get_columns();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $entity_prepared;
|
return $entity_prepared;
|
||||||
|
|
|
@ -119,7 +119,7 @@ class TAINACAN_REST_Collections_Controller extends TAINACAN_REST_Controller {
|
||||||
if ($item->have_posts()) {
|
if ($item->have_posts()) {
|
||||||
while ( $item->have_posts() ) {
|
while ( $item->have_posts() ) {
|
||||||
$item->the_post();
|
$item->the_post();
|
||||||
$collection = new Entities\Collection($item->post);
|
$collection = new Entities\Collection($item->post->ID);
|
||||||
|
|
||||||
$collection_resumed = $this->get_only_needed_attributes($collection, $map);
|
$collection_resumed = $this->get_only_needed_attributes($collection, $map);
|
||||||
|
|
||||||
|
|
|
@ -51,11 +51,11 @@
|
||||||
},
|
},
|
||||||
setInitValueOnStore(){
|
setInitValueOnStore(){
|
||||||
if ( this.value ){
|
if ( this.value ){
|
||||||
this.$store.dispatch('item/updateMetadata', { item_id: this.item_id, metadata_id: this.metadata_id, values: JSON.parse( this.value ) });
|
this.$store.dispatch('item/sendMetadata', { item_id: this.item_id, metadata_id: this.metadata_id, values: JSON.parse( this.value ) });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setValue( event ){
|
setValue( event ){
|
||||||
this.$store.dispatch('item/sendMetadata', { item_id: this.item_id, metadata_id: this.metadata_id, values: event.target.value });
|
this.$store.dispatch('item/updateMetadata', { item_id: this.item_id, metadata_id: this.metadata_id, values: event.target.value });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,8 +283,7 @@ abstract class Repository {
|
||||||
} elseif ( isset( $entity->WP_Post )) {
|
} elseif ( isset( $entity->WP_Post )) {
|
||||||
if($mapped == 'thumbnail'){
|
if($mapped == 'thumbnail'){
|
||||||
$property = get_the_post_thumbnail_url($entity->WP_Post->ID, 'full');
|
$property = get_the_post_thumbnail_url($entity->WP_Post->ID, 'full');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$property = isset($entity->WP_Post->$mapped) ? $entity->WP_Post->$mapped : null;
|
$property = isset($entity->WP_Post->$mapped) ? $entity->WP_Post->$mapped : null;
|
||||||
}
|
}
|
||||||
} elseif ( isset( $entity->WP_Term )) {
|
} elseif ( isset( $entity->WP_Term )) {
|
||||||
|
|
|
@ -24,7 +24,20 @@ export const sendMetadata = ( { commit }, { item_id, metadata_id, values }) => {
|
||||||
|
|
||||||
|
|
||||||
export const updateMetadata = ({ commit }, { item_id, metadata_id, values }) => {
|
export const updateMetadata = ({ commit }, { item_id, metadata_id, values }) => {
|
||||||
commit('setSingleMetadata', { item_id: item_id, metadata_id: metadata_id, values: values });
|
return new Promise((resolve, reject) => {
|
||||||
|
axios.patch(`/item/${item_id}/metadata/`, {
|
||||||
|
metadata_id: metadata_id,
|
||||||
|
values: values
|
||||||
|
})
|
||||||
|
.then( res => {
|
||||||
|
console.log(res);
|
||||||
|
let metadata = res.data;
|
||||||
|
commit('setSingleMetadata', metadata);
|
||||||
|
})
|
||||||
|
.catch( error => {
|
||||||
|
console.log('error', error);
|
||||||
|
})
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const fetchMetadata = ({ commit }, item_id) => {
|
export const fetchMetadata = ({ commit }, item_id) => {
|
||||||
|
|
Loading…
Reference in New Issue