Merge branch 'develop' of https://github.com/tainacan/tainacan into develop
This commit is contained in:
commit
80d576b12e
|
@ -80,20 +80,18 @@ export default {
|
||||||
|
|
||||||
.level-item{
|
.level-item{
|
||||||
height: $header-height;
|
height: $header-height;
|
||||||
width: 184px;
|
width: 180px;
|
||||||
transition: width 0.15s;
|
transition: width 0.15s, background-color 0.2s;
|
||||||
-webkit-transition: width linear 0.15s;
|
-webkit-transition: width 0.15s background-color 0.2s;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&:hover{
|
|
||||||
background-color: #257787;
|
background-color: #257787;
|
||||||
}
|
|
||||||
&:focus {
|
&:focus {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
.tainacan-logo {
|
.tainacan-logo {
|
||||||
max-height: 22px;
|
max-height: 22px;
|
||||||
padding: 0px 28px;
|
padding: 0px 24px;
|
||||||
transition: padding 0.15s;
|
transition: padding 0.15s;
|
||||||
-webkit-transition: padding linear 0.15s;
|
-webkit-transition: padding linear 0.15s;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +106,7 @@ export default {
|
||||||
color: $tertiary;
|
color: $tertiary;
|
||||||
}
|
}
|
||||||
.search-area {
|
.search-area {
|
||||||
display: flex;
|
display: none;//display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-right: 36px;
|
margin-right: 36px;
|
||||||
|
|
||||||
|
@ -140,6 +138,7 @@ export default {
|
||||||
&.menu-compressed {
|
&.menu-compressed {
|
||||||
.level-left .level-item {
|
.level-left .level-item {
|
||||||
width: 220px;
|
width: 220px;
|
||||||
|
background-color: $secondary;
|
||||||
.tainacan-logo {
|
.tainacan-logo {
|
||||||
padding: 0px 42px;
|
padding: 0px 42px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
{{ $i18n.get('add_one_item') }}
|
{{ $i18n.get('add_one_item') }}
|
||||||
</router-link>
|
</router-link>
|
||||||
</b-dropdown-item>
|
</b-dropdown-item>
|
||||||
<b-dropdown-item>{{ $i18n.get('add_items_bulk') }}
|
<b-dropdown-item disabled>{{ $i18n.get('add_items_bulk') + ' (Not ready)' }}
|
||||||
</b-dropdown-item>
|
</b-dropdown-item>
|
||||||
<b-dropdown-item>{{ $i18n.get('add_items_external_source') }}<br><small class="is-small">{{ $i18n.get() }}</small></b-dropdown-item>
|
<b-dropdown-item disabled>{{ $i18n.get('add_items_external_source') + ' (Not ready)' }}<br><small class="is-small">{{ $i18n.get() }}</small></b-dropdown-item>
|
||||||
</b-dropdown>
|
</b-dropdown>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -13,16 +13,14 @@ export default {
|
||||||
button: {
|
button: {
|
||||||
text: this.params.button_labels.frame_button
|
text: this.params.button_labels.frame_button
|
||||||
},
|
},
|
||||||
library: {
|
|
||||||
uploadedTo: this.params.relatedPostId
|
|
||||||
},
|
|
||||||
states: [
|
states: [
|
||||||
new wp.media.controller.Library({
|
new wp.media.controller.Library({
|
||||||
title: this.params.button_labels.frame_title,
|
title: this.params.button_labels.frame_title,
|
||||||
library: wp.media.query({ type: this.params.mime_type }),
|
library: wp.media.query({
|
||||||
multiple: true,
|
|
||||||
date: false,
|
|
||||||
uploadedTo: this.params.relatedPostId
|
uploadedTo: this.params.relatedPostId
|
||||||
|
}),
|
||||||
|
multiple: true,
|
||||||
|
date: false
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
@ -72,17 +70,17 @@ export default {
|
||||||
text: l10n.select,
|
text: l10n.select,
|
||||||
close: false
|
close: false
|
||||||
},
|
},
|
||||||
library: {
|
|
||||||
type: 'image',
|
|
||||||
uploadedTo: this.params.relatedPostId
|
|
||||||
},
|
|
||||||
uploader: true,
|
uploader: true,
|
||||||
states: [
|
states: [
|
||||||
new wp.media.controller.Library({
|
new wp.media.controller.Library({
|
||||||
title: this.params.button_labels.frame_title,
|
title: this.params.button_labels.frame_title,
|
||||||
library: wp.media.query({ type: 'image' }),
|
library: wp.media.query({
|
||||||
|
type: 'image',
|
||||||
|
uploadedTo: this.params.relatedPostId
|
||||||
|
}),
|
||||||
multiple: false,
|
multiple: false,
|
||||||
date: false,
|
date: false,
|
||||||
|
filterable: true,
|
||||||
priority: 20,
|
priority: 20,
|
||||||
suggestedWidth: this.params.width,
|
suggestedWidth: this.params.width,
|
||||||
suggestedHeight: this.params.height,
|
suggestedHeight: this.params.height,
|
||||||
|
@ -130,21 +128,19 @@ export default {
|
||||||
text: l10n.select,
|
text: l10n.select,
|
||||||
close: false
|
close: false
|
||||||
},
|
},
|
||||||
library: {
|
|
||||||
type: 'image',
|
|
||||||
uploadedTo: this.params.relatedPostId
|
|
||||||
},
|
|
||||||
uploader: true,
|
uploader: true,
|
||||||
states: [
|
states: [
|
||||||
new wp.media.controller.Library({
|
new wp.media.controller.Library({
|
||||||
title: this.params.button_labels.frame_title,
|
title: this.params.button_labels.frame_title,
|
||||||
library: wp.media.query({ type: 'image' }),
|
library: wp.media.query({
|
||||||
|
type: 'image',
|
||||||
|
uploadedTo: this.params.relatedPostId
|
||||||
|
}),
|
||||||
multiple: false,
|
multiple: false,
|
||||||
date: false,
|
date: false,
|
||||||
priority: 20,
|
priority: 20,
|
||||||
suggestedWidth: this.params.width,
|
suggestedWidth: this.params.width,
|
||||||
suggestedHeight: this.params.height,
|
suggestedHeight: this.params.height
|
||||||
uploadedTo: this.params.relatedPostId
|
|
||||||
}),
|
}),
|
||||||
new wp.media.controller.CustomizeImageCropper({
|
new wp.media.controller.CustomizeImageCropper({
|
||||||
imgSelectOptions: this.calculateImageSelectOptions,
|
imgSelectOptions: this.calculateImageSelectOptions,
|
||||||
|
@ -182,13 +178,12 @@ export default {
|
||||||
button: {
|
button: {
|
||||||
text: this.params.button_labels.frame_button
|
text: this.params.button_labels.frame_button
|
||||||
},
|
},
|
||||||
library: {
|
|
||||||
uploadedTo: this.params.relatedPostId
|
|
||||||
},
|
|
||||||
states: [
|
states: [
|
||||||
new wp.media.controller.Library({
|
new wp.media.controller.Library({
|
||||||
title: this.params.button_labels.frame_title,
|
title: this.params.button_labels.frame_title,
|
||||||
library: wp.media.query({ type: this.params.mime_type }),
|
library: wp.media.query({
|
||||||
|
uploadedTo: this.params.relatedPostId
|
||||||
|
}),
|
||||||
multiple: false,
|
multiple: false,
|
||||||
date: false,
|
date: false,
|
||||||
uploadedTo: this.params.relatedPostId
|
uploadedTo: this.params.relatedPostId
|
||||||
|
|
|
@ -92,6 +92,10 @@ class Old_Tainacan extends Importer
|
||||||
$Tainacan_Taxonomies->insert($taxonomy);
|
$Tainacan_Taxonomies->insert($taxonomy);
|
||||||
|
|
||||||
$inserted_taxonomy = $Tainacan_Taxonomies->fetch($taxonomy->get_id());
|
$inserted_taxonomy = $Tainacan_Taxonomies->fetch($taxonomy->get_id());
|
||||||
|
|
||||||
|
/*Insert old tainacan id*/
|
||||||
|
add_post_meta($inserted_taxonomy->get_id(), 'old_tainacan_category_id', $category->term_id);
|
||||||
|
|
||||||
if(isset($category->children) && $inserted_taxonomy)
|
if(isset($category->children) && $inserted_taxonomy)
|
||||||
{
|
{
|
||||||
$this->add_all_terms($inserted_taxonomy, $category->children);
|
$this->add_all_terms($inserted_taxonomy, $category->children);
|
||||||
|
@ -122,6 +126,9 @@ class Old_Tainacan extends Importer
|
||||||
|
|
||||||
$inserted_term = $Tainacan_Terms->insert($new_term);
|
$inserted_term = $Tainacan_Terms->insert($new_term);
|
||||||
|
|
||||||
|
/*Insert old tainacan id*/
|
||||||
|
add_term_meta($inserted_term->get_id(), 'old_tainacan_category_id', $term->term_id );
|
||||||
|
|
||||||
if(isset($term->children))
|
if(isset($term->children))
|
||||||
{
|
{
|
||||||
$this->add_all_terms($taxonomy_father, $term->children, $inserted_term);
|
$this->add_all_terms($taxonomy_father, $term->children, $inserted_term);
|
||||||
|
@ -151,11 +158,71 @@ class Old_Tainacan extends Importer
|
||||||
|
|
||||||
public function create_collections()
|
public function create_collections()
|
||||||
{
|
{
|
||||||
|
$collections_link = $this->get_url() . $this->tainacan_api_address . "/collections";
|
||||||
|
$collections = wp_remote_get($collections_link);
|
||||||
|
|
||||||
|
$collections_array = $this->verify_process_result($collections);
|
||||||
|
if($collections_array)
|
||||||
|
{
|
||||||
|
foreach ($collections_array as $collection)
|
||||||
|
{
|
||||||
|
$new_collection = new \Tainacan\Entities\Collection();
|
||||||
|
$new_collection->set_name($collection->post_title);
|
||||||
|
$new_collection->set_status('publish');
|
||||||
|
$new_collection->validate();
|
||||||
|
$new_collection = \Tainacan\Repositories\Collections::get_instance()->insert($new_collection);
|
||||||
|
|
||||||
|
/*Add old id*/
|
||||||
|
add_post_meta($new_collection->get_id(), "old_tainacan_collection_id", $collection->ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create_repo_meta()
|
public function create_repo_meta()
|
||||||
{
|
{
|
||||||
|
$repository_meta_link = $this->get_url() . $this->tainacan_api_address . "/repository/metadata";
|
||||||
|
$repo_meta = wp_remote_get($repository_meta_link);
|
||||||
|
|
||||||
|
$repo_meta_array = $this->verify_process_result($repo_meta);
|
||||||
|
if($repo_meta_array)
|
||||||
|
{
|
||||||
|
$Fields_Repository = \Tainacan\Repositories\Fields::get_instance();
|
||||||
|
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',
|
||||||
|
'stars',
|
||||||
|
'item',
|
||||||
|
'tree',
|
||||||
|
'compound'
|
||||||
|
];
|
||||||
|
|
||||||
|
$special = [
|
||||||
|
'socialdb_property_fixed_type'
|
||||||
|
];
|
||||||
|
|
||||||
|
if(!in_array($meta->slug, $avoid) && !in_array($meta->type, $avoid))
|
||||||
|
{
|
||||||
|
$newField = new \Tainacan\Entities\Field();
|
||||||
|
|
||||||
|
$type = $this->define_type($meta->type);
|
||||||
|
$newField->set_name($meta->name);
|
||||||
|
|
||||||
|
$newField->set_field_type('Tainacan\Field_Types\\'.$type);
|
||||||
|
|
||||||
|
$newField->set_collection_id('default');
|
||||||
|
$newField->validate(); // there is no user input here, so we can be sure it will validate.
|
||||||
|
|
||||||
|
$Fields_Repository->insert($newField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,6 +233,7 @@ class Old_Tainacan extends Importer
|
||||||
|
|
||||||
public function create_collection_items()
|
public function create_collection_items()
|
||||||
{
|
{
|
||||||
|
/*Use standard method*/
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,11 +444,23 @@ class Old_Tainacan extends Importer
|
||||||
$type = strtolower($type);
|
$type = strtolower($type);
|
||||||
$tainacan_types = ['text', 'textarea', 'numeric', 'date'];
|
$tainacan_types = ['text', 'textarea', 'numeric', 'date'];
|
||||||
|
|
||||||
$types_to_work = ['item', 'tree'];
|
|
||||||
if(in_array($type, $tainacan_types))
|
if(in_array($type, $tainacan_types))
|
||||||
{
|
{
|
||||||
$type = ucfirst($type);
|
$type = ucfirst($type);
|
||||||
}else $type = 'Text';
|
}else if(strcmp($type, 'autoincrement') === 0)
|
||||||
|
{
|
||||||
|
$type = "Numeric";
|
||||||
|
}else if(strcmp($type, 'item'))
|
||||||
|
{
|
||||||
|
$type = "Relationship";
|
||||||
|
}else if(strcmp($type, 'tree'))
|
||||||
|
{
|
||||||
|
$type = "Category";
|
||||||
|
}else if(strcmp($type, 'compound'))
|
||||||
|
{
|
||||||
|
$type = "Compound";
|
||||||
|
}
|
||||||
|
else $type = 'Text';
|
||||||
|
|
||||||
return $type;
|
return $type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,17 @@ class ImporterTests extends TAINACAN_UnitTestCase {
|
||||||
$url = 'http://localhost/';
|
$url = 'http://localhost/';
|
||||||
$_SESSION['tainacan_importer'][$id]->set_url($url);
|
$_SESSION['tainacan_importer'][$id]->set_url($url);
|
||||||
|
|
||||||
|
// One run for each step
|
||||||
|
//Create categories
|
||||||
$_SESSION['tainacan_importer'][$id]->run();
|
$_SESSION['tainacan_importer'][$id]->run();
|
||||||
|
|
||||||
|
//Create empty collections
|
||||||
|
$_SESSION['tainacan_importer'][$id]->run();
|
||||||
|
|
||||||
|
//Create repository metadata
|
||||||
|
$_SESSION['tainacan_importer'][$id]->run();
|
||||||
|
|
||||||
|
$this->assertTrue(true);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*public function test_file_old_tainacan () {
|
/*public function test_file_old_tainacan () {
|
||||||
|
@ -242,7 +252,7 @@ class ImporterTests extends TAINACAN_UnitTestCase {
|
||||||
public function test_fetch_file(){
|
public function test_fetch_file(){
|
||||||
$csv_importer = new Importer\CSV();
|
$csv_importer = new Importer\CSV();
|
||||||
$id = $csv_importer->get_id();
|
$id = $csv_importer->get_id();
|
||||||
/*$_SESSION['tainacan_importer'][$id]->fetch_from_remote( 'http://localhost/wordpress-test/wp-json' );
|
$_SESSION['tainacan_importer'][$id]->fetch_from_remote( 'http://localhost/wordpress-test/wp-json' );
|
||||||
$this->assertTrue( isset( $_SESSION['tainacan_importer'][$id]->tmp_file ) );*/
|
$this->assertTrue( isset( $_SESSION['tainacan_importer'][$id]->tmp_file ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue