Merge branch 'develop' into feature/facets_ES

This commit is contained in:
Mateus Machado Luna 2019-04-08 12:31:27 -03:00
commit 88b08db4ad
14 changed files with 87 additions and 26 deletions

View File

@ -221,11 +221,12 @@
margin-right: 28px;
.control {
.search-header {
border: 1px solid $gray2 !important;
border: 1px solid $gray2;
height: 28px;
transition: width linear 0.15s;
-webkit-transition: width linear 0.15s;
width: 220px;
font-size: 0.75rem;
}
.search-header:focus, .search-header:active {
width: 372px !important;

View File

@ -145,7 +145,8 @@
:active.sync="isColumnLoading"/>
</div>
<nav
style="margin-top: 10px;"
v-if="!isSearching && isTaxonomy"
style="margin-top: 6px;"
class="breadcrumb is-small has-succeeds-separator"
aria-label="breadcrumbs">
<ul>
@ -744,7 +745,7 @@
// In theme, the bootstrap removes the style of <a> without href
a {
cursor: pointer;
color: $turquoise5 !important;
color: $turquoise5;
}
.tainacan-form {
@ -788,6 +789,7 @@
.b-checkbox, .b-radio {
max-width: 81%;
margin-left: 0.7rem;
margin-bottom: 0;
height: 24px;
}
@ -801,6 +803,7 @@
flex-grow: 0;
flex-shrink: 1;
max-width: calc(50% - 8.3333333%);
padding-left: 0.5rem;
.b-checkbox, .b-radio {
margin-right: 10px;
@ -818,6 +821,7 @@
overflow: auto;
padding: 0 !important;
min-height: 253px;
max-height: 35vh;
&:focus {
outline: none;

View File

@ -61,6 +61,9 @@
}
&.is-mobile-modal {
@media screen and (max-width: 1088px) {
.dropdown-content {
max-height: 100vh;
}
.dropdown-menu {
border-radius: 4px;
.dropdown-item {

View File

@ -1,6 +1,16 @@
// Tainacan modals
.modal .animation-content {
width: 100%;
width: 91.6666667%;
width: 91.6666667vw;
max-height: 86%;
max-height: 86vh;
overflow: auto;
border-radius: 0;
@media screen and (max-width: 769px) {
max-height: 95%;
max-height: 95vh;
}
}
.modal .modal-close {
z-index: 99999;
@ -24,6 +34,7 @@
display: inline-block;
width: 90%;
margin-right: auto;
margin-bottom: 0px;
}
a.back-link{
font-weight: 500;
@ -41,12 +52,19 @@
.tainacan-modal-content {
border-radius: 0px;
background-color: white;
padding: 40px 50px;
padding: 40px $page-side-padding;
position: relative;
max-height: 86%;
max-height: 86vh;
overflow-y: auto;
overflow-x: hidden;
@media only screen and (max-width: 768px) {
padding: 40px 8.333333%;
padding: 40px 8.333333vw;
}
nav {
border: none !important;
}
figure {
margin: 0;
@ -63,6 +81,7 @@
@media only screen and (max-width: 768px) {
max-height: 100%;
max-height: 100vh;
display: block;
}
}
// Bulma modals customized for Tainacan (custom-dialog.vue)

View File

@ -1,11 +1,14 @@
// Tabs
.tabs {
li {
overflow-y: hidden;
}
a {
font-size: 0.8125rem;
color: black !important;
margin-bottom: -3px !important;
border-bottom: 5px solid transparent;
border-bottom: 4px solid transparent;
transition: border-bottom-color ease 0.3s;
cursor: pointer !important;
&:hover{
border-bottom-color: transparent;

View File

@ -62,7 +62,7 @@
}
.radio, .checkbox {
align-items: center;
margin-bottom: 0;
margin-bottom: 5px;
width: 100%;

View File

@ -55,7 +55,7 @@ export default {
@import "../admin/scss/_pagination.scss";
@import "../admin/scss/_tags.scss";
@import "../admin/scss/_notices.scss";
// @import "../admin/scss/_tabs.scss";
@import "../admin/scss/_tabs.scss";
@import "../admin/scss/_selects.scss";
@import "../admin/scss/_dropdown-and-autocomplete.scss";
@import "../admin/scss/_tooltips.scss";

View File

@ -392,21 +392,38 @@ class REST_Items_Controller extends REST_Controller {
public function get_items_permissions_check( $request ) {
$collection = $this->collections_repository->fetch($request['collection_id']);
if('edit' === $request['context'] && !is_user_logged_in()) {
return false;
}
if ( isset($request['taxquery']) && !$this->get_items_permissions_check_for_taxonomy($request['taxquery']) ) {
return false;
}
if(($collection instanceof Entities\Collection)) {
if('edit' === $request['context'] && !$collection->can_read()) {
if(!$collection->can_read()) {
return false;
}
return true;
} else {
if('edit' === $request['context'] && !$this->collections_repository->can_read(new Entities\Collection())) {
return false;
}
return true;
}
}
private function get_items_permissions_check_for_taxonomy($taxonomies) {
$taxonomy_repository = Repositories\Taxonomies::get_instance();
foreach ($taxonomies as $tax) {
$tax_id = $taxonomy_repository->get_id_by_db_identifier($tax['taxonomy']);
$taxonomy = $taxonomy_repository->fetch($tax_id);
if(($taxonomy instanceof Entities\Taxonomy)) {
if(!$taxonomy->can_read()) {
return false;
}
}
}
return true;
}
/**
* @param \WP_REST_Request $request
*

View File

@ -172,7 +172,10 @@ class REST_Taxonomies_Controller extends REST_Controller {
$taxonomy = $this->taxonomy_repository->fetch($request['taxonomy_id']);
if(($taxonomy instanceof Entities\Taxonomy)) {
if('edit' === $request['context'] && !$taxonomy->can_read()) {
if('edit' === $request['context'] && !is_user_logged_in()) {
return false;
}
if(!$taxonomy->can_read()) {
return false;
}

View File

@ -350,7 +350,10 @@ class REST_Terms_Controller extends REST_Controller {
$taxonomy = $this->taxonomy_repository->fetch($request['taxonomy_id']);
if(($taxonomy instanceof Entities\Taxonomy)) {
if('edit' === $request['context'] && !$taxonomy->can_read()) {
if('edit' === $request['context'] && !is_user_logged_in()) {
return false;
}
if(!$taxonomy->can_read()) {
return false;
}
@ -385,7 +388,10 @@ class REST_Terms_Controller extends REST_Controller {
$taxonomy = $this->taxonomy_repository->fetch($request['taxonomy_id']);
if(($taxonomy instanceof Entities\Taxonomy)) {
if('edit' === $request['context'] && !$taxonomy->can_read()) {
if('edit' === $request['context'] && !is_user_logged_in()) {
return false;
}
if(!$taxonomy->can_read()) {
return false;
}

View File

@ -33,7 +33,6 @@
</span>
<span class="collapse-label">{{ filter.name }}</span>
</button>
<div
:id="'filter-input-id-' + filter.id">
<component
@ -101,6 +100,10 @@
.datepicker {
.datepicker-content {
height: auto;
}
.dropdown-item {
background-color: white !important;
}

View File

@ -670,8 +670,14 @@ abstract class Repository {
* @throws \Exception
*/
public function can_read( $entity, $user = null ) {
if ( is_null( $user ) ) {
$user = get_current_user_id();
if ( ! $user ) {
$status = get_post_status($entity->get_id());
$post_status_obj = get_post_status_object($status);
return $post_status_obj->public;
}
} elseif ( is_object( $user ) ) {
$user = $user->ID;
}

View File

@ -26,10 +26,6 @@ function tainacan_blocks_add_gutenberg_blocks_actions() {
function tainacan_blocks_register_categories($categories, $post){
if ( $post->post_type !== 'post' ) {
return $categories;
}
return array_merge(
$categories,
array(

View File

@ -670,7 +670,7 @@ class CSV extends Importer {
}
if( is_array($exploded_values) ) {
$parent = 0;
$parent = ( count($exploded_values) === 1 ) ? null : 0;
foreach ( $exploded_values as $key => $value) {
$value = trim($value);
if ($value=='') {