Fixes error on get collections by status and adjust event page font sizes and button styles

This commit is contained in:
weryques 2018-05-22 14:43:02 -03:00
parent f9189a1203
commit a15e405aec
6 changed files with 85 additions and 36 deletions

View File

@ -5,7 +5,7 @@
<div class="tile is-parent">
<article class="tile box is-child">
<div class="content">
<div class="title">{{ this.$i18n.get('info_logs_before') }}</div>
<h1 class="event-titles">{{ this.$i18n.get('info_logs_before') }}</h1>
<div
v-for="(diff, key) in event.log_diffs"
v-if="diff.old"
@ -88,7 +88,7 @@
<div class="tile is-parent">
<article class="tile box is-child">
<div class="content">
<div class="title">{{ this.$i18n.get('info_logs_after') }}</div>
<h1 class="event-titles">{{ this.$i18n.get('info_logs_after') }}</h1>
<div
v-for="(diff, key) in event.log_diffs"
:key="key">
@ -186,4 +186,11 @@
.content {
overflow: auto;
}
.event-titles {
font-size: 20px;
font-weight: 500;
color: #01295c;
display: inline-block;
}
</style>

View File

@ -6,7 +6,7 @@
<article class="tile box is-child">
<div class="content">
<div class="title">{{ this.$i18n.get('info_changes') }}</div>
<h1 class="event-titles">{{ this.$i18n.get('info_changes') }}</h1>
<div
v-for="(diff, key) in event.log_diffs"
v-if="diff.old"
@ -184,4 +184,11 @@
.content {
overflow: auto;
}
.event-titles {
font-size: 20px;
font-weight: 500;
color: #01295c;
display: inline-block;
}
</style>

View File

@ -2,21 +2,38 @@
<div>
<div class="is-fullheight">
<div class="page-container primary-page">
<tainacan-title />
<div class="title">{{ event.description }}</div>
<tainacan-title/>
<h1 class="event-titles">{{ event.description }}</h1>
<div
class="level"
v-if="event.title !== undefined && event.title.includes('updated')">
<div class="level-left"/>
<div class="level-right">
<div class="level-item">
<b-switch
v-model="comp"
true-value="Unified"
false-value="Split"
class="is-pulled-right">
{{ comp }}
</b-switch>
<div class="field has-addons is-pulled-right">
<p class="control">
<a
@click="comp = 'Split'"
:class="{'is-selected': comp === 'Split', 'is-focused': comp === 'Split'}"
class="button">
<b-icon
icon="pause"
size="is-small"/>
<span>{{ $i18n.get('split') }}</span>
</a>
</p>
<p class="control">
<a
@click="comp = 'Unified'"
:class="{'is-selected': comp === 'Unified', 'is-focused': comp === 'Unified'}"
class="button">
<b-icon
icon="minus"
size="is-small"/>
<span>{{ $i18n.get('unified') }}</span>
</a>
</p>
</div>
</div>
</div>
</div>
@ -30,7 +47,7 @@
</div>
<div v-else-if="event.title !== undefined">
<no-diff :event="event" />
<no-diff :event="event"/>
</div>
</div>
@ -91,4 +108,21 @@
.bottom-space-tainacan {
margin-bottom: 0.2rem;
}
.event-titles {
font-size: 20px;
font-weight: 500;
color: #01295c;
display: inline-block;
}
.field.has-addons .control:first-child .button {
border-bottom-right-radius: 0 !important;
border-top-right-radius: 0 !important;
}
.field.has-addons .control:last-child .button {
border-bottom-left-radius: 0 !important;
border-top-left-radius: 0 !important;
}
</style>

View File

@ -39,6 +39,8 @@ return [
'add_one_item' => __( 'Add one item', 'tainacan' ),
'add_items_bulk' => __( 'Add items in bulk', 'tainacan' ),
'add_items_external_source' => __( 'Add items from an external source', 'tainacan' ),
'split' => __( 'Split', 'tainacan' ),
'unified' => __( 'Unified', 'tainacan' ),
// Wordpress Status
'publish' => __( 'Publish', 'tainacan' ),

View File

@ -354,7 +354,6 @@ class REST_Controller extends \WP_REST_Controller {
'enum' => array_merge(array_keys(get_post_stati()), array('any')),
'type' => 'string',
),
'sanitize_callback' => array($this, 'sanitize_post_statuses'),
);
$query_params['offset'] = array(

View File

@ -311,21 +311,21 @@ class Logs extends Repository {
}
if ( $is_update ) {
$msn = $this->prepare_event_message($class_name, 'updated');
$description = $this->prepare_event_description_message($new_value, $name, $class_name, 'updated');
$msn = $this->prepare_event_message($new_value, $name, $class_name, 'updated');
$description = $msn;
} elseif( $is_delete ){
// was deleted
$msn = $this->prepare_event_message($class_name, 'deleted');
$description = $this->prepare_event_description_message($new_value, $name, $class_name, 'deleted');
$msn = $this->prepare_event_message($new_value, $name, $class_name, 'deleted');
$description = $msn;
} elseif( !empty($diffs) ) {
// was created
$msn = $this->prepare_event_message($class_name, 'created');
$description = $this->prepare_event_description_message($new_value, $name, $class_name, 'created');
$msn = $this->prepare_event_message($new_value, $name, $class_name, 'created');
$description = $msn;
} elseif( $is_trash ) {
// was trashed
$msn = $this->prepare_event_message($class_name, 'trashed');
$description = $this->prepare_event_description_message($new_value, $name, $class_name, 'trashed');
$msn = $this->prepare_event_message($new_value, $name, $class_name, 'trashed');
$description = $msn;
}
$msn = apply_filters( 'tainacan-insert-log-message-title', $msn, $type, $new_value );
@ -338,19 +338,19 @@ class Logs extends Repository {
}
}
private function prepare_event_message($class_name, $action_message){
$articleA = 'A';
$articleAn = 'An';
$vowels = 'aeiou';
if ( substr_count( $vowels, strtolower( substr( $class_name, 0, 1 ) ) ) > 0 ) {
$msn = sprintf( __( '%s %s has been %s.', 'tainacan' ), $articleAn, $class_name, $action_message );
} else {
$msn = sprintf( __( '%s %s has been %s.', 'tainacan' ), $articleA, $class_name, $action_message );
}
return $msn;
}
// private function prepare_event_message($class_name, $action_message){
// $articleA = 'A';
// $articleAn = 'An';
// $vowels = 'aeiou';
//
// if ( substr_count( $vowels, strtolower( substr( $class_name, 0, 1 ) ) ) > 0 ) {
// $msn = sprintf( __( '%s %s has been %s.', 'tainacan' ), $articleAn, $class_name, $action_message );
// } else {
// $msn = sprintf( __( '%s %s has been %s.', 'tainacan' ), $articleA, $class_name, $action_message );
// }
//
// return $msn;
// }
/**
* This will prepare the event description for objects
@ -363,7 +363,7 @@ class Logs extends Repository {
*
* @return string
*/
private function prepare_event_description_message($object, $name, $class_name, $action_message){
private function prepare_event_message($object, $name, $class_name, $action_message){
if ( $object instanceof Entities\Field || $object instanceof Entities\Item || $object instanceof Entities\Filter) {
$collection = $object->get_collection();
$parent = $collection;