Merge branch 'develop' of https://github.com/tainacan/tainacan into develop
This commit is contained in:
commit
ea77249da1
|
@ -4,7 +4,7 @@
|
|||
grouped
|
||||
group-multiline>
|
||||
<button
|
||||
v-if="selectedCollections.length > 0"
|
||||
v-if="selectedCollections.length > 0 && collections.length > 0 && collections[0].current_user_can_edit"
|
||||
class="button field is-danger"
|
||||
@click="deleteSelectedCollections()">
|
||||
<span>{{ $i18n.get('instruction_delete_selected_collections') }} </span>
|
||||
|
@ -86,6 +86,7 @@
|
|||
|
||||
<b-table-column
|
||||
tabindex="0"
|
||||
v-if="props.row.current_user_can_edit"
|
||||
:label="$i18n.get('label_actions')"
|
||||
width="78"
|
||||
:aria-label="$i18n.get('label_actions')">
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
grouped
|
||||
group-multiline>
|
||||
<button
|
||||
v-if="selectedItems.length > 0"
|
||||
v-if="selectedItems.length > 0 && items.length > 0 && items[0].current_user_can_edit"
|
||||
class="button field is-danger"
|
||||
@click="deleteSelectedItems()">
|
||||
<span>{{ $i18n.get('instruction_delete_selected_items') }} </span><b-icon icon="delete"/>
|
||||
|
@ -24,6 +24,7 @@
|
|||
<template slot-scope="props">
|
||||
<b-table-column
|
||||
v-for="(column, index) in tableFields"
|
||||
v-if="column.field != 'row_actions' || (column.field == 'row_actions' && props.row.current_user_can_edit)"
|
||||
:key="index"
|
||||
:custom-key="column.slug"
|
||||
:label="column.name"
|
||||
|
@ -31,12 +32,17 @@
|
|||
:class="column.field == 'row_creation' ? 'row-creation' : ''"
|
||||
:width="column.field == 'row_actions' ? 78 : column.field == 'row_thumbnail' ? 55 : undefined ">
|
||||
|
||||
<template>
|
||||
<template v-if="column.field != 'row_thumbnail' && column.field != 'row_actions' && column.field != 'row_creation'">
|
||||
<span
|
||||
class="clickable-row"
|
||||
class="clickable-row"
|
||||
v-if="props.row.metadata[column.slug].value_as_html == props.row.metadata[column.slug].value_as_string"
|
||||
@click.prevent="goToItemPage(props.row.id)"
|
||||
v-if="column.field != 'row_thumbnail' && column.field != 'row_actions' && column.field != 'row_creation'"
|
||||
v-html="renderMetadata( props.row.metadata[column.slug] )" />
|
||||
v-html="renderMetadata( props.row.metadata[column.slug] )" />
|
||||
<span
|
||||
class="clickable-row"
|
||||
v-if="props.row.metadata[column.slug].value_as_html != props.row.metadata[column.slug].value_as_string"
|
||||
v-html="renderMetadata( props.row.metadata[column.slug] )" />
|
||||
|
||||
</template>
|
||||
|
||||
<template v-if="column.field == 'row_thumbnail'">
|
||||
|
|
|
@ -25,61 +25,71 @@
|
|||
</div>
|
||||
</div>
|
||||
<ul class="menu-list level-right">
|
||||
<li class="level-item"><router-link
|
||||
tag="a"
|
||||
:to="{ path: $routerHelper.getCollectionItemsPath(id, '') }"
|
||||
:class="activeRoute == 'ItemPage' || activeRoute == 'CollectionItemsPage' || activeRoute == 'ItemEditionForm' || activeRoute == 'ItemCreatePage' ? 'is-active':''"
|
||||
:aria-label="$i18n.get('label_collection_items')">
|
||||
<b-icon
|
||||
<li class="level-item">
|
||||
<router-link
|
||||
tag="a"
|
||||
:to="{ path: $routerHelper.getCollectionItemsPath(id, '') }"
|
||||
:class="activeRoute == 'ItemPage' || activeRoute == 'CollectionItemsPage' || activeRoute == 'ItemEditionForm' || activeRoute == 'ItemCreatePage' ? 'is-active':''"
|
||||
:aria-label="$i18n.get('label_collection_items')">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="folder-outline"/>
|
||||
<br>
|
||||
<span class="menu-text">{{ $i18n.getFrom('collections', 'singular_name') }}</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<li class="level-item">
|
||||
<router-link
|
||||
tag="a"
|
||||
:to="{ path: $routerHelper.getCollectionEditPath(id) }"
|
||||
:class="activeRoute == 'CollectionEditionForm' ? 'is-active':''"
|
||||
:aria-label="$i18n.getFrom('collections','edit_item')">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="pencil"/>
|
||||
<br>
|
||||
<span class="menu-text">{{ $i18n.get('edit') }}</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<li class="level-item">
|
||||
<router-link
|
||||
tag="a"
|
||||
:to="{ path: $routerHelper.getCollectionFieldsPath(id) }"
|
||||
:class="activeRoute == 'FieldsList' ? 'is-active':''"
|
||||
:aria-label="$i18n.get('label_collection_fields')">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="folder-outline"/>
|
||||
<br>
|
||||
<span class="menu-text">{{ $i18n.getFrom('collections', 'singular_name') }}</span>
|
||||
</router-link></li>
|
||||
<li class="level-item"><router-link
|
||||
tag="a"
|
||||
:to="{ path: $routerHelper.getCollectionEditPath(id) }"
|
||||
:class="activeRoute == 'CollectionEditionForm' ? 'is-active':''"
|
||||
:aria-label="$i18n.getFrom('collections','edit_item')">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="pencil"/>
|
||||
<br>
|
||||
<span class="menu-text">{{ $i18n.get('edit') }}</span>
|
||||
</router-link></li>
|
||||
<li class="level-item"><router-link
|
||||
tag="a"
|
||||
:to="{ path: $routerHelper.getCollectionFieldsPath(id) }"
|
||||
:class="activeRoute == 'FieldsList' ? 'is-active':''"
|
||||
:aria-label="$i18n.get('label_collection_fields')">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="format-list-bulleted-type"/>
|
||||
<br>
|
||||
<span class="menu-text">{{ $i18n.getFrom('fields', 'name') }}</span>
|
||||
</router-link></li>
|
||||
<li class="level-item"><router-link
|
||||
tag="a"
|
||||
:to="{ path: $routerHelper.getCollectionFiltersPath(id) }"
|
||||
:class="activeRoute == 'FiltersList' ? 'is-active':''"
|
||||
:aria-label="$i18n.get('label_collection_filters')">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="filter"/>
|
||||
<br>
|
||||
<span class="menu-text">{{ $i18n.getFrom('filters', 'name') }}</span>
|
||||
</router-link></li>
|
||||
<li class="level-item"><router-link
|
||||
tag="a"
|
||||
:to="{ path: $routerHelper.getCollectionEventsPath(id) }"
|
||||
:class="activeRoute == 'CollectionEventsPage' ? 'is-active':''"
|
||||
:aria-label="$i18n.get('label_collection_events')">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="calendar-range"/>
|
||||
<br>
|
||||
<span class="menu-text">{{ $i18n.get('events') }}</span>
|
||||
</router-link></li>
|
||||
icon="format-list-bulleted-type"/>
|
||||
<br>
|
||||
<span class="menu-text">{{ $i18n.getFrom('fields', 'name') }}</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<li class="level-item">
|
||||
<router-link
|
||||
tag="a"
|
||||
:to="{ path: $routerHelper.getCollectionFiltersPath(id) }"
|
||||
:class="activeRoute == 'FiltersList' ? 'is-active':''"
|
||||
:aria-label="$i18n.get('label_collection_filters')">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="filter"/>
|
||||
<br>
|
||||
<span class="menu-text">{{ $i18n.getFrom('filters', 'name') }}</span>
|
||||
</router-link>
|
||||
</li>
|
||||
<li class="level-item">
|
||||
<router-link
|
||||
tag="a"
|
||||
:to="{ path: $routerHelper.getCollectionEventsPath(id) }"
|
||||
:class="activeRoute == 'CollectionEventsPage' ? 'is-active':''"
|
||||
:aria-label="$i18n.get('label_collection_events')">
|
||||
<b-icon
|
||||
size="is-small"
|
||||
icon="calendar-range"/>
|
||||
<br>
|
||||
<span class="menu-text">{{ $i18n.get('events') }}</span>
|
||||
</router-link>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<a
|
||||
@click="$router.go(-1)"
|
||||
class="back-link is-secondary">
|
||||
{{ $i18n.get('return') }}
|
||||
{{ $i18n.get('back') }}
|
||||
</a>
|
||||
<hr>
|
||||
<nav
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
<script>
|
||||
import TainacanSubheader from '../../components/navigation/tainacan-subheader.vue';
|
||||
import {mapActions} from 'vuex';
|
||||
|
||||
export default {
|
||||
name: 'CollectionPage',
|
||||
|
|
|
@ -28,7 +28,7 @@ return [
|
|||
'remove' => __( 'Remove', 'tainacan' ),
|
||||
'save' => __( 'Save', 'tainacan' ),
|
||||
'next' => __( 'Next', 'tainacan' ),
|
||||
'return' => __( 'Return', 'tainacan' ),
|
||||
'back' => __( 'Back', 'tainacan' ),
|
||||
'see' => __( 'See', 'tainacan' ),
|
||||
'search' => __( 'Search', 'tainacan' ),
|
||||
'advanced_search' => __( 'Advanced Search', 'tainacan' ),
|
||||
|
|
|
@ -12,8 +12,14 @@ export const filter_type_mixin = {
|
|||
query: {}
|
||||
},
|
||||
methods: {
|
||||
getValuesPlainText(field_id) {
|
||||
return axios.get('/collection/' + this.collection + '/fields/' + field_id + '?fetch=all_field_values')
|
||||
getValuesPlainText(fieldId, search) {
|
||||
let url = '/collection/' + this.collection + '/fields/' + fieldId + '?fetch=all_field_values&nopaging=1'
|
||||
|
||||
if( search ){
|
||||
url += "&search=" + search;
|
||||
}
|
||||
|
||||
return axios.get(url)
|
||||
.then(res => {
|
||||
if (res.data && res.data[0]) {
|
||||
for (let metadata of res.data[0]) {
|
||||
|
|
|
@ -21,25 +21,13 @@ class Old_Tainacan extends Importer
|
|||
$this->wordpress_api_address = "/wp-json/wp/v2";
|
||||
}
|
||||
|
||||
|
||||
public $avoid = [
|
||||
'ID',
|
||||
'post_author',
|
||||
'post_date',
|
||||
'post_date_gmt',
|
||||
'post_excerpt',
|
||||
'post_status',
|
||||
'comment_status',
|
||||
'ping_status',
|
||||
'post_name',
|
||||
'post_modified',
|
||||
'post_modified_gmt',
|
||||
'post_content_filtered',
|
||||
'post_parent',
|
||||
'guid',
|
||||
'comment_count',
|
||||
'filter',
|
||||
'link',
|
||||
'thumbnail'
|
||||
'socialdb_property_fixed_title',
|
||||
'socialdb_property_fixed_description',
|
||||
'socialdb_property_fixed_content',
|
||||
'socialdb_property_fixed_thumbnail',
|
||||
'socialdb_property_fixed_attachments'
|
||||
],
|
||||
$steps = [
|
||||
'Creating all categories' => 'create_categories',
|
||||
|
@ -160,7 +148,6 @@ class Old_Tainacan extends Importer
|
|||
$repo_meta = wp_remote_get($repository_meta_link);
|
||||
|
||||
$repo_meta_array = $this->verify_process_result($repo_meta);
|
||||
|
||||
$Fields_Repository = \Tainacan\Repositories\Fields::get_instance();
|
||||
$created_categories = $this->read_from_file("categories");
|
||||
$relationships = $this->read_from_file("relationships");
|
||||
|
@ -170,99 +157,173 @@ class Old_Tainacan extends Importer
|
|||
return false;
|
||||
}
|
||||
|
||||
public function create_meta_repo($repo_meta_array, $Fields_Repository, $created_categories, $relationships, $compound_id = null)
|
||||
private function create_meta_repo($repo_meta_array, $Fields_Repository, $created_categories, $relationships, $compound_id = null)
|
||||
{
|
||||
if($repo_meta_array)
|
||||
{
|
||||
$repository_fields = [];
|
||||
foreach ($repo_meta_array as $meta)
|
||||
{
|
||||
$avoid = [
|
||||
'socialdb_property_fixed_title',
|
||||
'socialdb_property_fixed_description',
|
||||
'socialdb_property_fixed_content',
|
||||
'socialdb_property_fixed_thumbnail',
|
||||
'socialdb_property_fixed_attachments'
|
||||
];
|
||||
|
||||
$special = [
|
||||
'socialdb_property_fixed_type',
|
||||
'stars'
|
||||
];
|
||||
|
||||
if(!in_array($meta->slug, $avoid) && !in_array($meta->type, $special))
|
||||
if(!in_array($meta->slug, $this->avoid) && !in_array($meta->type, $special))
|
||||
{
|
||||
$newField = new \Tainacan\Entities\Field();
|
||||
$newField = $this->set_fields_properties($meta, $created_categories, $relationships, $Fields_Repository, $compound_id);
|
||||
|
||||
$type = $this->define_type($meta->type);
|
||||
$newField->set_name($meta->name);
|
||||
|
||||
$newField->set_field_type('Tainacan\Field_Types\\'.$type);
|
||||
if(strcmp($type, "Category") === 0)
|
||||
if($newField)
|
||||
{
|
||||
$taxonomy_id = $meta->metadata->taxonomy;
|
||||
if(isset($created_categories[$taxonomy_id]))
|
||||
{
|
||||
$new_category_id = $created_categories[$taxonomy_id]['new_id'];
|
||||
$newField->set_field_type_options(['taxonomy_id' => $new_category_id]);
|
||||
}
|
||||
}else if(strcmp($type, "Relationship") === 0)
|
||||
{
|
||||
$taxonomy_id = $meta->metadata->object_category_id;
|
||||
|
||||
if(isset($relationships[$taxonomy_id]))
|
||||
{
|
||||
$new_collection_id = $relationships[$taxonomy_id]['new_id'];
|
||||
$newField->set_field_type_options(['collection_id' => $new_collection_id]);
|
||||
}
|
||||
}else if(strcmp($type, "Compound") === 0)
|
||||
{
|
||||
$this->create_meta_repo($meta->metadata->children, $Fields_Repository, $created_categories, $relationships, $newField->get_id());
|
||||
$Fields_Repository->insert($newField);
|
||||
$repository_fields[] = $meta->id.",".$newField->get_id().",".$meta->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*Compound treatement*/
|
||||
if($compound_id === null)
|
||||
{
|
||||
$newField->set_collection_id('default');
|
||||
}else //Set compound as field parent
|
||||
{
|
||||
$newField->set_parent($compound_id);
|
||||
}
|
||||
$this->save_in_file('repository_fields', $repository_fields);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($meta->metadata))
|
||||
{
|
||||
/*Properties of field*/
|
||||
if($meta->metadata->required == 1)
|
||||
{
|
||||
$newField->set_required(true);
|
||||
}
|
||||
if(!empty($meta->metadata->default_value))
|
||||
{
|
||||
$newField->set_default_value($meta->metadata->default_value);
|
||||
}
|
||||
if(!empty($meta->metadata->text_help))
|
||||
{
|
||||
/**/
|
||||
}
|
||||
if(!empty($meta->metadata->cardinality))
|
||||
{
|
||||
if($meta->metadata->cardinality > 1)
|
||||
{
|
||||
$newField->set_multiple('yes');
|
||||
}
|
||||
}
|
||||
}
|
||||
private function set_fields_properties($meta, $created_categories, $relationships, $Fields_Repository, $compound_id)
|
||||
{
|
||||
$newField = new \Tainacan\Entities\Field();
|
||||
|
||||
$newField->validate(); // there is no user input here, so we can be sure it will validate.
|
||||
$type = $this->define_type($meta->type);
|
||||
$newField->set_name($meta->name);
|
||||
|
||||
$Fields_Repository->insert($newField);
|
||||
$newField->set_field_type('Tainacan\Field_Types\\'.$type);
|
||||
if(strcmp($type, "Category") === 0)
|
||||
{
|
||||
$taxonomy_id = $meta->metadata->taxonomy;
|
||||
if(isset($created_categories[$taxonomy_id]))
|
||||
{
|
||||
$new_category_id = $created_categories[$taxonomy_id]['new_id'];
|
||||
$newField->set_field_type_options(['taxonomy_id' => $new_category_id]);
|
||||
}
|
||||
}else if(strcmp($type, "Relationship") === 0)
|
||||
{
|
||||
$taxonomy_id = $meta->metadata->object_category_id;
|
||||
|
||||
if(isset($relationships[$taxonomy_id]))
|
||||
{
|
||||
$new_collection_id = $relationships[$taxonomy_id]['new_id'];
|
||||
$newField->set_field_type_options(['collection_id' => $new_collection_id]);
|
||||
}
|
||||
}else if(strcmp($type, "Compound") === 0)
|
||||
{
|
||||
$this->create_meta_repo($meta->metadata->children, $Fields_Repository, $created_categories, $relationships, $newField->get_id());
|
||||
}
|
||||
|
||||
/*Compound treatement*/
|
||||
if($compound_id === null)
|
||||
{
|
||||
$newField->set_collection_id('default');
|
||||
}else //Set compound as field parent
|
||||
{
|
||||
$newField->set_parent($compound_id);
|
||||
}
|
||||
|
||||
/*Properties of field*/
|
||||
if(isset($meta->metadata))
|
||||
{
|
||||
if($meta->metadata->required == 1)
|
||||
{
|
||||
$newField->set_required(true);
|
||||
}
|
||||
if(!empty($meta->metadata->default_value))
|
||||
{
|
||||
$newField->set_default_value($meta->metadata->default_value);
|
||||
}
|
||||
if(!empty($meta->metadata->text_help))
|
||||
{
|
||||
/**/
|
||||
}
|
||||
if(!empty($meta->metadata->cardinality))
|
||||
{
|
||||
if($meta->metadata->cardinality > 1)
|
||||
{
|
||||
$newField->set_multiple('yes');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($newField->validate()){
|
||||
return $newField;
|
||||
}else return false;
|
||||
}
|
||||
|
||||
public function create_collection_metas()
|
||||
{
|
||||
return false;
|
||||
$created_collections = $this->read_from_file("collections");
|
||||
$created_repository_fields = $this->read_from_file("repository_fields");
|
||||
|
||||
list($start, $end) = $this->get_begin_end($created_collections);
|
||||
if($start === false) return false;
|
||||
|
||||
$Tainacan_Fields = \Tainacan\Repositories\Fields::get_instance();
|
||||
$Fields_Repository = \Tainacan\Repositories\Fields::get_instance();
|
||||
$Repository_Collections = \Tainacan\Repositories\Collections::get_instance();
|
||||
|
||||
for($i = 0; $i < $start; $i++)
|
||||
{
|
||||
next($created_collections);
|
||||
}
|
||||
|
||||
while($start < $end)
|
||||
{
|
||||
$collection_info = current($created_collections);
|
||||
$new_collection_id = $collection_info['new_id'];
|
||||
$old_collection_id = key($created_collections);
|
||||
$collection = $Repository_Collections->fetch($new_collection_id);
|
||||
$this->set_collection($collection);
|
||||
|
||||
$file_fields = $this->get_collection_fields($old_collection_id);
|
||||
if($file_fields)
|
||||
{
|
||||
foreach($file_fields as $index => $meta_info)
|
||||
{
|
||||
$meta_name = $meta_info['name'];
|
||||
$meta_slug = $meta_info['slug'];
|
||||
$type = $this->define_type($meta_info['type']);
|
||||
$old_field_id = $meta_info['id'];
|
||||
|
||||
if(!in_array($meta_slug, $this->avoid) && !isset($created_repository_fields[$old_field_id]))
|
||||
{
|
||||
//$newField = set_fields_properties($meta, $created_categories, $relationships, $Fields_Repository, $compound_id);
|
||||
$newField = new \Tainacan\Entities\Field();
|
||||
|
||||
$newField->set_name($meta_name);
|
||||
|
||||
$newField->set_field_type('Tainacan\Field_Types\\'.$type);
|
||||
|
||||
$newField->set_collection($this->collection);
|
||||
$newField->validate(); // there is no user input here, so we can be sure it will validate.
|
||||
|
||||
$newField = $Fields_Repository->insert($newField);
|
||||
|
||||
$mapping[$newField->get_id()] = $file_fields[$index];
|
||||
}else /*Map to respository fields*/
|
||||
{
|
||||
/*$fields = $Tainacan_Fields->fetch_by_collection( $this->collection, [], 'OBJECT' );
|
||||
print_r($fields);exit();
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
if($field->WP_Post->post_name === 'title' || $field->WP_Post->post_name === 'description')
|
||||
{
|
||||
$mapping[$field->get_id()] = $file_fields[$meta_name];
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//$this->set_mapping($mapping);
|
||||
next($created_collections);
|
||||
$start++;
|
||||
}
|
||||
|
||||
return $start;
|
||||
}
|
||||
|
||||
public function create_collection_items()
|
||||
|
@ -276,10 +337,31 @@ class Old_Tainacan extends Importer
|
|||
unlink($this->get_id()."_categories.txt");
|
||||
unlink($this->get_id()."_collections.txt");
|
||||
unlink($this->get_id()."_relationships.txt");
|
||||
unlink($this->get_id()."_repository_fields.txt");
|
||||
return false;
|
||||
}
|
||||
|
||||
/*Aux functions*/
|
||||
private function get_collection_fields($collections_id)
|
||||
{
|
||||
$fields_link = $this->get_url() . $this->tainacan_api_address . "/collections/".$collections_id."/metadata";
|
||||
$collection = wp_remote_get($fields_link);
|
||||
|
||||
$collection_metadata = $this->verify_process_result($collection);
|
||||
if($collection_metadata)
|
||||
{
|
||||
$fields = [];
|
||||
foreach ($collection_metadata[0]->{'tab-properties'} as $metadata)
|
||||
{
|
||||
$fields[] = ['name' => $metadata->name, 'type' => $metadata->type, 'slug' => $metadata->slug, 'id' => $metadata->id];
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function read_from_file($name)
|
||||
{
|
||||
$file_name = $this->get_id()."_".$name.".txt";
|
||||
|
@ -482,38 +564,6 @@ class Old_Tainacan extends Importer
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the fields of file/url to allow mapping
|
||||
* should return an array
|
||||
*
|
||||
* @return array $fields_source the fields from the source
|
||||
*/
|
||||
public function get_fields()
|
||||
{
|
||||
$file = new \SplFileObject( $this->tmp_file, 'r' );
|
||||
$file_content = unserialize($file->fread($file->getSize()));
|
||||
|
||||
$item = $file_content->items[0];
|
||||
$fields = [];
|
||||
|
||||
//Default meta
|
||||
foreach ($item->item as $meta_name => $value)
|
||||
{
|
||||
if(!in_array($meta_name, $this->avoid))
|
||||
{
|
||||
$fields[] = $meta_name;
|
||||
}
|
||||
}
|
||||
|
||||
//Added meta
|
||||
foreach ($item->metadata as $metadata)
|
||||
{
|
||||
$fields[] = ['name' => $metadata->name, 'type' => $metadata->type];
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* get values for a single item
|
||||
*
|
||||
|
@ -620,6 +670,10 @@ class Old_Tainacan extends Importer
|
|||
$this->set_mapping($mapping);
|
||||
}
|
||||
|
||||
public function get_fields()
|
||||
{
|
||||
|
||||
}
|
||||
/**
|
||||
* Method implemented by the child importer class to return the number of items to be imported
|
||||
* @return int
|
||||
|
|
|
@ -14,10 +14,10 @@ export const fetchItems = ({ rootGetters, dispatch, commit }, collectionId) => {
|
|||
hasFiltered = true;
|
||||
|
||||
// Differentiates between repository level and collection level queries
|
||||
let endpoint = '/collection/'+collectionId+'/items?'
|
||||
let endpoint = '/collection/'+collectionId+'/items?context=edit&'
|
||||
|
||||
if (collectionId == undefined)
|
||||
endpoint = '/items?'
|
||||
endpoint = '/items?context=edit&'
|
||||
|
||||
axios.tainacan.get(endpoint + qs.stringify(postQueries) )
|
||||
.then(res => {
|
||||
|
@ -46,7 +46,7 @@ export const deleteItem = ({ commit }, item_id ) => {
|
|||
export const fetchCollections = ({commit} , { page, collectionsPerPage }) => {
|
||||
commit('cleanCollections');
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.tainacan.get('/collections?paged='+page+'&perpage='+collectionsPerPage)
|
||||
axios.tainacan.get('/collections?paged='+page+'&perpage='+collectionsPerPage+'&context=edit')
|
||||
.then(res => {
|
||||
let collections = res.data;
|
||||
commit('setCollections', collections);
|
||||
|
|
Loading…
Reference in New Issue