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

This commit is contained in:
weryques 2018-04-06 12:11:52 -03:00
commit 03feff9b53
5 changed files with 8 additions and 3 deletions

View File

@ -3,6 +3,7 @@
<div class="sub-header">
<div class="header-item">
<router-link
id="button-collection-creation"
tag="button"
class="button is-secondary"
:to="{ path: $routerHelper.getNewCollectionPath() }">

View File

@ -5,6 +5,7 @@
<div class="sub-header">
<div class="header-item">
<router-link
id="button-item-creation"
tag="button"
class="button is-secondary"
:to="{ path: $routerHelper.getNewItemPath(collectionId) }">

View File

@ -262,14 +262,15 @@ class TAINACAN_REST_Fields_Controller extends TAINACAN_REST_Controller {
public function prepare_item_for_response( $item, $request ) {
if(!empty($item)){
$item_arr = $item->__toArray();
$item_arr['field_type_object'] = $item->get_field_type_object()->__toArray();
if($request['context'] === 'edit'){
$item_arr['current_user_can_edit'] = $item->can_edit();
ob_start();
$item->get_field_type_object()->form();
$form = ob_get_clean();
$item_arr['edit_form'] = $form;
$item_arr['field_type_object'] = $item->get_field_type_object()->__toArray();
$item_arr['enabled'] = $item->get_enabled_for_collection();
}

View File

@ -45,7 +45,7 @@ class Item_Metadata_Entity extends Entity {
public function __toArray(){
$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 = [];
foreach ($value as $val){

View File

@ -11,6 +11,7 @@ export const eventBus = new Vue({
if( tainacan_plugin.components ){
this.componentsTag = tainacan_plugin.components;
}
this.$on('input', data => this.updateValue(data) );
},
methods : {
registerComponent( name ){
@ -22,6 +23,7 @@ export const eventBus = new Vue({
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"),