front end fixes item metadata edition

This commit is contained in:
Leo Germani 2018-04-06 00:24:41 -03:00
parent 9f73a25ef4
commit bdd6ae46ba
2 changed files with 3 additions and 1 deletions

View File

@ -45,7 +45,7 @@ class Item_Metadata_Entity extends Entity {
public function __toArray(){ public function __toArray(){
$value = $this->get_value(); $value = $this->get_value();
if(is_array($value) && $value[0] instanceof Term){ if(is_array($value) && isset($value[0]) && $value[0] instanceof Term){
$values_arr = []; $values_arr = [];
foreach ($value as $val){ foreach ($value as $val){

View File

@ -11,6 +11,7 @@ export const eventBus = new Vue({
if( tainacan_plugin.components ){ if( tainacan_plugin.components ){
this.componentsTag = tainacan_plugin.components; this.componentsTag = tainacan_plugin.components;
} }
this.$on('input', data => this.updateValue(data) );
}, },
methods : { methods : {
registerComponent( name ){ registerComponent( name ){
@ -22,6 +23,7 @@ export const eventBus = new Vue({
const components = this.getAllComponents(); const components = this.getAllComponents();
for (let eventElement of components){ for (let eventElement of components){
eventElement.addEventListener('input', (event) => { eventElement.addEventListener('input', (event) => {
if (event.detail && event.detail[0] ){ if (event.detail && event.detail[0] ){
this.updateValue({ this.updateValue({
item_id: $(eventElement).attr("item_id"), item_id: $(eventElement).attr("item_id"),