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,6 +23,7 @@ apt:
services:
- mysql
before_install:
- sudo apt-get update
- sudo apt-get install sshpass
- sudo service mysql restart
- mysql -e 'CREATE DATABASE IF NOT EXISTS test;'
@ -33,6 +34,7 @@ install:
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,6 +260,7 @@
<b-input
id="tainacan-text-name"
v-model="form.name"
@blur="updateSlug"
@focus="clearErrors('name')"/>
</b-field>
@ -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

@ -415,6 +415,7 @@ export default {
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="help is-danger">{{ errorList }}</p>
<p class="help is-danger">{{ formErrorMessage }}</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>
</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"
@ -40,3 +40,9 @@
}
}
</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,6 +1022,7 @@
.gray-icon, .gray-icon .icon {
color: $tainacan-placeholder-color !important;
padding-right: 10px;
}
.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,7 +9,8 @@
<b-icon :icon="isMetadataColumnCompressed ? 'menu-left' : 'menu-right'" />
</button>
<tainacan-title/>
<div class="tainacan-form columns">
<div class="tainacan-form">
<div class="columns">
<div class="column is-5-5">
<!-- Document -------------------------------- -->
@ -35,6 +36,9 @@
<div v-html="item.document_as_html"/>
</div>
</div>
<div v-else>
<p>{{ $i18n.get('info_no_document_to_item') }}</p>
</div>
</div>
<!-- Thumbnail -------------------------------- -->
@ -88,7 +92,6 @@
<!-- 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">
@ -105,8 +108,23 @@
</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 -------------------------------- -->
<label class="section-label">{{ $i18n.get('metadata') }}</label>
<div class="section-label">
<label>{{ $i18n.get('metadata') }}</label>
</div>
<br>
<a
class="collapse-all"
@ -162,6 +180,7 @@
</div>
</div>
</div>
</div>
</template>
<script>
@ -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;
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' ),
@ -255,7 +254,6 @@ return apply_filters( 'tainacan-admin-i18n', [
'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' ),
@ -283,7 +281,6 @@ 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_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' ),
@ -374,6 +371,9 @@ return apply_filters( 'tainacan-admin-i18n', [
'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,11 +187,19 @@ 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){
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,6 +57,26 @@ 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() {
@ -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() ) );
}