Fixes thumnail exhibition, Implements UpdateMetadata

This commit is contained in:
weryques 2018-01-29 14:42:59 -02:00
parent badfb6e655
commit 33d3f06651
6 changed files with 24 additions and 12 deletions

View File

@ -8,21 +8,21 @@ current_OS=`uname`
# For macOS (Darwin)
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
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
new_md5=$(<last-js-build.md5)
if [ "$current_md5" != "$new_md5" ]
then
npm run build
## Compile SASS
sh compile-sass.sh
fi
### END npm build ###
## Compile SASS
sh compile-sass.sh
## Install composer dependencies
composer install

View File

@ -29,7 +29,7 @@ class TAINACAN_REST_Controller extends WP_REST_Controller {
}
if(array_key_exists('columns', $map)){
$entity_prepared['featured_image'] = $entity->get_columns();
$entity_prepared['columns'] = $entity->get_columns();
}
return $entity_prepared;

View File

@ -119,7 +119,7 @@ class TAINACAN_REST_Collections_Controller extends TAINACAN_REST_Controller {
if ($item->have_posts()) {
while ( $item->have_posts() ) {
$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);

View File

@ -51,11 +51,11 @@
},
setInitValueOnStore(){
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 ){
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 });
}
}
}

View File

@ -283,8 +283,7 @@ abstract class Repository {
} elseif ( isset( $entity->WP_Post )) {
if($mapped == 'thumbnail'){
$property = get_the_post_thumbnail_url($entity->WP_Post->ID, 'full');
}
else {
} else {
$property = isset($entity->WP_Post->$mapped) ? $entity->WP_Post->$mapped : null;
}
} elseif ( isset( $entity->WP_Term )) {

View File

@ -24,7 +24,20 @@ export const sendMetadata = ( { 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) => {