Merge branch 'develop' into feature/bulk-edit-items

This commit is contained in:
weryques 2018-08-28 18:20:18 -03:00
commit f188d4c04f
36 changed files with 214 additions and 95 deletions

View File

@ -28,7 +28,7 @@
import TainacanHeader from './components/navigation/tainacan-header.vue';
import TainacanRepositorySubheader from './components/navigation/tainacan-repository-subheader.vue';
export default {
export default {
name: "AdminPage",
data(){
return {

View File

@ -137,8 +137,7 @@
class="field column is-12">
<a
@click="addSearchCriteria"
style="font-size: 12px;"
class="has-text-secondary">
style="font-size: 12px;">
<b-icon
class="add-i"
icon="plus-circle"

View File

@ -1,7 +1,7 @@
<template>
<div class="table-container">
<div class="table-wrapper">
<table class="tainacan-table">
<table class="tainacan-table is-narrow">
<thead>
<tr>
<!-- Title -->

View File

@ -114,7 +114,7 @@
<masonry
v-if="viewMode == 'masonry'"
:cols="{default: 7, 1919: 6, 1407: 5, 1215: 4, 1023: 3, 767: 2, 343: 1}"
:gutter="30"
:gutter="25"
class="tainacan-masonry-container">
<div
:key="index"
@ -284,7 +284,7 @@
<!-- RECORDS VIEW MODE -->
<masonry
:cols="{default: 4, 1919: 3, 1407: 2, 1215: 2, 1023: 1, 767: 1, 343: 1}"
:gutter="42"
:gutter="30"
class="tainacan-records-container"
v-if="viewMode == 'records'">
<div
@ -744,7 +744,7 @@ export default {
}
},
getLimitedDescription(description) {
let maxCharacter = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) <= 480 ? 100 : 220;
let maxCharacter = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) <= 480 ? 100 : 210;
return description.length > maxCharacter ? description.substring(0, maxCharacter - 3) + '...' : description;
}
}

View File

@ -35,7 +35,7 @@
</div>
-->
<div class="table-wrapper">
<table class="tainacan-table">
<table class="tainacan-table is-narrow">
<thead>
<tr>
<!-- Checking list -->

View File

@ -36,7 +36,7 @@
</div>
<div class="table-wrapper">
<table class="tainacan-table">
<table class="tainacan-table is-narrow">
<thead>
<tr>
<!-- Checking list -->

View File

@ -35,7 +35,7 @@ export default {
}
a.help-button .icon {
i, i::before { font-size: 0.9em !important; }
i, i::before { font-size: 0.875rem !important }
}
.help-wrapper:hover .help-tooltip {

View File

@ -52,7 +52,7 @@
</div>
<a
@click="openAdvancedSearch = !openAdvancedSearch"
class="is-size-7 has-text-secondary is-pulled-right is-hidden-mobile">{{ $i18n.get('advanced_search') }}</a>
class="is-size-7 is-pulled-right is-hidden-mobile">{{ $i18n.get('advanced_search') }}</a>
<h3 class="has-text-weight-semibold">{{ $i18n.get('filters') }}</h3>
<a
@ -169,7 +169,7 @@
<b-dropdown
ref="displayedMetadataDropdown"
:mobile-modal="true"
:disabled="totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards'"
:disabled="totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry'"
class="show">
<button
class="button is-white"
@ -575,7 +575,7 @@
class="button is-secondary"
:to="{ path: $routerHelper.getNewItemPath(collectionId) }">
{{ $i18n.getFrom('items', 'add_new') }}
</router-link>
</router-link>
</div>
</section>

View File

@ -54,7 +54,7 @@
</div>
<a
@click="openAdvancedSearch = !openAdvancedSearch"
class="is-size-7 has-text-secondary is-pulled-right is-hidden-mobile">{{ $i18n.get('advanced_search') }}</a>
class="is-size-7 is-pulled-right is-hidden-mobile">{{ $i18n.get('advanced_search') }}</a>
<h3 class="has-text-weight-semibold">{{ $i18n.get('filters') }}</h3>
<a
@ -171,7 +171,7 @@
<b-dropdown
ref="displayedMetadataDropdown"
:mobile-modal="true"
:disabled="totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards'"
:disabled="totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry'"
class="show">
<button
class="button is-white"

View File

@ -9,6 +9,7 @@
display: inline-flex !important;
cursor: pointer;
background-color: white;
text-shadow: none !important;
&.is-secondary:hover, &.is-secondary:focus {
background: $secondary !important;
@ -39,6 +40,12 @@
cursor: not-allowed !important;
color: $gray4 !important;
background-color: $gray2 !important;
text-shadow: none !important;
}
&.is-outlined[disabled], &.is-outlined:hover[disabled] {
border: 1px solid $gray2 !important;
color: $gray4 !important;
background-color: white !important;
}
&.is-white[disabled] {
background-color: white !important;

View File

@ -8,7 +8,7 @@
width: 12px;
height: 12px;
flex-shrink: 0;
border-radius: 1px;
border-radius: 2px;
display: inline-block;
border: 1px solid $gray4;
transition: background 150ms ease-out;

View File

@ -91,8 +91,10 @@
}
}
.selected-list-box {
padding: 4px 0px;
border: 1px solid $gray2;
padding: 4px 6px 0px 6px;
border-color: $gray2;
border-width: 0px 1px 1px 1px;
border-style: solid;
background-color: white;
display: flex;
font-size: 12px;

View File

@ -1,18 +1,24 @@
.input, .textarea {
font-size: 14px;
border: none;
border-radius: 1px !important;
box-shadow: none !important;
background-color: white;
border: 1px solid $gray2;
color: $tainacan-input-color;
transition: background-color 0.1s, border 0.3s;
&:focus, &:active {
box-shadow: none !important;
background-color: white;
border: 1px solid $gray2 !important;
}
border: 1px solid $gray4 !important;
}
&[disabled] {
color: $gray4 !important;
background-color: $gray2 !important;
}
&.readonly, &[readonly] {
background-color: white !important;
}
&::placeholder,
&::-ms-input-placeholder,
&:-ms-input-placeholder,

View File

@ -108,7 +108,9 @@
box-shadow: none !important;
display: inline-flex !important;
cursor: pointer;
font-size: 13px !important;
height: 30px !important;
line-height: 20px !important;
font-size: 14px !important;
}
.button.is-success {
border: none;

View File

@ -11,7 +11,7 @@
}
.is-primary:not(.upload-draggable), .is-primary:hover, .is-primary:focus {
background-color: $blue4 !important;
background-color: $blue3 !important;
color: white !important;
}
.is-secondary, .is-secondary:hover, .is-secondary:focus {

View File

@ -13,7 +13,7 @@
}
}
&:hover input[type="checkbox"]:checked + .check {
background-color: $turquoise2;
background-color: transparent;
}
input[type="checkbox"]:checked + .check {

View File

@ -20,6 +20,12 @@
border-collapse: separate;
border-spacing: 0;
&.is-narrow {
tbody td {
height: 42px;
}
}
.checkbox-cell {
min-width: 38px;
width: 38px;

View File

@ -24,9 +24,11 @@
&.is-delete {
border-radius: 50px !important;
border-radius: 50px !important;
color: $gray4;
&:hover {
background-color: white !important;
color: $gray5;
}
}
}

View File

@ -38,16 +38,10 @@
color: $danger;
}
}
.input, .textarea {
background-color: white;
border: 1px solid $gray2;
color: $tainacan-input-color;
transition: background-color 0.1s;
.input, .textarea {
&.is-danger {
background-color: #e7dede;
background-color: $red1;
}
}
.control{
&.has-icons-right {
@ -111,6 +105,9 @@
}
}
.upload-draggable {
color: $gray4;
transition: color 0.2s background-color 0.2s;
border-radius: 0 !important;
border-color: $gray2;
}
}

View File

@ -10,7 +10,7 @@
.tooltip-inner {
background: $turquoise1;
color: $gray4;
color: $gray5;
font-size: 11px;
border-radius: 5px;
padding: 20px;

View File

@ -240,3 +240,56 @@ $modal-z: 9999999;
}
}
// Filter Item Collapse
@keyframes filter-item-in {
from {
opacity: 0;
height: 0px;
max-height: 0px;
min-height: 0px;
-ms-transform: translate(2%, -30%); /* IE 9 */
-webkit-transform: translate(2%, -30%); /* Safari */
transform: translate(2%, -30%);
}
to {
height: 80px;
max-height: 80px;
min-height: 80px;
opacity: 1;
-ms-transform: translate(0, 0); /* IE 9 */
-webkit-transform: translate(0, 0); /* Safari */
transform: translate(0, 0);
}
}
@keyframes filter-item-out {
from {
height: 80px;
max-height: 80px;
min-height: 80px;
opacity: 1;
-ms-transform: translate(0, 0); /* IE 9 */
-webkit-transform: translate(0, 0); /* Safari */
transform: translate(0, 0);
}
to {
height: 0px;
max-height: 0px;
min-height: 0px;
opacity: 0;
-ms-transform: translate(2%, -30%); /* IE 9 */
-webkit-transform: translate(2%, -30%); /* Safari */
transform: translate(2%, -30%);
}
}
.filter-item-enter-active {
animation-name: filter-item-in;
animation-duration: 0.1s;
animation-timing-function: ease;
}
.filter-item-leave-active {
animation-name: filter-item-out;
animation-duration: 0.1s;
animation-timing-function: ease;
}

View File

@ -19,11 +19,11 @@
.tainacan-card {
padding: 0px;
flex-basis: 0;
margin: 0.75rem;
margin: 15px;
max-width: 425px;
min-width: 425px;
min-height: 218px;
max-height: 218px;
min-height: 210px;
max-height: 210px;
cursor: pointer;
@media screen and (max-width: 480px) {
@ -45,12 +45,12 @@
.card-checkbox {
position: absolute;
margin-left: 1.0rem;
margin-top: 9px;
margin-top: 7px;
}
.actions-area {
position: relative;
float: right;
top: -7px;
top: -5px;
padding-right: 12px;
width: 80px;
display: flex;
@ -73,15 +73,15 @@
visibility: hidden;
}
img {
width: 172px;
height: 172px;
width: 170px;
height: 170px;
border-radius: 0px;
}
.metadata-title {
flex-shrink: 0;
padding: 0.75rem 4.75rem 0.75rem 2.75rem;
padding: 0.5rem 4.75rem 0.5rem 2.75rem;
margin-bottom: -27px;
min-height: 42px;
min-height: 40px;
font-size: 0.875rem !important;
text-overflow: ellipsis;
white-space: nowrap;
@ -105,7 +105,7 @@
padding: 0.75rem 1.375rem;
flex: 1;
width: 100%;
height: 172px;
height: 170px;
color: $gray4;
p.metadata-description {

View File

@ -14,9 +14,9 @@
}
.tainacan-grid-item {
max-width: 258px;
max-width: 255px;
flex-basis: 0;
margin: 1rem 1.5rem 1.5rem 1.5rem;
margin: 15px;
text-align: center;
height: 100%;
@ -33,11 +33,12 @@
position: relative;
float: right;
width: 100%;
height: 30px;
display: flex;
justify-content: flex-end;
visibility: hidden;
opacity: 0;
padding: 8px;
padding: 3px 8px;
transition: visibility 0.2s, opacity 0.2s;
margin-top: -43px;
background-color: $gray2;
@ -51,16 +52,12 @@
&:hover .actions-area {
visibility: visible;
opacity: 1.0;
}
&.selected-grid-item {
.actions-area {
background-color: $turquoise1;
}
background-color: $gray2 !important;
}
img {
min-width: 258px;
max-width: 258px;
min-width: 255px;
max-width: 255px;
height: auto;
border-radius: 0px;
margin-bottom: -5px;

View File

@ -17,7 +17,7 @@
display: block;
width: 100%;
flex-basis: 0;
margin-bottom: 30px;
margin-bottom: 25px;
text-align: center;
text-decoration: none;
transition: background-color 0.3s;
@ -39,12 +39,10 @@
justify-content: flex-end;
visibility: hidden;
opacity: 0;
padding: 8px;
padding: 2px 8px;
transition: visibility 0.2s, opacity 0.2s;
margin-top: -43px;
margin-top: -31px;
background-color: $gray2;
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
a {
margin-left: 12px;

View File

@ -14,13 +14,16 @@
.metadata-title {
background-color: $turquoise2;
}
.media {
background-color: $turquoise1;
}
}
.tainacan-record {
background-color: #f6f6f6;
padding: 0px;
flex-basis: 0;
margin: 0 auto 42px auto;
margin: 0 auto 30px auto;
width: 100%;
max-width: 425px;
min-height: 100px;
@ -35,12 +38,12 @@
.record-checkbox {
position: absolute;
margin-left: 1.0rem;
margin-top: 9px;
margin-top: 7px;
}
.actions-area {
position: relative;
float: right;
top: -7px;
top: -5px;
padding-right: 12px;
width: 80px;
display: flex;
@ -64,7 +67,7 @@
}
.thumbnail {
float: right;
margin: 0 0 1.5rem 1.5rem;
margin: 0 0 25px 25px;
}
img {
width: 120px;
@ -73,9 +76,9 @@
}
.metadata-title {
flex-shrink: 0;
padding: 0.75rem 4.75rem 0.75rem 2.75rem;
padding: 0.5rem 4.75rem 0.5rem 2.75rem;
margin-bottom: -27px;
min-height: 42px;
min-height: 40px;
font-size: 0.875rem !important;
text-overflow: ellipsis;
white-space: nowrap;
@ -83,6 +86,7 @@
color: black;
p {
line-height: 1.7;
font-size: 0.875rem !important;
text-overflow: ellipsis;
white-space: nowrap;
@ -93,12 +97,15 @@
&:hover .metadata-title {
background-color: $gray2 !important;
}
&:hover .media {
background-color: $gray1 !important;
}
.media {
width: 100%;
.list-metadata {
padding: 0.75rem 1.375rem;
padding: 25px;
flex: 1;
font-size: 0.6875rem;
color: $gray4;
@ -107,12 +114,12 @@
.metadata-label {
font-size: 0.75rem;
margin-bottom: 0.2rem;
font-weight: 700;
color: #454647;
}
.metadata-value {
font-size: 0.75rem;
margin-bottom: 1rem;
color: $gray4;
}

View File

@ -62,10 +62,11 @@ export default {
display: flex;
-webkit-overflow-scrolling: touch;
a{ color: $secondary !important }
a:hover {
a, a:not([href]){ color: $secondary }
a:hover, a:hover:not([href]) {
cursor: pointer;
color: $secondary !important;
color: $secondary;
text-decoration: underline;
}
ul {
list-style: none;

View File

@ -276,24 +276,29 @@ abstract class Background_Process extends \WP_Background_Process {
}
} while ( false !== $task && ! $this->time_exceeded() && ! $this->memory_exceeded() );
$this->debug('process limit reached');
if ( false !== $task ) {
$this->update( $batch->key, $task );
$this->debug('Batch updated');
} else {
$this->close( $batch->key );
$this->debug('Batch closed');
}
$this->unlock_process();
// Start next batch or complete process.
if ( ! $this->is_queue_empty() ) {
$this->debug('Dispatch after limit reached');
$this->dispatch();
} else {
$this->debug('Complete');
$this->complete();
$this->write_log($batch->key, ['Process Finished']);
}
$this->debug('dying');
wp_die();
}

View File

@ -5,7 +5,8 @@
:type="filterTypeMessage">
<b-collapse
class="show"
:open="open">
:open.sync="open"
animation="filter-item">
<label
v-tooltip="{
content: filter.name,
@ -204,16 +205,23 @@
}
.taginput-container {
//display: table-cell;
border: none !important;
&.is-focusable:active, &.is-focusable:focus {
&.is-focused,
&.is-focused:active,
&.is-focused:focus,
&.is-focusable,
&.is-focusable:active
&.is-focusable:focus {
border: none !important;
input:active, input:focus {
border: 1px solid $gray4 !important;
}
}
input, input:active, input:focus {
input{
border: 1px solid $gray2 !important;
}
.control.has-icons-left .icon {
top: 0px !important;
top: 3px !important;
}
.tags {
display: none !important;

View File

@ -177,9 +177,9 @@ if ( ! class_exists( 'WP_Background_Process' ) ) {
// No data to process.
wp_die();
}
check_ajax_referer( $this->identifier, 'nonce' );
$this->debug('checking nonce');
//check_ajax_referer( $this->identifier, 'nonce' );
$this->debug('ok!');
$this->handle();
wp_die();
@ -221,6 +221,7 @@ if ( ! class_exists( 'WP_Background_Process' ) ) {
protected function is_process_running() {
if ( get_site_transient( $this->identifier . '_process_lock' ) ) {
// Process already running.
$this->debug('process already running');
return true;
}
@ -235,6 +236,7 @@ if ( ! class_exists( 'WP_Background_Process' ) ) {
* defined in the time_exceeded() method.
*/
protected function lock_process() {
$this->debug('locking process');
$this->start_time = time(); // Set start time of current process.
$lock_duration = ( property_exists( $this, 'queue_lock_time' ) ) ? $this->queue_lock_time : 60; // 1 minute
@ -251,6 +253,7 @@ if ( ! class_exists( 'WP_Background_Process' ) ) {
* @return $this
*/
protected function unlock_process() {
$this->debug('unlocking process');
delete_site_transient( $this->identifier . '_process_lock' );
return $this;
@ -441,17 +444,21 @@ if ( ! class_exists( 'WP_Background_Process' ) ) {
* and data exists in the queue.
*/
public function handle_cron_healthcheck() {
$this->debug('running handle_cron_healthcheck');
if ( $this->is_process_running() ) {
// Background process already running.
$this->debug('running handle_cron_healthcheck: process running');
exit;
}
if ( $this->is_queue_empty() ) {
// No data to process.
$this->debug('running handle_cron_healthcheck: queue empty');
$this->clear_scheduled_event();
exit;
}
$this->debug('running handle_cron_healthcheck: dispatching');
$this->dispatch();
exit;
@ -475,6 +482,7 @@ if ( ! class_exists( 'WP_Background_Process' ) ) {
exit;
}
$this->debug('handle_cron_healthcheck_check scheduling event');
$this->schedule_event();
}
@ -485,6 +493,7 @@ if ( ! class_exists( 'WP_Background_Process' ) ) {
protected function schedule_event() {
if ( ! wp_next_scheduled( $this->cron_hook_identifier ) ) {
wp_schedule_event( time(), $this->cron_interval_identifier, $this->cron_hook_identifier );
$this->debug('cron event scheduled');
}
}
@ -496,6 +505,7 @@ if ( ! class_exists( 'WP_Background_Process' ) ) {
if ( $timestamp ) {
wp_unschedule_event( $timestamp, $this->cron_hook_identifier );
$this->debug('cron event unscheduled');
}
}
@ -530,5 +540,18 @@ if ( ! class_exists( 'WP_Background_Process' ) ) {
*/
abstract protected function task( $item );
/**
* desperate method to help debug bg processes
*/
public function debug($message) {
if ( !defined('TAINACAN_DEBUG_BG_PROCESS') || true !== TAINACAN_DEBUG_BG_PROCESS || !is_string($message) ) {
return;
}
$message = 'BG_PROCESS: ' . $message;
error_log($message);
}
}
}

View File

@ -245,7 +245,8 @@ class Collections extends Repository {
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => true,
/* Translators: The Collections slug - will be the URL for the collections archive */
'rewrite' => ['slug' => sanitize_title(_x('collections', 'Slug: the string that will be used to build the URL', 'tainacan'))],
'capability_type' => Entities\Collection::get_capability_type(),
'map_meta_cap' => true,
'supports' => [

View File

@ -425,7 +425,7 @@ class Items extends Repository {
$TainacanMedia = \Tainacan\Media::get_instance();
$thumb_blob = $TainacanMedia->get_pdf_cover( $filepath );
if ( $thumb_blob ) {
$thumb_id = $TainacanMedia->insert_attachment_from_blob( $thumb_blob, basename( $filepath ) . '-cover.jpg', $item->get_id() );
$thumb_id = $TainacanMedia->insert_attachment_from_blob( $thumb_blob, basename( $filepath ) . '-cover.jpg' );
return $thumb_id;
}
@ -443,7 +443,7 @@ class Items extends Repository {
return $existing_thumb;
} else {
$TainacanMedia = \Tainacan\Media::get_instance();
$thumb_id = $TainacanMedia->insert_attachment_from_url( $thumb_url, $item->get_id() );
$thumb_id = $TainacanMedia->insert_attachment_from_url( $thumb_url );
update_post_meta( $item->get_id(), $meta_key, $thumb_id );
return $thumb_id;

View File

@ -690,7 +690,9 @@ class Test_Importer extends Importer {
$metadatum->set_name($args['name']);
$metadatum->set_collection($collection);
$metadatum->set_metadata_type($args['type']);
$metadatum->set_metadata_type_options($args['options']);
if ( isset($args['options']) ) {
$metadatum->set_metadata_type_options($args['options']);
}
$metadatum->set_status('publish');
if ($metadatum->validate()) {
$metadatum = $this->metadata_repo->insert($metadatum);

View File

@ -46,8 +46,7 @@ export default {
});
},
watch: {
'$route' (to, from) {
'$route' (to, from) {
// Should set Collection ID from URL only when in admin.
if (this.$route.name == 'CollectionItemsPage' || this.$route.name == 'ItemsPage')
this.collectionId = !this.$route.params.collectionId ? this.$route.params.collectionId : parseInt(this.$route.params.collectionId);
@ -291,21 +290,20 @@ export default {
this.updateURLQueries();
},
updateURLQueries() {
this.$router.push({query: {}});
this.$router.push({query: this.$store.getters['search/getPostQuery']});
this.$router.replace({query: {}});
this.$router.replace({query: this.$store.getters['search/getPostQuery']});
},
updateStoreFromURL() {
this.$store.dispatch('search/set_postquery', this.$route.query);
},
loadItems(to) {
// Forces fetch_only to be filled before any search happens
if (this.$store.getters['search/getPostQuery']['fetch_only'] == undefined) {
this.$emit( 'hasToPrepareMetadataAndFilters', to);
} else {
this.$emit( 'isLoadingItems', true);
this.$emit( 'isLoadingItems', true);
// Forces fetch_only to be filled before any search happens
if (this.$store.getters['search/getPostQuery']['fetch_only'] == undefined) {
this.$emit( 'hasToPrepareMetadataAndFilters', to);
} else {
this.$store.dispatch('collection/fetchItems', {
'collectionId': this.collectionId,
'isOnTheme': (this.$route.name == null),
@ -318,7 +316,7 @@ export default {
this.$emit( 'hasFiltered', res.hasFiltered);
if(res.advancedSearchResults){
this.$router.push({query: this.$store.getters['search/getPostQuery'],});
this.$router.replace({query: this.$store.getters['search/getPostQuery'],});
this.$emit('advancedSearchResults', res.advancedSearchResults);
}
})

View File

@ -273,6 +273,11 @@ class Migrations {
}
}
static function refresh_rewrite_rules() {
// needed after we changed the Collections post type rewrite slug
flush_rewrite_rules(false);
}
}

View File

@ -17,7 +17,7 @@
<!-- RECORDS VIEW MODE -->
<masonry
:cols="{default: 7, 1919: 6, 1407: 5, 1215: 4, 1023: 3, 767: 2, 343: 1}"
:gutter="30"
:gutter="25"
class="tainacan-masonry-container">
<a
:key="index"

View File

@ -17,7 +17,7 @@
<!-- RECORDS VIEW MODE -->
<masonry
:cols="{default: 4, 1919: 3, 1407: 2, 1215: 2, 1023: 1, 767: 1, 343: 1}"
:gutter="42"
:gutter="30"
class="tainacan-records-container">
<a
:href="item.url"