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

This commit is contained in:
Jacson Passold 2018-07-16 11:55:27 -03:00
commit cb07acfcf0
39 changed files with 778 additions and 2275 deletions

View File

@ -1,4 +1,4 @@
sudo: false
sudo: true
language: php
php:
- 7.1
@ -23,16 +23,18 @@ apt:
services:
- mysql
before_install:
- sudo apt-get install sshpass
- sudo apt-get update
- sudo apt-get install sshpass
- sudo service mysql restart
- mysql -e 'CREATE DATABASE IF NOT EXISTS test;'
install:
- echo -e "Install"
- sudo mv ./tests/bootstrap-config-sample.php ./tests/bootstrap-config.php
- sudo ./tests/bin/install-wp-tests.sh test travis "" /tmp/wordpress localhost latest
true
true
- composer install
- sudo mkdir /tmp/wordpress/wordpress-test/wp-content/uploads
- sudo chmod -R 777 /tmp/wordpress/wordpress-test/wp-content/uploads
- sudo wget https://phar.phpunit.de/phpunit-6.5.7.phar -P /tmp
- sudo chmod +x /tmp/phpunit-6.5.7.phar
- sudo mv /tmp/phpunit-6.5.7.phar /usr/local/bin/phpunit-6
@ -52,6 +54,7 @@ before_deploy:
- ssh-add /tmp/deploy_rsa
- echo -e "Host $ssh_host\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- ssh-add -l
#teste Crontab
deploy:
- provider: script
script: sshpass -p '$ssh_password' ssh $ssh_user@$ssh_host sh /home/l3p/atualiza_git/atualiza_todos.sh #ssh $ssh_user@$ssh_host $script_deploy_tainacan

2153
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,6 @@
"axios": "^0.18.0",
"buefy": "^0.6.6",
"bulma": "^0.7.1",
"html-to-json": "^0.6.0",
"mdi": "^2.2.43",
"moment": "^2.22.2",
"npm": "^6.1.0",
@ -18,33 +17,33 @@
"v-mask": "^1.3.2",
"v-tooltip": "^2.0.0-rc.33",
"vue": "^2.5.16",
"node-sass": "^4.9.2",
"vue-router": "^3.0.1",
"vuedraggable": "^2.16.0",
"vuex": "^3.0.1"
},
"devDependencies": {
"autoprefixer": "^8.6.4",
"autoprefixer": "^8.6.5",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-3": "^6.24.1",
"cross-env": "^5.2.0",
"css-loader": "^0.28.11",
"css-loader": "^1.0.0",
"cypress": "^3.0.2",
"element-theme-chalk": "^2.4.3",
"eslint": "^5.0.1",
"eslint": "^5.1.0",
"eslint-loader": "^2.0.0",
"eslint-plugin-vue": "^4.5.0",
"file-loader": "^1.1.11",
"node-sass": "^4.9.1",
"postcss-loader": "^2.1.5",
"postcss-loader": "^2.1.6",
"sass-loader": "^7.0.3",
"style-loader": "^0.21.0",
"uglifyjs-webpack-plugin": "^1.2.7",
"vue-custom-element": "^3.2.1",
"vue-custom-element": "^3.2.2",
"vue-loader": "^15.2.4",
"vue-template-compiler": "^2.5.16",
"webpack": "^4.15.1",
"webpack": "^4.16.0",
"webpack-cli": "^3.0.8",
"webpack-dev-server": "^3.1.4"
}

View File

@ -18,7 +18,9 @@ class Admin {
private function __construct() {
add_action( 'wp_ajax_tainacan_date_i18n', array( &$this, 'ajax_date_i18n') );
add_action( 'wp_ajax_tainacan-date-i18n', array( &$this, 'ajax_date_i18n') );
add_action( 'wp_ajax_tainacan-sample-permalink', array( &$this, 'ajax_sample_permalink') );
add_action( 'admin_menu', array( &$this, 'add_admin_menu' ) );
add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ) );
@ -119,7 +121,7 @@ class Admin {
wp_localize_script( 'tainacan-user-admin', 'tainacan_plugin', $settings );
wp_enqueue_media();
wp_enqueue_script('undescore', includes_url('js') . '/underscore.min.js' );
wp_enqueue_script('underscore', includes_url('js') . '/underscore.min.js' );
wp_enqueue_script('jcrop');
wp_enqueue_script( 'customize-controls' );
@ -170,7 +172,6 @@ class Admin {
'root_wp_api' => esc_url_raw( rest_url() ) . 'wp/v2/',
'wp_ajax_url' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'wp_rest' ),
'sample_permalink_nonce' => wp_create_nonce( 'samplepermalink' ),
'components' => $components,
'i18n' => $tainacan_admin_i18n,
'user_caps' => $user_caps,
@ -242,5 +243,61 @@ class Admin {
wp_die();
}
function ajax_sample_permalink(){
$id = $_POST['post_id'];
$title = $_POST['new_title'];
$name = $_POST['new_slug'];
$post = get_post( $id );
if ( ! $post )
return array( '', '' );
$ptype = get_post_type_object($post->post_type);
// Hack: get_permalink() would return ugly permalink for drafts, so we will fake that our post is published.
if ( in_array( $post->post_status, array( 'auto-draft', 'draft', 'pending', 'future' ) ) ) {
$post->post_status = 'publish';
$post->post_name = sanitize_title($post->post_name ? $post->post_name : $post->post_title, $post->ID);
}
// If the user wants to set a new name -- override the current one
// Note: if empty name is supplied -- use the title instead, see #6072
if ( !is_null($name) )
$post->post_name = sanitize_title($name ? $name : $title, $post->ID);
$post->post_name = wp_unique_post_slug($post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent);
$post->filter = 'sample';
$permalink = get_permalink($post, true);
// Replace custom post_type Token with generic pagename token for ease of use.
$permalink = str_replace("%$post->post_type%", '%pagename%', $permalink);
// Handle page hierarchy
if ( $ptype->hierarchical ) {
$uri = get_page_uri($post);
if ( $uri ) {
$uri = untrailingslashit($uri);
$uri = strrev( stristr( strrev( $uri ), '/' ) );
$uri = untrailingslashit($uri);
}
/** This filter is documented in wp-admin/edit-tag-form.php */
$uri = apply_filters( 'editable_slug', $uri, $post );
if ( !empty($uri) )
$uri .= '/';
$permalink = str_replace('%pagename%', "{$uri}%pagename%", $permalink);
}
/** This filter is documented in wp-admin/edit-tag-form.php */
$permalink = array( 'permalink' => $permalink, 'slug' => apply_filters( 'editable_slug', $post->post_name, $post ) );
echo json_encode($permalink);
wp_die();
}
}

View File

@ -260,7 +260,8 @@
<b-input
id="tainacan-text-name"
v-model="form.name"
@focus="clearErrors('name')"/>
@blur="updateSlug"
@focus="clearErrors('name')"/>
</b-field>
<!-- Description -------------------------------- -->
@ -359,6 +360,7 @@
:message="$i18n.getHelperMessage('collections', 'slug')"/>
<b-input
id="tainacan-text-slug"
@input="updateSlug"
v-model="form.slug"
@focus="clearErrors('slug')"/>
</b-field>
@ -393,9 +395,11 @@
<script>
import { mapActions } from 'vuex';
import wpMediaFrames from '../../js/wp-media-frames';
import { wpAjax } from '../../js/mixins';
export default {
name: 'CollectionEditionForm',
mixins: [ wpAjax ],
data(){
return {
collectionId: Number,
@ -452,7 +456,8 @@ export default {
registeredViewModes: tainacan_plugin.registered_view_modes,
viewModesList: [],
fromImporter: '',
newPagePath: tainacan_plugin.admin_url + 'post-new.php?post_type=page'
newPagePath: tainacan_plugin.admin_url + 'post-new.php?post_type=page',
isUpdatingSlug: false,
}
},
methods: {
@ -471,6 +476,27 @@ export default {
...mapActions('metadata', [
'fetchMetadata'
]),
updateSlug: _.debounce(function() {
if(!this.form.name || this.form.name.length <= 0){
return;
}
this.isUpdatingSlug = true;
this.getSamplePermalink(this.collectionId, this.form.name, this.form.slug)
.then((res) => {
this.form.slug = res.data.slug;
this.isUpdatingSlug = false;
this.formErrorMessage = '';
this.editFormErrors = {};
})
.catch(errors => {
this.$console.error(errors);
this.isUpdatingSlug = false;
});
}, 500),
onSubmit() {
this.isLoading = true;
@ -770,8 +796,7 @@ export default {
}
},
mounted() {
if (this.$route.path.split("/").pop() != "new") {
if (!this.$route.path.includes("new")) {
document.getElementById('collection-page-container').addEventListener('scroll', ($event) => {
this.$emit('onShrinkHeader', ($event.target.scrollTop > 53));
});

View File

@ -408,13 +408,14 @@ export default {
let formElement = document.getElementById('importerOptionsForm');
let formData = new FormData(formElement);
let formObj = {};
for (let [key, value] of formData.entries())
formObj[key] = value;
this.updateImporterOptions({ sessionId: this.sessionId, optionsForm: formObj })
.then(updatedImporter => {
this.importer = updatedImporter;
this.finishRunImporter();
})
.catch((errors) => {

View File

@ -343,6 +343,19 @@
</div>
</div>-->
<!-- Collection -------------------------------- -->
<div class="section-label">
<label>{{ $i18n.get('collection') }}</label>
</div>
<div class="section-collection">
<div class="field has-addons">
<p>
{{ collectionName }}
</p>
</div>
</div>
<!-- Metadata from Collection-------------------------------- -->
<label class="section-label">{{ $i18n.get('metadata') }}</label>
<br>
<a
@ -353,8 +366,6 @@
type="is-gray"
:icon=" collapseAll ? 'menu-down' : 'menu-right'" />
</a>
<!-- Metadata from Collection-------------------------------- -->
<tainacan-form-item
v-for="(metadatum, index) of metadatumList"
:key="index"
@ -367,14 +378,17 @@
<div class="footer">
<!-- Last Updated Info -->
<div class="update-info-section">
<p>{{ ($i18n.get('info_updated_at') + ' ' + lastUpdated) }}
<em>
<span v-if="isUpdatingValues && !isEditingValues">&nbsp;&nbsp;{{ $i18n.get('info_updating_metadata_values') }}</span>
<span v-if="isEditingValues">&nbsp;&nbsp;{{ $i18n.get('info_editing_metadata_values') }}</span>
</em>
<p v-if="!isUpdatingValues">
{{ ($i18n.get('info_updated_at') + ' ' + lastUpdated) }}
<span class="help is-danger">{{ formErrorMessage }}</span>
</p>
<p
class="update-warning"
v-if="isUpdatingValues">
<b-icon icon="autorenew" />{{ $i18n.get('info_updating_metadata_values') }}
<span class="help is-danger">{{ formErrorMessage }}</span>
</p>
<p class="help is-danger">{{ errorList }}</p>
<p class="help is-danger">{{ formErrorMessage }}</p>
</div>
<div
class="form-submission-footer"
@ -408,7 +422,7 @@
<button
@click="onSubmit('draft')"
type="button"
class="button is-secondary">{{ form.status == 'draft' ? $i18n.get('label_update_draft') : $i18n.get('label_save_as_draft') }}</button>
class="button is-secondary">{{ form.status == 'draft' ? $i18n.get('label_update') : $i18n.get('label_save_as_draft') }}</button>
<button
@click="onSubmit(visibility)"
type="button"
@ -426,9 +440,10 @@
type="button"
class="button is-secondary">{{ $i18n.get('label_return_to_draft') }}</button>
<button
:disabled="formErrorMessage != undefined && formErrorMessage != ''"
@click="onSubmit(visibility)"
type="button"
class="button is-success">{{ $i18n.get('label_update') }}</button>
class="button is-secondary">{{ $i18n.get('label_update') }}</button>
</div>
</div>
</form>
@ -485,8 +500,8 @@ export default {
urlLink: '',
isTextModalActive: false,
textLink: '',
isEditingValues: false,
isUpdatingValues: false
isUpdatingValues: false,
collectionName: ''
}
},
computed: {
@ -498,9 +513,6 @@ export default {
},
lastUpdated() {
return this.getLastUpdated();
},
errrorList() {
return eventBus.errors;
}
},
components: {
@ -527,6 +539,7 @@ export default {
'getLastUpdated'
]),
...mapActions('collection', [
'fetchCollectionName',
'deleteItem',
]),
onSubmit(status) {
@ -820,6 +833,11 @@ export default {
this.fetchAttachments(this.itemId);
}
// Obtains collection name
this.fetchCollectionName(this.collectionId).then((collectionName) => {
this.collectionName = collectionName;
});
// Sets feedback variables
eventBus.$on('isUpdatingValue', (status) => {
this.isUpdatingValues = status;
@ -831,6 +849,12 @@ export default {
// })
// }
});
eventBus.$on('hasErrorsOnForm', (hasErrors) => {
if (hasErrors)
this.formErrorMessage = this.$i18n.get('info_errors_in_form');
else
this.formErrorMessage = '';
});
this.cleanLastUpdated();
},
mounted() {
@ -886,7 +910,7 @@ export default {
}
.page-container-shrinked {
height: calc(100% - 132px) !important; // Bigger than the others due footer's height
height: calc(100% - 118px) !important; // Bigger than the others due footer's height
}
.page-container {
@ -1058,36 +1082,48 @@ export default {
}
.footer {
padding: 24px $page-side-padding;
padding: 18px $page-side-padding;
position: absolute;
bottom: 0;
z-index: 999999;
background-color: white;
border-top: 2px solid $secondary;
background-color: $primary-lighter;
width: 100%;
height: 65px;
display: flex;
justify-content: flex-end;
align-items: center;
.form-submission-footer {
width: 100%;
display: flex;
justify-content: end;
.button {
margin-left: 6px;
margin-left: 16px;
margin-right: 6px;
}
.button.is-outlined {
margin-left: 0px;
margin-right: auto;
}
}
@keyframes blink {
from { color: $tertiary; }
to { color: $gray-light; }
}
.update-warning {
color: $tertiary;
animation-name: blink;
animation-duration: 0.5s;
animation-delay: 0.5s;
align-items: center;
display: flex;
}
.update-info-section {
text-align: center;
position: relative;
margin-top: -20px;
top: 28px;
color: $gray-light;
margin-right: auto;
}
.help {
display: inline-block;
font-size: 1.0em;
margin-top: 0;
margin-left: 24px;
}
}

View File

@ -135,8 +135,7 @@
<script>
import { wpAjax } from "../../js/mixins";
import { mapActions, mapGetters } from 'vuex';
import TermsList from '../lists/terms-list.vue'
import htmlToJSON from 'html-to-json';
import TermsList from '../lists/terms-list.vue';
import CustomDialog from '../other/custom-dialog.vue';
export default {
@ -260,7 +259,7 @@
this.isLoadingTaxonomy = false;
});
},
updateSlug(){
updateSlug: _.debounce(function(){
if(!this.form.name || this.form.name.length <= 0){
return;
}
@ -268,18 +267,8 @@
this.isUpdatingSlug = true;
this.getSamplePermalink(this.taxonomyId, this.form.name, this.form.slug)
.then(samplePermalink => {
let promise = htmlToJSON.parse(samplePermalink, {
permalink($doc) {
return $doc.find('#editable-post-name-full').text();
}
});
promise.done((result) => {
this.form.slug = result.permalink;
//this.$console.info(this.form.slug);
});
.then((res) => {
this.form.slug = res.data.slug;
this.isUpdatingSlug = false;
this.formErrorMessage = '';
@ -291,7 +280,7 @@
this.isUpdatingSlug = false;
});
},
}, 500),
createNewTaxonomy() {
// Puts loading on Draft Taxonomy creation
this.isLoadingTaxonomy = true;

View File

@ -92,13 +92,13 @@
</button>
</div>
<div class="control">
<button
<a
type="button"
v-if="editForm.url != undefined && editForm.url!= ''"
class="button is-secondary"
:href="editForm.url">
{{ $i18n.get('see') + ' ' + $i18n.get('term') }}
</button>
</a>
</div>
<div class="control">
<button

View File

@ -1,6 +1,6 @@
<template>
<div
v-if="totalCollections > 0 && !isLoading"
v-if="collections.length > 0 && !isLoading"
class="table-container">
<div class="selection-control">
<div class="field select-all is-pulled-left">
@ -13,7 +13,7 @@
<div class="field is-pulled-right">
<b-dropdown
position="is-bottom-left"
v-if="collections[0].current_user_can_edit"
v-if="$userCaps.hasCapability('delete_tainacan-collections')"
:disabled="!isSelectingCollections"
id="bulk-actions-dropdown">
<button

View File

@ -1,6 +1,6 @@
<template>
<div
v-if="total > 0 && !isLoading"
v-if="taxonomies.length > 0 && !isLoading"
class="table-container">
<div class="selection-control">
@ -14,7 +14,7 @@
<div class="field is-pulled-right">
<b-dropdown
position="is-bottom-left"
v-if="taxonomies[0].current_user_can_edit"
v-if="$userCaps.hasCapability('delete_tainacan-taxonomies')"
:disabled="!isSelecting"
id="bulk-actions-dropdown">
<button
@ -120,7 +120,7 @@
@click.prevent.stop="deleteOneTaxonomy(taxonomy.id)">
<b-icon
type="is-secondary"
icon="delete"/>
:icon="!isOnTrash ? 'delete' : 'delete-forever'"/>
</a>
</div>
</td>
@ -149,7 +149,8 @@
total: 0,
page: 1,
taxonomiesPerPage: 12,
taxonomies: Array
taxonomies: Array,
isOnTrash: false
},
watch: {
taxonomies() {
@ -188,7 +189,7 @@
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_taxonomy_delete'),
onConfirm: () => {
this.deleteTaxonomy(taxonomyId)
this.deleteTaxonomy({ taxonomyId: taxonomyId, isPermanently: this.isOnTrash })
.then(() => {
// this.$toast.open({
// duration: 3000,
@ -227,7 +228,7 @@
for (let i = 0; i < this.taxonomies.length; i++) {
if (this.selected[i]) {
this.deleteTaxonomy(this.taxonomies[i].id)
this.deleteTaxonomy({ taxonomyId: this.taxonomies[i].id, isPermanently: this.isOnTrash })
.then(() => {
// this.load();
// this.$toast.open({

View File

@ -1,5 +1,5 @@
<template>
<div>
<div class="extra-margin">
<collections-filter
:open="collapsed"
:query="getQuery"
@ -39,4 +39,10 @@
CollectionsFilter
}
}
</script>
</script>
<style>
.extra-margin {
margin-bottom: 40px;
}
</style>

View File

@ -1,6 +1,6 @@
// Overrides lodash by original WordPress Underscore Library
window.lodash = _.noConflict();
window.underscore = _.noConflict();
//window.lodash = _.noConflict();
//window.underscore = _.noConflict();
// Main imports
import Vue from 'vue';

View File

@ -15,30 +15,20 @@ export const wpAjax = {
},
methods: {
getSamplePermalink(id, newTitle, newSlug){
return new Promise((resolve, reject) => {
this.axiosWPAjax.post('', qs.stringify({
action: 'sample-permalink',
return this.axiosWPAjax.post('', qs.stringify({
action: 'tainacan-sample-permalink',
post_id: id,
new_title: newTitle,
new_slug: newSlug,
samplepermalinknonce: tainacan_plugin.sample_permalink_nonce,
}))
.then(res => {
resolve(res.data);
})
.catch(error => {
reject(error)
})
});
nonce: tainacan_plugin.nonce,
}));
},
getDatei18n(dateString){
this.axiosWPAjax.post('', qs.stringify({
action: 'tainacan_date_i18n',
return this.axiosWPAjax.post('', qs.stringify({
action: 'tainacan-date-i18n',
date_string: dateString,
nonce: tainacan_plugin.nonce,
})).then(res => {
return res.data
});
}));
},
}
};

View File

@ -62,7 +62,7 @@
:is-on-trash="status == 'trash'"/>
<!-- Empty state image -->
<div v-if="totalCollections <= 0 && !isLoading">
<div v-if="collections.length <= 0 && !isLoading">
<section class="section">
<div class="content has-text-grey has-text-centered">
<p>
@ -88,7 +88,7 @@
<!-- Footer -->
<div
class="pagination-area"
v-if="totalCollections > 0">
v-if="collections.length > 0">
<div class="shown-items">
{{
$i18n.get('info_showing_collections') +

View File

@ -216,12 +216,20 @@
</option> -->
</b-select>
<button
:disabled="totalItems <= 0"
class="button is-white is-small"
:disabled="totalItems <= 0 || order == 'DESC'"
@click="onChangeOrder()">
<span class="icon is-small gray-icon">
<i class="mdi mdi-sort-ascending"/>
</span>
</button>
<button
:disabled="totalItems <= 0 || order == 'ASC'"
class="button is-white is-small"
@click="onChangeOrder()">
<b-icon
class="gray-icon"
:icon="order === 'ASC' ? 'sort-ascending' : 'sort-descending'"/>
<span class="icon is-small gray-icon">
<i class="mdi mdi-sort-descending"/>
</span>
</button>
</b-field>
</div>
@ -247,6 +255,7 @@
<b-icon icon="menu-down" />
</button>
<b-dropdown-item
:class="{ 'is-active': viewModeOption == viewMode }"
v-for="(viewModeOption, index) of enabledViewModes"
:key="index"
:value="viewModeOption"
@ -272,39 +281,50 @@
class="button is-white"
slot="trigger">
<span>
<b-icon
class="gray-icon view-mode-icon"
:icon="(adminViewMode == 'table' || adminViewMode == undefined) ?
'table' : (adminViewMode == 'cards' ?
'view-list' : 'view-grid')"/>
<span class="icon is-small gray-icon">
<i
:class="{'mdi-table' : ( adminViewMode == 'table' || adminViewMode == undefined),
'mdi-view-list' : adminViewMode == 'cards',
'mdi-view-grid' : adminViewMode == 'grid',
'mdi-view-module' : adminViewMode == 'records'}"
class="mdi"/>
</span>
</span>
&nbsp;&nbsp;&nbsp;{{ $i18n.get('label_visualization') }}
<b-icon icon="menu-down" />
</button>
<b-dropdown-item :value="'table'">
<b-dropdown-item
:class="{ 'is-active': adminViewMode == 'table' }"
:value="'table'">
<b-icon
class="gray-icon"
icon="table"/>
{{ $i18n.get('label_table') }}
</b-dropdown-item>
<b-dropdown-item :value="'cards'">
<b-dropdown-item
:class="{ 'is-active': adminViewMode == 'cards' }"
:value="'cards'">
<b-icon
class="gray-icon"
icon="view-list"/>
{{ $i18n.get('label_cards') }}
</b-dropdown-item>
<b-dropdown-item :value="'records'">
<b-icon
class="gray-icon"
icon="view-module"/>
{{ $i18n.get('label_records') }}
</b-dropdown-item>
<b-dropdown-item :value="'grid'">
<b-dropdown-item
:class="{ 'is-active': adminViewMode == 'grid' }"
:value="'grid'">
<b-icon
class="gray-icon"
icon="view-grid"/>
{{ $i18n.get('label_grid') }}
</b-dropdown-item>
<b-dropdown-item
:class="{ 'is-active': adminViewMode == 'records' }"
:value="'records'">
<b-icon
class="gray-icon"
icon="view-module"/>
{{ $i18n.get('label_records') }}
</b-dropdown-item>
</b-dropdown>
</b-field>
</div>
@ -327,7 +347,7 @@
class="control">
<button
@click="advancedSearchResults = !advancedSearchResults"
class="button is-small is-light">{{ $i18n.get('edit_search') }}</button>
class="button is-small is-outlined">{{ $i18n.get('edit_search') }}</button>
</p>
<p
v-if="advancedSearchResults"
@ -1002,8 +1022,9 @@
.gray-icon, .gray-icon .icon {
color: $tainacan-placeholder-color !important;
padding-right: 10px;
}
.gray-icon .icon i::before, .gray-icon i::before {
.gray-icon .icon i::before, .gray-icon i::before {
font-size: 21px !important;
}
@ -1018,11 +1039,13 @@
div.dropdown-content {
padding: 0;
.metadata-options-container {
max-height: 240px;
overflow: auto;
}
.dropdown-item {
padding: 0.25rem 1.0rem 0.25rem 0.75rem;
}
.dropdown-item span{
vertical-align: sub;
}

View File

@ -37,12 +37,13 @@
<taxonomies-list
:is-loading="isLoading"
:total="total"
:is-on-trash="status == 'trash'"
:page="page"
:taxonomies-per-page="taxonomiesPerPage"
:taxonomies="taxonomies"/>
<!-- Empty state image -->
<div v-if="total <= 0 && !isLoading">
<div v-if="taxonomies.length <= 0 && !isLoading">
<section class="section">
<div class="content has-text-grey has-text-centered">
<p>
@ -67,7 +68,7 @@
<!-- Footer -->
<div
class="pagination-area"
v-if="total > 0">
v-if="taxonomies.length > 0">
<div class="shown-items">
{{
$i18n.get('info_showing_taxonomies') +

View File

@ -9,156 +9,175 @@
<b-icon :icon="isMetadataColumnCompressed ? 'menu-left' : 'menu-right'" />
</button>
<tainacan-title/>
<div class="tainacan-form columns">
<div class="column is-5-5">
<div class="tainacan-form">
<div class="columns">
<div class="column is-5-5">
<!-- Document -------------------------------- -->
<div class="section-label">
<label>{{ item.document !== undefined && item.document !== null && item.document !== '' ?
$i18n.get('label_document') : $i18n.get('label_document_empty') }}</label>
</div>
<div class="section-box">
<div
v-if="item.document !== undefined && item.document !== null &&
item.document_type !== undefined && item.document_type !== null &&
item.document !== '' && item.document_type !== 'empty'">
<!-- Document -------------------------------- -->
<div class="section-label">
<label>{{ item.document !== undefined && item.document !== null && item.document !== '' ?
$i18n.get('label_document') : $i18n.get('label_document_empty') }}</label>
</div>
<div class="section-box">
<div
v-if="item.document !== undefined && item.document !== null &&
item.document_type !== undefined && item.document_type !== null &&
item.document !== '' && item.document_type !== 'empty'">
<div v-if="item.document_type === 'attachment'">
<div v-html="item.document_as_html"/>
<div v-if="item.document_type === 'attachment'">
<div v-html="item.document_as_html"/>
</div>
<div v-else-if="item.document_type === 'text'">
<div v-html="item.document_as_html"/>
</div>
<div v-else-if="item.document_type === 'url'">
<div v-html="item.document_as_html"/>
</div>
</div>
<div v-else-if="item.document_type === 'text'">
<div v-html="item.document_as_html"/>
</div>
<div v-else-if="item.document_type === 'url'">
<div v-html="item.document_as_html"/>
<div v-else>
<p>{{ $i18n.get('info_no_document_to_item') }}</p>
</div>
</div>
</div>
<!-- Thumbnail -------------------------------- -->
<div class="section-label">
<label>{{ $i18n.get('label_thumbnail') }}</label>
</div>
<div class="section-box section-thumbnail">
<div class="thumbnail-field">
<file-item
v-if="item.thumbnail != undefined && item.thumbnail.thumb != undefined && item.thumbnail.thumb != false"
:show-name="false"
:size="178"
:file="{
media_type: 'image',
guid: { rendered: item.thumbnail.thumb },
title: { rendered: $i18n.get('label_thumbnail')},
description: { rendered: `<img alt='Thumbnail' src='` + item.thumbnail.full + `'/>` }}"/>
<figure
v-if="item.thumbnail == undefined || item.thumbnail.thumb == undefined || item.thumbnail.thumb == false"
class="image">
<span class="image-placeholder">{{ $i18n.get('label_empty_thumbnail') }}</span>
<img
:alt="$i18n.get('label_thumbnail')"
:src="thumbPlaceholderPath">
</figure>
<!-- Thumbnail -------------------------------- -->
<div class="section-label">
<label>{{ $i18n.get('label_thumbnail') }}</label>
</div>
<div class="section-box section-thumbnail">
<div class="thumbnail-field">
<file-item
v-if="item.thumbnail != undefined && item.thumbnail.thumb != undefined && item.thumbnail.thumb != false"
:show-name="false"
:size="178"
:file="{
media_type: 'image',
guid: { rendered: item.thumbnail.thumb },
title: { rendered: $i18n.get('label_thumbnail')},
description: { rendered: `<img alt='Thumbnail' src='` + item.thumbnail.full + `'/>` }}"/>
<figure
v-if="item.thumbnail == undefined || item.thumbnail.thumb == undefined || item.thumbnail.thumb == false"
class="image">
<span class="image-placeholder">{{ $i18n.get('label_empty_thumbnail') }}</span>
<img
:alt="$i18n.get('label_thumbnail')"
:src="thumbPlaceholderPath">
</figure>
</div>
</div>
<!-- Attachments ------------------------------------------ -->
<div class="section-label">
<label>{{ $i18n.get('label_attachments') }}</label>
</div>
<div class="section-box section-attachments">
<div class="uploaded-files">
<file-item
:style="{ margin: 15 + 'px'}"
v-if="attachmentsList.length > 0"
v-for="(attachment, index) in attachmentsList"
:key="index"
:show-name="true"
:file="attachment"/>
<p v-if="attachmentsList.length <= 0"><br>{{ $i18n.get('info_no_attachments_on_item_yet') }}</p>
</div>
</div>
</div>
<!-- Attachments ------------------------------------------ -->
<div class="section-label">
<label>{{ $i18n.get('label_attachments') }}</label>
</div>
<div class="section-box section-attachments">
<div class="uploaded-files">
<file-item
:style="{ margin: 15 + 'px'}"
v-if="attachmentsList.length > 0"
v-for="(attachment, index) in attachmentsList"
<div
v-show="!isMetadataColumnCompressed"
class="column is-4-5">
<!-- Visibility (status public or private) -------------------------------- -->
<div class="section-label">
<label>{{ $i18n.get('label_visibility') }}</label>
</div>
<div class="section-status">
<div class="field has-addons">
<span v-if="item.status != 'private'">
<span class="icon">
<i class="mdi mdi-earth"/>
</span> {{ $i18n.get('publish_visibility') }}
</span>
<span v-if="item.status == 'private'">
<span class="icon">
<i class="mdi mdi-lock"/>
</span> {{ $i18n.get('private_visibility') }}
</span>
</div>
</div>
<!-- Collection -------------------------------- -->
<div class="section-label">
<label>{{ $i18n.get('collection') }}</label>
</div>
<div class="section-status">
<div class="field has-addons">
<span>
{{ collectionName }}
</span>
</div>
</div>
<!-- Metadata -------------------------------- -->
<div class="section-label">
<label>{{ $i18n.get('metadata') }}</label>
</div>
<br>
<a
class="collapse-all"
@click="open = !open">
{{ open ? $i18n.get('label_collapse_all') : $i18n.get('label_expand_all') }}
<b-icon
type="is-secondary"
:icon=" open ? 'menu-down' : 'menu-right'"/>
</a>
<div>
<div
v-for="(metadatum, index) of metadatumList"
:key="index"
:show-name="true"
:file="attachment"/>
<p v-if="attachmentsList.length <= 0"><br>{{ $i18n.get('info_no_attachments_on_item_yet') }}</p>
</div>
</div>
</div>
<div
v-show="!isMetadataColumnCompressed"
class="column is-4-5">
<!-- Visibility (status public or private) -------------------------------- -->
<div class="section-label">
<label>{{ $i18n.get('label_visibility') }}</label>
<span class="required-metadatum-asterisk">*</span>
</div>
<div class="section-status">
<div class="field has-addons">
<span v-if="item.status != 'private'">
<span class="icon">
<i class="mdi mdi-earth"/>
</span> {{ $i18n.get('publish_visibility') }}
</span>
<span v-if="item.status == 'private'">
<span class="icon">
<i class="mdi mdi-lock"/>
</span> {{ $i18n.get('private_visibility') }}
</span>
</div>
</div>
<!-- Metadata -------------------------------- -->
<label class="section-label">{{ $i18n.get('metadata') }}</label>
<br>
<a
class="collapse-all"
@click="open = !open">
{{ open ? $i18n.get('label_collapse_all') : $i18n.get('label_expand_all') }}
<b-icon
type="is-secondary"
:icon=" open ? 'menu-down' : 'menu-right'"/>
</a>
<div>
<div
v-for="(metadatum, index) of metadatumList"
:key="index"
class="field">
<b-collapse :open="open">
<label
class="label"
slot="trigger"
slot-scope="props">
<b-icon
type="is-secondary"
:icon="props.open ? 'menu-down' : 'menu-right'"
/>
{{ metadatum.metadatum.name }}
</label>
<div
v-if="metadatum.date_i18n"
class="content">
<p v-html="metadatum.date_i18n"/>
</div>
<div
v-else
class="content">
<p v-html="metadatum.value_as_html"/>
</div>
</b-collapse>
class="field">
<b-collapse :open="open">
<label
class="label"
slot="trigger"
slot-scope="props">
<b-icon
type="is-secondary"
:icon="props.open ? 'menu-down' : 'menu-right'"
/>
{{ metadatum.metadatum.name }}
</label>
<div
v-if="metadatum.date_i18n"
class="content">
<p v-html="metadatum.date_i18n"/>
</div>
<div
v-else
class="content">
<p v-html="metadatum.value_as_html"/>
</div>
</b-collapse>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<div class="form-submission-footer">
<router-link
class="button is-secondary"
:to="{ path: $routerHelper.getItemEditPath(collectionId, itemId)}">
{{ $i18n.getFrom('items','edit_item') }}
</router-link>
<a
class="button is-success is-pulled-right"
:href="item.url">
{{ $i18n.getFrom('items', 'view_item') }}
</a>
<div class="footer">
<div class="form-submission-footer">
<router-link
class="button is-secondary"
:to="{ path: $routerHelper.getItemEditPath(collectionId, itemId)}">
{{ $i18n.getFrom('items','edit_item') }}
</router-link>
<a
class="button is-success is-pulled-right"
:href="item.url">
{{ $i18n.getFrom('items', 'view_item') }}
</a>
</div>
</div>
</div>
</div>
@ -177,6 +196,8 @@
isLoading: false,
isMetadataColumnCompressed: false,
open: false,
collectionName: '',
thumbPlaceholderPath: tainacan_plugin.base_url + '/admin/images/placeholder_square.png'
}
},
components: {
@ -188,6 +209,9 @@
'fetchAttachments',
'fetchMetadata',
]),
...mapActions('collection', [
'fetchCollectionName'
]),
...mapGetters('item', [
'getItem',
'getMetadata',
@ -224,6 +248,11 @@
this.loadMetadata();
});
// Obtains collection name
this.fetchCollectionName(this.collectionId).then((collectionName) => {
this.collectionName = collectionName;
});
// Get attachments
this.fetchAttachments(this.itemId);
}
@ -258,7 +287,7 @@
}
.page-container-shrinked {
height: calc(100% - 132px) !important; // Bigger than the others due footer's height
height: calc(100% - 118px) !important; // Bigger than the others due footer's height
}
.page-container {
@ -269,6 +298,10 @@
padding-right: $page-side-padding;
}
.tainacan-form>.columns {
margin-bottom: 70px;
}
.column.is-5-5 {
width: 45.833333333%;
padding-left: $page-side-padding;
@ -288,16 +321,15 @@
.field {
padding: 10px 0px 10px 30px;
.collapse .collapse-content {
margin-left: 30px;
}
}
@media screen and (max-width: 769px) {
width: 100%;
}
}
.collapse .collapse-content {
margin-left: 30px;
}
}
.field {
@ -418,22 +450,21 @@
}
.footer {
padding: 24px $page-side-padding;
padding: 18px $page-side-padding;
position: absolute;
bottom: 0;
z-index: 999999;
background-color: white;
border-top: 2px solid $secondary;
width: 100%;
background-color: $primary-lighter;
width: 100%;
height: 65px;
.form-submission-footer {
width: 100%;
display: flex;
justify-content: end;
justify-content: flex-end;
.button {
margin-left: 6px;
margin-left: 16px;
margin-right: 6px;
}
.button.is-outlined {

View File

@ -34,8 +34,11 @@
&:focus {
outline: 0px;
}
&[disabled] {
border: none;
&[disabled], &:hover[disabled] {
border: none !important;
cursor: not-allowed !important;
color: $gray-light !important;
background-color: $tainacan-input-background !important;
}
&.is-white[disabled] {
background-color: white !important;

View File

@ -30,7 +30,7 @@
.b-checkbox { width: 100% };
&:hover { background-color: $primary-lighter; }
.is-small { color: gray; }
&.is-active { background-color: white; }
&.is-active { background-color: $primary-light; }
}
}
}

View File

@ -14,6 +14,8 @@
table.tainacan-table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
.checkbox-cell {
min-width: 38px;

View File

@ -24,13 +24,12 @@ return apply_filters( 'tainacan-admin-i18n', [
'item' => __( 'Item', 'tainacan' ),
'metadatum' => __( 'Metadata', 'tainacan' ),
'filter' => __( 'Filter', 'tainacan' ),
'taxonomy' => __( 'Taxonomia', 'tainacan' ),
'taxonomy' => __( 'Taxonomy', 'tainacan' ),
'event' => __( 'Event', 'tainacan' ),
'term' => __( 'Term', 'tainacan' ),
'terms' => __( 'Terms', 'tainacan' ),
'mapping' => __( 'Mapping', 'tainacan' ),
'importers' => __( 'Importers', 'tainacan' ),
'metadata' => __( 'metadata', 'tainacan' ),
// Actions
'edit' => __( 'Edit', 'tainacan' ),
@ -101,9 +100,9 @@ return apply_filters( 'tainacan-admin-i18n', [
'title_collection_filters_edition' => __( 'Edit Filters of', 'tainacan' ),
'title_importer_page' => __( 'Importer', 'tainacan' ),
'title_importers_page' => __( 'Importers', 'tainacan' ),
'title_export_collection_page' => __( 'Export Collection Page', 'tainacan' ),
'title_export_item_page' => __( 'Export Item Page', 'tainacan' ),
'title_export_page' => __( 'Export Page', 'tainacan' ),
'title_export_collection_page' => __( 'Export Collection Page', 'tainacan' ),
'title_export_item_page' => __( 'Export Item Page', 'tainacan' ),
'title_export_page' => __( 'Export Page', 'tainacan' ),
// Labels (used mainly on Aria Labels and Inputs)
'label_clean' => __( 'Clear', 'tainacan' ),
@ -133,8 +132,8 @@ return apply_filters( 'tainacan-admin-i18n', [
'label_button_delete_header_image' => __( 'Button Delete Header Image', 'tainacan' ),
'label_button_edit_thumb' => __( 'Button Edit Thumbnail', 'tainacan' ),
'label_button_edit_header_image' => __( 'Button Edit Header Image', 'tainacan' ),
'label_button_edit_document' => __( 'Button Edit Document', 'tainacan' ),
'label_button_delete_document' => __( 'Button Delete Document', 'tainacan' ),
'label_button_edit_document' => __( 'Button Edit Document', 'tainacan' ),
'label_button_delete_document' => __( 'Button Delete Document', 'tainacan' ),
'label_choose_thumb' => __( 'Choose Thumbnail', 'tainacan' ),
'label_button_delete_thumb' => __( 'Button Delete Thumbnail', 'tainacan' ),
'label_collections_per_page' => __( 'Collections per Page:', 'tainacan' ),
@ -247,18 +246,17 @@ return apply_filters( 'tainacan-admin-i18n', [
'label_remove_value' => __( 'Remove value', 'tainacan' ),
'label_create_new_page' => __( 'Create new page', 'tainacan' ),
'label_total_items' => __( 'Total items', 'tainacan' ),
'label_see_more' => __( 'See more', 'tainacan' ),
'label_until' => __( 'until', 'tainacan' ),
'label_visibility' => __( 'Visibility', 'tainacan' ),
'label_discart' => __( 'Discart', 'tainacan' ),
'label_save_as_draft' => __( 'Save as draft', 'tainacan' ),
'label_update_draft' => __( 'Update draft', 'tainacan' ),
'label_return_to_draft' => __( 'Return to draft', 'tainacan' ),
'label_publish' => __( 'Publish', 'tainacan' ),
'label_send_to_trash' => __( 'Send to trash', 'tainacan' ),
'label_update' => __( 'Update', 'tainacan' ),
'label_mapper_metadata' => __( 'Mapper Metadata', 'tainacan' ),
'label_add_more_mapper_metadata' => __( 'Add more mapper\'s metadata', 'tainacan' ),
'label_see_more' => __( 'See more', 'tainacan' ),
'label_until' => __( 'until', 'tainacan' ),
'label_visibility' => __( 'Visibility', 'tainacan' ),
'label_discart' => __( 'Discart', 'tainacan' ),
'label_save_as_draft' => __( 'Save as draft', 'tainacan' ),
'label_update_draft' => __( 'Update draft', 'tainacan' ),
'label_return_to_draft' => __( 'Return to draft', 'tainacan' ),
'label_publish' => __( 'Publish', 'tainacan' ),
'label_update' => __( 'Update', 'tainacan' ),
'label_mapper_metadata' => __( 'Mapper Metadata', 'tainacan' ),
'label_add_more_mapper_metadata' => __( 'Add more mapper\'s metadata', 'tainacan' ),
// Instructions. More complex sentences to guide user and placeholders
'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ),
@ -283,13 +281,12 @@ return apply_filters( 'tainacan-admin-i18n', [
'instruction_search' => __( 'Search', 'tainacan' ),
'instruction_search_in_repository' => __( 'Search in repository', 'tainacan' ),
'instruction_select_a_target_collection' => __( 'Select a target collection', 'tainacan' ),
'instruction_select_a_metadatum' => __( 'Select a metadatum', 'tainacan' ),
'instruction_select_a_mapper' => __( 'Select a mapper', 'tainacan' ),
'instruction_select_a_mapper' => __( 'Select a mapper', 'tainacan' ),
'instruction_select_an_importer_type' => __( 'Select an importer type from the options above:', 'tainacan' ),
'instruction_drop_file_or_click_to_upload' => __( 'Drop your source file or click here to upload.', 'tainacan' ),
'instruction_select_metadatum_type' => __( 'Select a metadatum type.', 'tainacan' ),
'instruction_configure_new_metadatum' => __( 'Configure new metadatum.', 'tainacan' ),
'instruction_insert_mapper_metadatum_info' => __( 'Insert the new mapper\'s metadatum info', 'tainacan' ),
'instruction_insert_mapper_metadatum_info' => __( 'Insert the new mapper\'s metadatum info', 'tainacan' ),
// Info. Other feedback to user.
'info_search_results' => __( 'Search Results', 'tainacan' ),
@ -368,12 +365,15 @@ return apply_filters( 'tainacan-admin-i18n', [
'info_updated_at' => __( 'Updated at', 'tainacan' ),
'info_editing_metadata_values' => __( 'Editing metadata values...', 'tainacan' ),
'info_updating_metadata_values' => __( 'Updating metadata values...', 'tainacan' ),
'info_type_to_add_items' => __( 'Add items...', 'tainacan' ),
'info_type_to_search_items' => __( 'Search items...', 'tainacan' ),
'info_type_to_add_terms' => __( 'Add terms...', 'tainacan' ),
'info_type_to_search_metadata' => __( 'Search metadata...', 'tainacan' ),
'info_type_to_add_metadata' => __( 'Add metadata...', 'tainacan' ),
'info_visibility_helper' => __( 'How the item will be available to visualization.', 'tainacan' ),
'info_type_to_add_items' => __( 'Add items...', 'tainacan' ),
'info_type_to_search_items' => __( 'Search items...', 'tainacan' ),
'info_type_to_add_terms' => __( 'Add terms...', 'tainacan' ),
'info_type_to_search_metadata' => __( 'Search metadata...', 'tainacan' ),
'info_type_to_add_metadata' => __( 'Add metadata...', 'tainacan' ),
'info_visibility_helper' => __( 'How the item will be available to visualization.', 'tainacan' ),
'info_errors_in_form' => __( 'There are errors in the form', 'tainacan' ),
'info_no_document_to_item' => __( 'No document was uploaded to this item.', 'tainacan' ),
// Tainacan Metadatum Types
'tainacan-text' => __( 'Text', 'tainacan' ),

View File

@ -295,6 +295,12 @@ export default {
.columns {
display: flex;
}
.taginput-container {
.control.has-icons-left .icon {
top: 5px;
}
}
}
.search-control {
@ -305,9 +311,16 @@ export default {
font-size: 21px;
}
}
.dropdown-item {
padding: 0.25rem 1.35rem 0.25rem 0.25rem;
}
.view-mode-icon {
margin-right: 8px !important;
margin-top: 2px;
margin-right: 0px !important;
margin-top: 1px;
&.icon i::before, .gray-icon i::before {
font-size: 19px !important;
}
}
}

View File

@ -221,7 +221,6 @@ class REST_Bulkedit_Controller extends REST_Controller {
}
$group_id = $request['group_id'];
var_dump($group_id);
$args = ['id' => $group_id];

View File

@ -60,7 +60,7 @@ class REST_Importers_Controller extends REST_Controller {
'description' => __( 'The array describing the destination collectino as expected by the importer', 'tainacan' ),
],
'options' => [
'type' => 'array',
'type' => 'array/object',
'description' => __( 'The importer options', 'tainacan' ),
]
],

View File

@ -53,7 +53,7 @@ class Taxonomy extends Entity {
*
* @return bool
*/
function register_taxonomy() {
function tainacan_register_taxonomy() {
$labels = array(
'name' => $this->get_name(),
'singular_name' => $this->get_name(),

View File

@ -215,7 +215,7 @@
}
.taginput-container {
display: table-cell;
//display: table-cell;
border: none !important;
&.is-focusable:active, &.is-focusable:focus {
border: none !important;
@ -224,7 +224,7 @@
border: 1px solid $tainacan-input-background !important;
}
.control.has-icons-left .icon {
top: 5px;
top: 0px !important;
}
.tags {
display: none !important;

View File

@ -158,7 +158,7 @@ class Items extends Repository {
// register taxonomies
if ( is_array( $taxonomies ) && sizeof( $taxonomies ) > 0 ) {
foreach ( $taxonomies as $taxonomy ) {
$taxonomy->register_taxonomy();
$taxonomy->tainacan_register_taxonomy();
}
}
}

View File

@ -531,7 +531,19 @@ class Metadata extends Repository {
]
];
if( $collection->get_parent() !== 0 ){
if( $collection->get_parent() != 0 ){
if(!empty($metadata)){
foreach ( $data_core_metadata as $index => $data_core_metadatum ) {
foreach ( $metadata as $metadatum ){
if ( $metadatum->get_metadata_type() === $data_core_metadatum['metadata_type'] ) {
update_post_meta($metadatum->get_id(), 'metadata_type', 'to_delete', $data_core_metadatum['metadata_type']);
wp_delete_post($metadatum->get_id(), true);
}
}
}
}
return false;
}

View File

@ -133,7 +133,7 @@ class Taxonomies extends Repository {
public function insert($taxonomy) {
$new_taxonomy = parent::insert($taxonomy);
$new_taxonomy->register_taxonomy();
$new_taxonomy->tainacan_register_taxonomy();
// return a brand new object
return $new_taxonomy;
@ -187,10 +187,18 @@ class Taxonomies extends Repository {
$permanently = $args[2];
if($permanently == true){
$unregistered = unregister_taxonomy($taxonomy_name);
/* TODO: Investigate the cause of taxonomies aren't been registered
*
* This cause a 'invalid taxonomy' exception when try to delete permanently a taxonomy
*
* This condition is a temporary solution
*/
if(taxonomy_exists($taxonomy_name)) {
$unregistered = unregister_taxonomy( $taxonomy_name );
if($unregistered instanceof \WP_Error){
return $unregistered;
if ( $unregistered instanceof \WP_Error ) {
return $unregistered;
}
}
$deleted = new Entities\Taxonomy(wp_delete_post($taxonomy_id, true));

View File

@ -102,7 +102,7 @@ $Tainacan_Metadata->register_metadata_type('Tainacan\Metadata_Types\Numeric');
$Tainacan_Metadata->register_metadata_type('Tainacan\Metadata_Types\Selectbox');
$Tainacan_Metadata->register_metadata_type('Tainacan\Metadata_Types\Relationship');
$Tainacan_Metadata->register_metadata_type('Tainacan\Metadata_Types\Taxonomy');
$Tainacan_Metadata->register_metadata_type('Tainacan\Metadata_Types\Compound');
//$Tainacan_Metadata->register_metadata_type('Tainacan\Metadata_Types\Compound');
$Tainacan_Filters = \Tainacan\Repositories\Filters::get_instance();

View File

@ -67,7 +67,7 @@ class CSV extends Importer {
$column = $this->handle_encoding( $values[ $cont ] );
$processedItem[ $header ] = ( $metadatum->get_multiple() ) ?
$processedItem[ $header ] = ( $metadatum->is_multiple() ) ?
explode( $this->get_option('multivalued_delimiter'), $column) : $column;
$cont++;

View File

@ -8,19 +8,6 @@
* used to learn how to write an importer and to
* create test collections and items
*
* Example how to invoke it
*
* add_action('init', function() {
* if ( isset($_GET['run_test_importer']) && $_GET['run_test_importer'] == 'go' ) {
* global $Tainacan_Importer_Handler;
* $test = new \Tainacan\Importer\Test_Importer();
* $Tainacan_Importer_Handler->add_to_queue($test);
* }
* });
*
* Put this code somewhere and access any URL of your site with ?run_test_importer=go
*
* TODO: check validate() methods and write log & abort importer in case of error.
*/
namespace Tainacan\Importer;
@ -70,8 +57,28 @@ class Test_Importer extends Importer {
$this->items_repo = \Tainacan\Repositories\Items::get_instance();
$this->metadata_repo = \Tainacan\Repositories\Metadata::get_instance();
$this->remove_import_method('file');
$this->remove_import_method('url');
$this->set_default_options([
'items_col_1' => 20,
'items_col_2' => 20
]);
}
public function options_form() {
$form = '<label class="label">' . __('Number of items in collection 1', 'tainacan') . '</label>';
$form .= '<input type="text" class="input" name="items_col_1" value="' . $this->get_option('items_col_1') . '" />';
$form .= '<label class="label">' . __('Number of items in collection 2', 'tainacan') . '</label>';
$form .= '<input type="text" class="input" name="items_col_2" value="' . $this->get_option('items_col_2') . '" />';
return $form;
}
public function create_taxonomies() {
$tax1 = new Entities\Taxonomy();
@ -324,10 +331,10 @@ class Test_Importer extends Importer {
* Here we are just returning random values
*/
public function get_col1_number_of_items() {
return 10;
return $this->get_option('items_col_1');
}
public function get_col2_number_of_items() {
return 20;
return $this->get_option('items_col_2');
}
public function get_col1_item($index) {

View File

@ -13,6 +13,11 @@ export const eventBus = new Vue({
}
this.$on('input', data => this.updateValue(data) );
},
watch: {
errors() {
this.$emit('hasErrorsOnForm', this.errors.length > 0);
}
},
methods : {
registerComponent( name ){
if (this.componentsTag.indexOf(name) < 0) {

View File

@ -95,10 +95,11 @@ export const updateImporterURL = ( { commit }, { sessionId, url }) => {
});
};
export const updateImporterOptions = ( { commit }, { sessionId, options }) => {
export const updateImporterOptions = ( { commit }, { sessionId, optionsForm }) => {
return new Promise(( resolve, reject ) => {
axios.tainacan.put('importers/session/' + sessionId, {
options: options
options: optionsForm
})
.then( res => {
let importer = res.data;

View File

@ -23,9 +23,9 @@ export const createTaxonomy = ({commit}, taxonomy) => {
});
};
export const deleteTaxonomy = ({ commit }, taxonomyId) => {
export const deleteTaxonomy = ({ commit }, { taxonomyId, isPermanently }) => {
return new Promise(( resolve, reject ) => {
axios.tainacan.delete(`/taxonomies/${taxonomyId}?permanently=1`)
axios.tainacan.delete(`/taxonomies/${taxonomyId}?permanently=` + (isPermanently ? '1' : '0'))
.then(res => {
commit('deleteTaxonomy', res.data);

View File

@ -2,9 +2,9 @@
Contributors: fabianobn, jacsonp, leogermani, weryques, wetah
Tags: museums, libraries, archives, GLAM, collections, repository
Requires at least: 4.8
Tested up to: 4.9
Tested up to: 4.9.7
Requires PHP: 5.6
Stable tag: 0.1
Stable tag: 0.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

View File

@ -4,7 +4,7 @@ Plugin Name: Tainacan
Plugin URI: https://tainacan.org/new
Description: powerfull and flexible repository platform for WordPress. Manage and publish you digital collections as easily as publishing a post to your blog, while having all the tools of a professional respository platform.
Author: Media Lab / UFG
Version: 0.1
Version: 0.2
Text Domain: tainacan
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

View File

@ -194,7 +194,7 @@ class Metadata extends TAINACAN_UnitTestCase {
*/
function test_metadata_metadata_type(){
$Tainacan_Metadata = \Tainacan\Repositories\Metadata::get_instance();
$this->assertEquals( 8, sizeof( $Tainacan_Metadata->fetch_metadata_types() ) );
$this->assertEquals( 7, sizeof( $Tainacan_Metadata->fetch_metadata_types() ) );
}