Merge branch 'develop' into feature/456
This commit is contained in:
commit
7162c3eb4a
|
@ -1895,29 +1895,11 @@
|
||||||
"integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug=="
|
"integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug=="
|
||||||
},
|
},
|
||||||
"axios": {
|
"axios": {
|
||||||
"version": "0.19.2",
|
"version": "0.21.1",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
|
||||||
"integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==",
|
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"follow-redirects": "1.5.10"
|
"follow-redirects": "^1.10.0"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"debug": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
|
|
||||||
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
|
|
||||||
"requires": {
|
|
||||||
"ms": "2.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"follow-redirects": {
|
|
||||||
"version": "1.5.10",
|
|
||||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
|
|
||||||
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
|
|
||||||
"requires": {
|
|
||||||
"debug": "=3.1.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"babel-code-frame": {
|
"babel-code-frame": {
|
||||||
|
@ -4472,8 +4454,7 @@
|
||||||
"follow-redirects": {
|
"follow-redirects": {
|
||||||
"version": "1.12.1",
|
"version": "1.12.1",
|
||||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.12.1.tgz",
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.12.1.tgz",
|
||||||
"integrity": "sha512-tmRv0AVuR7ZyouUHLeNSiO6pqulF7dYa3s19c6t+wz9LD69/uSzdMxJ2S91nTI9U3rt/IldxpzMOFejp6f0hjg==",
|
"integrity": "sha512-tmRv0AVuR7ZyouUHLeNSiO6pqulF7dYa3s19c6t+wz9LD69/uSzdMxJ2S91nTI9U3rt/IldxpzMOFejp6f0hjg=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"for-in": {
|
"for-in": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
|
@ -4751,12 +4732,6 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"ini": {
|
|
||||||
"version": "1.3.5",
|
|
||||||
"bundled": true,
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"is-fullwidth-code-point": {
|
"is-fullwidth-code-point": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
|
@ -5785,9 +5760,15 @@
|
||||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
||||||
},
|
},
|
||||||
"ini": {
|
"ini": {
|
||||||
|
<<<<<<< HEAD
|
||||||
"version": "1.3.8",
|
"version": "1.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
|
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
|
||||||
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
|
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
|
||||||
|
=======
|
||||||
|
"version": "1.3.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.7.tgz",
|
||||||
|
"integrity": "sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ==",
|
||||||
|
>>>>>>> develop
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"inquirer": {
|
"inquirer": {
|
||||||
|
@ -6846,7 +6827,8 @@
|
||||||
"ms": {
|
"ms": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"multicast-dns": {
|
"multicast-dns": {
|
||||||
"version": "6.2.3",
|
"version": "6.2.3",
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
"build-prod": "cross-env NODE_ENV=production webpack --config webpack.prod.js --display-error-details --progress --hide-modules"
|
"build-prod": "cross-env NODE_ENV=production webpack --config webpack.prod.js --display-error-details --progress --hide-modules"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.19.2",
|
|
||||||
"blurhash": "^1.1.3",
|
"blurhash": "^1.1.3",
|
||||||
|
"axios": "^0.21.1",
|
||||||
"buefy": "^0.9.4",
|
"buefy": "^0.9.4",
|
||||||
"bulma": "^0.9.1",
|
"bulma": "^0.9.1",
|
||||||
"css-vars-ponyfill": "^2.3.1",
|
"css-vars-ponyfill": "^2.3.1",
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
body:not([class]){
|
||||||
|
margin: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
body:not([class]) > img {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
body:not([class]) > iframe {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 80vh;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
body:not([class]) > audio,
|
||||||
|
body:not([class]) > video {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
min-height: 54px;
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
body:not([class]) > audio {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
body:not([class]) > a,
|
||||||
|
body:not([class]) > p {
|
||||||
|
z-index: 99;
|
||||||
|
padding: 1rem 4.33337vw;
|
||||||
|
background: white;
|
||||||
|
border-radius: 3px;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
|
@ -145,7 +145,7 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
register_rest_route(
|
register_rest_route(
|
||||||
$this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/submission/(?P<submission_id>[\d]+)/finish',
|
$this->namespace, '/collection/(?P<collection_id>[\d]+)/' . $this->rest_base . '/submission/(?P<submission_id>[a-z0-9]+)/finish',
|
||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::CREATABLE,
|
'methods' => \WP_REST_Server::CREATABLE,
|
||||||
|
@ -987,12 +987,16 @@ class REST_Items_Controller extends REST_Controller {
|
||||||
|
|
||||||
if ($item->validate()) {
|
if ($item->validate()) {
|
||||||
$item = $this->items_repository->insert( $item );
|
$item = $this->items_repository->insert( $item );
|
||||||
$fake_id = \hexdec(\uniqid());
|
$fake_id = md5(uniqid(mt_rand(), true));
|
||||||
$id = $item->get_id();
|
$id = $item->get_id();
|
||||||
set_transient('tnc_transient_submission_' . $fake_id, $id, 300);
|
if (set_transient('tnc_transient_submission_' . $fake_id, $id, 300) == true) {
|
||||||
$response_item = $this->prepare_item_for_response($item, $request);
|
$response_item = $this->prepare_item_for_response($item, $request);
|
||||||
$response_item['id'] = $fake_id;
|
$response_item['id'] = $fake_id;
|
||||||
return new \WP_REST_Response($response_item, 201 );
|
return new \WP_REST_Response($response_item, 201 );
|
||||||
|
} else return new \WP_REST_Response([
|
||||||
|
'error_message' => __('unable create submission ID.', 'tainacan'),
|
||||||
|
], 400);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return new \WP_REST_Response([
|
return new \WP_REST_Response([
|
||||||
'error_message' => __('One or more values are invalid.', 'tainacan'),
|
'error_message' => __('One or more values are invalid.', 'tainacan'),
|
||||||
|
|
|
@ -151,6 +151,7 @@ class REST_Roles_Controller extends REST_Controller {
|
||||||
|
|
||||||
if ( isset($request['capabilities']) && is_array($request['capabilities']) ) {
|
if ( isset($request['capabilities']) && is_array($request['capabilities']) ) {
|
||||||
$this->handle_capabilities_for_role($role_slug, $request['capabilities']);
|
$this->handle_capabilities_for_role($role_slug, $request['capabilities']);
|
||||||
|
$this->handle_capabilites_default_for_role($role_slug);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($new_role instanceof \WP_Role) {
|
if ($new_role instanceof \WP_Role) {
|
||||||
|
@ -262,6 +263,7 @@ class REST_Roles_Controller extends REST_Controller {
|
||||||
if ( is_array($request['capabilities']) ) {
|
if ( is_array($request['capabilities']) ) {
|
||||||
|
|
||||||
$this->handle_capabilities_for_role($role_slug, $request['capabilities']);
|
$this->handle_capabilities_for_role($role_slug, $request['capabilities']);
|
||||||
|
$this->handle_capabilites_default_for_role($role_slug);
|
||||||
|
|
||||||
} elseif ( isset($request['add_cap']) ) {
|
} elseif ( isset($request['add_cap']) ) {
|
||||||
// validate that we only deal with tainacan capabilities
|
// validate that we only deal with tainacan capabilities
|
||||||
|
@ -317,6 +319,13 @@ class REST_Roles_Controller extends REST_Controller {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function handle_capabilites_default_for_role($role_slug) {
|
||||||
|
if ( !isset( \wp_roles()->roles[$role_slug] ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
\wp_roles()->add_cap($role_slug, 'read', true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \WP_REST_Request $request
|
* @param \WP_REST_Request $request
|
||||||
*
|
*
|
||||||
|
|
|
@ -21,6 +21,9 @@ class Media {
|
||||||
|
|
||||||
protected function __construct() {
|
protected function __construct() {
|
||||||
add_action( 'init', [$this, 'add_attachment_page_rewrite_rule'] );
|
add_action( 'init', [$this, 'add_attachment_page_rewrite_rule'] );
|
||||||
|
add_action( 'admin_enqueue_scripts', array( &$this, 'add_css' ) );
|
||||||
|
add_action( 'wp_enqueue_scripts', array( &$this, 'add_css' ) );
|
||||||
|
|
||||||
add_filter( 'query_vars', [$this, 'attachment_page_add_var'] );
|
add_filter( 'query_vars', [$this, 'attachment_page_add_var'] );
|
||||||
add_action( 'template_redirect', [$this, 'attachment_page'] );
|
add_action( 'template_redirect', [$this, 'attachment_page'] );
|
||||||
}
|
}
|
||||||
|
@ -33,6 +36,11 @@ class Media {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function add_css() {
|
||||||
|
global $TAINACAN_BASE_URL;
|
||||||
|
wp_enqueue_style( 'tainacan-media-page', $TAINACAN_BASE_URL . '/assets/css/tainacan-media-page.css', [], TAINACAN_VERSION );
|
||||||
|
}
|
||||||
|
|
||||||
public function attachment_page_add_var($vars) {
|
public function attachment_page_add_var($vars) {
|
||||||
$vars[] = 'tainacan_attachment_page';
|
$vars[] = 'tainacan_attachment_page';
|
||||||
return $vars;
|
return $vars;
|
||||||
|
@ -320,11 +328,11 @@ class Media {
|
||||||
|
|
||||||
public function attachment_page() {
|
public function attachment_page() {
|
||||||
$att_id = get_query_var('tainacan_attachment_page');
|
$att_id = get_query_var('tainacan_attachment_page');
|
||||||
|
|
||||||
if ( ! $att_id ) {
|
if ( ! $att_id ) {
|
||||||
return; // continue normal execution
|
return; // continue normal execution
|
||||||
}
|
}
|
||||||
|
|
||||||
$attachment = get_post($att_id);
|
$attachment = get_post($att_id);
|
||||||
|
|
||||||
if ( $attachment instanceof \WP_Post && $attachment->post_type == 'attachment' ) {
|
if ( $attachment instanceof \WP_Post && $attachment->post_type == 'attachment' ) {
|
||||||
|
@ -359,7 +367,7 @@ class Media {
|
||||||
$output .= $img;
|
$output .= $img;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
wp_print_styles('tainacan-media-page');
|
||||||
global $wp_embed;
|
global $wp_embed;
|
||||||
|
|
||||||
$url = wp_get_attachment_url($att_id);
|
$url = wp_get_attachment_url($att_id);
|
||||||
|
|
|
@ -24,6 +24,9 @@ class Roles {
|
||||||
*/
|
*/
|
||||||
private function __construct() {
|
private function __construct() {
|
||||||
|
|
||||||
|
$this->meta_caps = (new \Tainacan\Entities\Metadatum())->get_capabilities();
|
||||||
|
$this->filters_caps = (new \Tainacan\Entities\Filter())->get_capabilities();
|
||||||
|
|
||||||
$this->capabilities = [
|
$this->capabilities = [
|
||||||
'manage_tainacan' => [
|
'manage_tainacan' => [
|
||||||
'display_name' => __('Manage Tainacan', 'tainacan'),
|
'display_name' => __('Manage Tainacan', 'tainacan'),
|
||||||
|
@ -172,6 +175,10 @@ class Roles {
|
||||||
'display_name' => __('Manage Collection', 'tainacan'),
|
'display_name' => __('Manage Collection', 'tainacan'),
|
||||||
'description' => __('Manage all collection settings, items, metadata, filters, etc.', 'tainacan'),
|
'description' => __('Manage all collection settings, items, metadata, filters, etc.', 'tainacan'),
|
||||||
'scope' => 'collection',
|
'scope' => 'collection',
|
||||||
|
'dependencies' => [
|
||||||
|
$this->meta_caps->read_private_posts,
|
||||||
|
$this->filters_caps->read_private_posts
|
||||||
|
],
|
||||||
'supercaps' => [
|
'supercaps' => [
|
||||||
'manage_tainacan',
|
'manage_tainacan',
|
||||||
'manage_tainacan_collection_all'
|
'manage_tainacan_collection_all'
|
||||||
|
@ -247,6 +254,9 @@ class Roles {
|
||||||
'display_name' => __('View private metadata', 'tainacan'),
|
'display_name' => __('View private metadata', 'tainacan'),
|
||||||
'description' => __('Access private metadata in this collection', 'tainacan'),
|
'description' => __('Access private metadata in this collection', 'tainacan'),
|
||||||
'scope' => 'collection',
|
'scope' => 'collection',
|
||||||
|
'dependencies' => [
|
||||||
|
$this->meta_caps->read_private_posts, // e.g.: 'read_private_tainacan-metadata'
|
||||||
|
],
|
||||||
'supercaps' => [
|
'supercaps' => [
|
||||||
'manage_tainacan',
|
'manage_tainacan',
|
||||||
'manage_tainacan_collection_all',
|
'manage_tainacan_collection_all',
|
||||||
|
@ -258,6 +268,9 @@ class Roles {
|
||||||
'display_name' => __('View private filters', 'tainacan'),
|
'display_name' => __('View private filters', 'tainacan'),
|
||||||
'description' => __('Access private filters in this collection', 'tainacan'),
|
'description' => __('Access private filters in this collection', 'tainacan'),
|
||||||
'scope' => 'collection',
|
'scope' => 'collection',
|
||||||
|
'dependencies' => [
|
||||||
|
$this->filters_caps->read_private_posts, // e.g.: 'read_private_tainacan-filters'
|
||||||
|
],
|
||||||
'supercaps' => [
|
'supercaps' => [
|
||||||
'manage_tainacan',
|
'manage_tainacan',
|
||||||
'manage_tainacan_collection_all',
|
'manage_tainacan_collection_all',
|
||||||
|
@ -392,7 +405,8 @@ class Roles {
|
||||||
'slug' => 'tainacan-administrator',
|
'slug' => 'tainacan-administrator',
|
||||||
'display_name' => 'Tainacan Administrator',
|
'display_name' => 'Tainacan Administrator',
|
||||||
'caps' => [
|
'caps' => [
|
||||||
'manage_tainacan' => true
|
'manage_tainacan' => true,
|
||||||
|
'read' => true
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'tainacan-editor' => [
|
'tainacan-editor' => [
|
||||||
|
@ -414,7 +428,8 @@ class Roles {
|
||||||
'tnc_rep_read_private_metadata' => true,
|
'tnc_rep_read_private_metadata' => true,
|
||||||
'tnc_rep_read_private_filters' => true,
|
'tnc_rep_read_private_filters' => true,
|
||||||
'tnc_rep_read_logs' => true,
|
'tnc_rep_read_logs' => true,
|
||||||
'manage_tainacan_collection_all' => true
|
'manage_tainacan_collection_all' => true,
|
||||||
|
'read' => true
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'tainacan-author' => [
|
'tainacan-author' => [
|
||||||
|
@ -427,6 +442,7 @@ class Roles {
|
||||||
'tnc_rep_read_private_taxonomies' => true,
|
'tnc_rep_read_private_taxonomies' => true,
|
||||||
'tnc_rep_read_private_metadata' => true,
|
'tnc_rep_read_private_metadata' => true,
|
||||||
'tnc_rep_read_private_filters' => true,
|
'tnc_rep_read_private_filters' => true,
|
||||||
|
'read' => true
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
@ -534,6 +550,17 @@ class Roles {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( in_array($requested_cap, [
|
||||||
|
$this->meta_caps->read_private_posts,
|
||||||
|
$this->filters_caps->read_private_posts]
|
||||||
|
) && (
|
||||||
|
$user->has_cap('manage_tainacan') ||
|
||||||
|
$user->has_cap('manage_tainacan_collection_all')
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
$allcaps = array_merge($allcaps, [ $requested_cap => true ]);
|
||||||
|
}
|
||||||
|
|
||||||
if ( \strpos($cap, 'tnc_') === 0 ) {
|
if ( \strpos($cap, 'tnc_') === 0 ) {
|
||||||
|
|
||||||
if ( $user->has_cap('manage_tainacan') ) {
|
if ( $user->has_cap('manage_tainacan') ) {
|
||||||
|
|
|
@ -544,6 +544,8 @@ class Item extends Entity {
|
||||||
*
|
*
|
||||||
* @type bool $hide_empty Wether to hide or not metadata the item has no value to
|
* @type bool $hide_empty Wether to hide or not metadata the item has no value to
|
||||||
* Default: true
|
* Default: true
|
||||||
|
* @type bool $display_slug_as_class Show metadata slug as a class in the div before the metadata block
|
||||||
|
* Default: false
|
||||||
* @type string $before String to be added before each metadata block
|
* @type string $before String to be added before each metadata block
|
||||||
* Default '<div class="metadata-type-$type">' where $type is the metadata type slug
|
* Default '<div class="metadata-type-$type">' where $type is the metadata type slug
|
||||||
* @type string $after String to be added after each metadata block
|
* @type string $after String to be added after each metadata block
|
||||||
|
@ -576,7 +578,8 @@ class Item extends Entity {
|
||||||
'exclude_description' => false,
|
'exclude_description' => false,
|
||||||
'exclude_core' => false,
|
'exclude_core' => false,
|
||||||
'hide_empty' => true,
|
'hide_empty' => true,
|
||||||
'before' => '<div class="metadata-type-$type">',
|
'display_slug_as_class' => false,
|
||||||
|
'before' => '<div class="metadata-type-$type $id">',
|
||||||
'after' => '</div>',
|
'after' => '</div>',
|
||||||
'before_title' => '<h3>',
|
'before_title' => '<h3>',
|
||||||
'after_title' => '</h3>',
|
'after_title' => '</h3>',
|
||||||
|
@ -616,6 +619,12 @@ class Item extends Entity {
|
||||||
$item_meta = new \Tainacan\Entities\Item_Metadata_Entity($this, $metadatum_object);
|
$item_meta = new \Tainacan\Entities\Item_Metadata_Entity($this, $metadatum_object);
|
||||||
if ($item_meta->has_value() || !$args['hide_empty']) {
|
if ($item_meta->has_value() || !$args['hide_empty']) {
|
||||||
$before = str_replace('$type', $mto->get_slug(), $args['before']);
|
$before = str_replace('$type', $mto->get_slug(), $args['before']);
|
||||||
|
if ($args['display_slug_as_class']) {
|
||||||
|
$before = str_replace('$id', 'metadata-slug-'.$item_meta->get_metadatum()->get_slug() , $before);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$before = str_replace(' $id', '', $before);
|
||||||
|
}
|
||||||
$return .= $before;
|
$return .= $before;
|
||||||
$return .= $args['before_title'] . $metadatum_object->get_name() . $args['after_title'];
|
$return .= $args['before_title'] . $metadatum_object->get_name() . $args['after_title'];
|
||||||
$return .= $args['before_value'] . $item_meta->get_value_as_html() . $args['after_value'];
|
$return .= $args['before_value'] . $item_meta->get_value_as_html() . $args['after_value'];
|
||||||
|
@ -681,6 +690,12 @@ class Item extends Entity {
|
||||||
|
|
||||||
if ($item_meta->has_value() || !$args['hide_empty']) {
|
if ($item_meta->has_value() || !$args['hide_empty']) {
|
||||||
$before = str_replace('$type', $fto->get_slug(), $args['before']);
|
$before = str_replace('$type', $fto->get_slug(), $args['before']);
|
||||||
|
if ($args['display_slug_as_class']) {
|
||||||
|
$before = str_replace('$id', 'metadata-slug-'.$item_meta->get_metadatum()->get_slug() , $before);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$before = str_replace(' $id', '', $before);
|
||||||
|
}
|
||||||
$return .= $before;
|
$return .= $before;
|
||||||
$return .= $args['before_title'] . $item_meta->get_metadatum()->get_name() . $args['after_title'];
|
$return .= $args['before_title'] . $item_meta->get_metadatum()->get_name() . $args['after_title'];
|
||||||
$return .= $args['before_value'] . $item_meta->get_value_as_html() . $args['after_value'];
|
$return .= $args['before_value'] . $item_meta->get_value_as_html() . $args['after_value'];
|
||||||
|
|
|
@ -57,14 +57,14 @@ class Csv extends Exposer {
|
||||||
return $a['name'];
|
return $a['name'];
|
||||||
}, $items[0]['metadata']);
|
}, $items[0]['metadata']);
|
||||||
|
|
||||||
fputcsv($csv, $headers, ';', '"' );
|
fputcsv($csv, $headers, ',', '"' );
|
||||||
|
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
$values = array_map(function($a) {
|
$values = array_map(function($a) {
|
||||||
return $a['value_as_string'];
|
return $a['value_as_string'];
|
||||||
}, $item['metadata']);
|
}, $item['metadata']);
|
||||||
|
|
||||||
fputcsv($csv, $values, ';', '"' );
|
fputcsv($csv, $values, ',', '"' );
|
||||||
|
|
||||||
}
|
}
|
||||||
rewind($csv);
|
rewind($csv);
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Theme_Helper {
|
||||||
// Redirect to post type archive if no cover page is set
|
// Redirect to post type archive if no cover page is set
|
||||||
add_action('wp', array($this, 'collection_single_redirect'));
|
add_action('wp', array($this, 'collection_single_redirect'));
|
||||||
|
|
||||||
add_action('wp_print_scripts', array($this, 'enqueue_scripts'));
|
add_action('wp_print_scripts', array($this, 'enqueue_scripts'), 90);
|
||||||
|
|
||||||
// make archive for terms work with items
|
// make archive for terms work with items
|
||||||
add_action('pre_get_posts', array($this, 'tax_archive_pre_get_posts'));
|
add_action('pre_get_posts', array($this, 'tax_archive_pre_get_posts'));
|
||||||
|
@ -62,6 +62,7 @@ class Theme_Helper {
|
||||||
|
|
||||||
$this->register_view_mode('table', [
|
$this->register_view_mode('table', [
|
||||||
'label' => __('Table', 'tainacan'),
|
'label' => __('Table', 'tainacan'),
|
||||||
|
'description' => 'The classic table display.',
|
||||||
'dynamic_metadata' => true,
|
'dynamic_metadata' => true,
|
||||||
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewtable tainacan-icon-1-25em"></i></span>',
|
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewtable tainacan-icon-1-25em"></i></span>',
|
||||||
'type' => 'component',
|
'type' => 'component',
|
||||||
|
@ -71,7 +72,7 @@ class Theme_Helper {
|
||||||
$this->register_view_mode('cards', [
|
$this->register_view_mode('cards', [
|
||||||
'label' => __('Cards', 'tainacan'),
|
'label' => __('Cards', 'tainacan'),
|
||||||
'dynamic_metadata' => false,
|
'dynamic_metadata' => false,
|
||||||
'description' => 'A cards view, displaying title, description, author name and creation date.',
|
'description' => 'A cards view, displaying cropped thumbnails, title and description.',
|
||||||
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewcards tainacan-icon-1-25em"></i></span>',
|
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewcards tainacan-icon-1-25em"></i></span>',
|
||||||
'type' => 'component',
|
'type' => 'component',
|
||||||
'implements_skeleton' => true,
|
'implements_skeleton' => true,
|
||||||
|
@ -80,7 +81,7 @@ class Theme_Helper {
|
||||||
$this->register_view_mode('records', [
|
$this->register_view_mode('records', [
|
||||||
'label' => __('Records', 'tainacan'),
|
'label' => __('Records', 'tainacan'),
|
||||||
'dynamic_metadata' => true,
|
'dynamic_metadata' => true,
|
||||||
'description' => 'A records view, similiar to cards, but flexible for metadata',
|
'description' => 'A records view, similiar to cards, but flexible for metadata.',
|
||||||
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewrecords tainacan-icon-1-25em"></i></span>',
|
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewrecords tainacan-icon-1-25em"></i></span>',
|
||||||
'type' => 'component',
|
'type' => 'component',
|
||||||
'implements_skeleton' => true,
|
'implements_skeleton' => true,
|
||||||
|
@ -97,7 +98,7 @@ class Theme_Helper {
|
||||||
$this->register_view_mode('slideshow', [
|
$this->register_view_mode('slideshow', [
|
||||||
'label' => __('Slideshow', 'tainacan'),
|
'label' => __('Slideshow', 'tainacan'),
|
||||||
'dynamic_metadata' => false,
|
'dynamic_metadata' => false,
|
||||||
'description' => 'A fullscreen slideshow view.',
|
'description' => 'A fullscreen slideshow view, that shows the item document instead of just thumbnails.',
|
||||||
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewgallery tainacan-icon-1-25em"></i></span>',
|
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewgallery tainacan-icon-1-25em"></i></span>',
|
||||||
'type' => 'component',
|
'type' => 'component',
|
||||||
'show_pagination' => false,
|
'show_pagination' => false,
|
||||||
|
@ -106,7 +107,7 @@ class Theme_Helper {
|
||||||
$this->register_view_mode('list', [
|
$this->register_view_mode('list', [
|
||||||
'label' => __('List', 'tainacan'),
|
'label' => __('List', 'tainacan'),
|
||||||
'dynamic_metadata' => true,
|
'dynamic_metadata' => true,
|
||||||
'description' => 'A list view, similiar to the records, but full width',
|
'description' => 'A list view, similiar to the records, but full width.',
|
||||||
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewlist tainacan-icon-1-25em"></i></span>',
|
'icon' => '<span class="icon"><i class="tainacan-icon tainacan-icon-viewlist tainacan-icon-1-25em"></i></span>',
|
||||||
'type' => 'component',
|
'type' => 'component',
|
||||||
'implements_skeleton' => true,
|
'implements_skeleton' => true,
|
||||||
|
|
|
@ -4,7 +4,7 @@ Tags: museums, libraries, archives, GLAM, collections, repository
|
||||||
Requires at least: 4.8
|
Requires at least: 4.8
|
||||||
Tested up to: 5.6
|
Tested up to: 5.6
|
||||||
Requires PHP: 5.6
|
Requires PHP: 5.6
|
||||||
Stable tag: 0.17.2
|
Stable tag: 0.17.3
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,13 @@ Plugin Name: Tainacan
|
||||||
Plugin URI: https://tainacan.org/
|
Plugin URI: https://tainacan.org/
|
||||||
Description: Open source, 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.
|
Description: Open source, 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: Tainacan.org
|
Author: Tainacan.org
|
||||||
Version: 0.17.2
|
Version: 0.17.3
|
||||||
Text Domain: tainacan
|
Text Domain: tainacan
|
||||||
License: GPLv2 or later
|
License: GPLv2 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const TAINACAN_VERSION = '0.17.2';
|
const TAINACAN_VERSION = '0.17.3';
|
||||||
|
|
||||||
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
||||||
$TAINACAN_BASE_URL = plugins_url('', __FILE__);
|
$TAINACAN_BASE_URL = plugins_url('', __FILE__);
|
||||||
|
|
|
@ -221,7 +221,7 @@
|
||||||
:message="$i18n.getHelperMessage('collections', 'enabled_view_modes')"/>
|
:message="$i18n.getHelperMessage('collections', 'enabled_view_modes')"/>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<b-dropdown
|
<b-dropdown
|
||||||
class="two-columns-dropdown"
|
class="two-columns-dropdown enabled-view-modes-dropdown"
|
||||||
ref="enabledViewModesDropdown"
|
ref="enabledViewModesDropdown"
|
||||||
:mobile-modal="true"
|
:mobile-modal="true"
|
||||||
:disabled="Object.keys(registeredViewModes).length < 0"
|
:disabled="Object.keys(registeredViewModes).length < 0"
|
||||||
|
@ -247,14 +247,19 @@
|
||||||
@input="updateViewModeslist(viewMode)"
|
@input="updateViewModeslist(viewMode)"
|
||||||
:value="checkIfViewModeEnabled(viewMode)"
|
:value="checkIfViewModeEnabled(viewMode)"
|
||||||
:disabled="checkIfViewModeEnabled(viewMode) && form.enabled_view_modes.filter((aViewMode) => (registeredViewModes[aViewMode] && registeredViewModes[aViewMode].full_screen != true)).length <= 1">
|
:disabled="checkIfViewModeEnabled(viewMode) && form.enabled_view_modes.filter((aViewMode) => (registeredViewModes[aViewMode] && registeredViewModes[aViewMode].full_screen != true)).length <= 1">
|
||||||
<span
|
<p>
|
||||||
class="gray-icon"
|
<strong>
|
||||||
:class="{
|
<span
|
||||||
'has-text-secondary' : checkIfViewModeEnabled(viewMode),
|
class="gray-icon"
|
||||||
'has-text-gray4' : !checkIfViewModeEnabled(viewMode)
|
:class="{
|
||||||
}"
|
'has-text-secondary' : checkIfViewModeEnabled(viewMode),
|
||||||
v-html="registeredViewModes[viewMode].icon"/>
|
'has-text-gray4' : !checkIfViewModeEnabled(viewMode)
|
||||||
<span>{{ registeredViewModes[viewMode].label }}</span>
|
}"
|
||||||
|
v-html="registeredViewModes[viewMode].icon"/>
|
||||||
|
{{ registeredViewModes[viewMode].label }}
|
||||||
|
</strong>
|
||||||
|
</p>
|
||||||
|
<p v-if="registeredViewModes[viewMode].description">{{ registeredViewModes[viewMode].description }}</p>
|
||||||
</b-checkbox>
|
</b-checkbox>
|
||||||
</b-dropdown-item>
|
</b-dropdown-item>
|
||||||
</b-dropdown>
|
</b-dropdown>
|
||||||
|
@ -1248,6 +1253,19 @@ export default {
|
||||||
margin-top: -1.5em;
|
margin-top: -1.5em;
|
||||||
border-left: 1px solid var(--tainacan-gray2);
|
border-left: 1px solid var(--tainacan-gray2);
|
||||||
}
|
}
|
||||||
|
.enabled-view-modes-dropdown {
|
||||||
|
/deep/ .dropdown-item {
|
||||||
|
display: flex !important;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
/deep/ svg {
|
||||||
|
margin-left: -2px;
|
||||||
|
overflow: hidden;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
|
@ -632,7 +632,7 @@
|
||||||
v-if="collection && collection.current_user_can_publish_items"
|
v-if="collection && collection.current_user_can_publish_items"
|
||||||
@click="onSubmit(visibility)"
|
@click="onSubmit(visibility)"
|
||||||
type="button"
|
type="button"
|
||||||
class="button is-success">{{ $i18n.get('label_publish') }}</button>
|
class="button is-success">{{ $i18n.get('label_verb_publish') }}</button>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="form-submission-footer"
|
class="form-submission-footer"
|
||||||
|
@ -677,13 +677,13 @@
|
||||||
v-if="!isOnSequenceEdit || (group != null && group.items_count != undefined && group.items_count == itemPosition)"
|
v-if="!isOnSequenceEdit || (group != null && group.items_count != undefined && group.items_count == itemPosition)"
|
||||||
@click="onSubmit(visibility)"
|
@click="onSubmit(visibility)"
|
||||||
type="button"
|
type="button"
|
||||||
class="button is-success">{{ $i18n.get('label_publish') }}</button>
|
class="button is-success">{{ $i18n.get('label_verb_publish') }}</button>
|
||||||
<button
|
<button
|
||||||
v-else
|
v-else
|
||||||
@click="onSubmit(visibility, 'next')"
|
@click="onSubmit(visibility, 'next')"
|
||||||
type="button"
|
type="button"
|
||||||
class="button is-success">
|
class="button is-success">
|
||||||
<span>{{ $i18n.get('label_publish') }}</span>
|
<span>{{ $i18n.get('label_verb_publish') }}</span>
|
||||||
<span class="icon is-large">
|
<span class="icon is-large">
|
||||||
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-next"/>
|
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-next"/>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -276,7 +276,7 @@ export default {
|
||||||
return this.selectedItems && this.selectedItems.length ? 1 : Math.ceil(Number(this.totalItems)/Number(this.maxItemsPerPage));
|
return this.selectedItems && this.selectedItems.length ? 1 : Math.ceil(Number(this.totalItems)/Number(this.maxItemsPerPage));
|
||||||
},
|
},
|
||||||
exposerBaseURL() {
|
exposerBaseURL() {
|
||||||
let baseURL = this.collectionId != undefined ? '/collection/' + this.collectionId + '/items/' : '/items/';
|
let baseURL = this.collectionId ? '/collection/' + this.collectionId + '/items/' : '/items/';
|
||||||
let currentParams = JSON.parse(JSON.stringify(this.$route.query));
|
let currentParams = JSON.parse(JSON.stringify(this.$route.query));
|
||||||
|
|
||||||
// Removes Fetch Only
|
// Removes Fetch Only
|
||||||
|
|
|
@ -109,7 +109,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template slot="empty">{{ $i18n.get('info_no_user_found') }}</template>
|
<template
|
||||||
|
v-if="!isFetchingUsers"
|
||||||
|
slot="empty">
|
||||||
|
{{ $i18n.get('info_no_user_found') }}
|
||||||
|
</template>
|
||||||
</b-autocomplete>
|
</b-autocomplete>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
|
|
|
@ -948,12 +948,14 @@
|
||||||
let descriptionMetadatum = this.localDisplayedMetadata.find(metadatum => metadatum.metadata_type_object != undefined ? metadatum.metadata_type_object.related_mapped_prop == 'description' : false);
|
let descriptionMetadatum = this.localDisplayedMetadata.find(metadatum => metadatum.metadata_type_object != undefined ? metadatum.metadata_type_object.related_mapped_prop == 'description' : false);
|
||||||
|
|
||||||
// Updates Search
|
// Updates Search
|
||||||
this.$eventBusSearch.addFetchOnly(
|
let fetchOnlyArray = [
|
||||||
((thumbnailMetadatum != undefined && thumbnailMetadatum.display) ? 'thumbnail' : null) + ',' +
|
((thumbnailMetadatum != undefined && thumbnailMetadatum.display) ? 'thumbnail' : null),
|
||||||
((creationDateMetadatum != undefined && creationDateMetadatum.display) ? 'creation_date' : null) + ',' +
|
((creationDateMetadatum != undefined && creationDateMetadatum.display) ? 'creation_date' : null),
|
||||||
((authorNameMetadatum != undefined && authorNameMetadatum.display) ? 'author_name': null) + ',' +
|
((authorNameMetadatum != undefined && authorNameMetadatum.display) ? 'author_name': null),
|
||||||
(this.isRepositoryLevel ? 'title' : null) + ',' +
|
(this.isRepositoryLevel ? 'title' : null),
|
||||||
(this.isRepositoryLevel && descriptionMetadatum.display ? 'description' : null), false, fetchOnlyMetadatumIds.toString());
|
(this.isRepositoryLevel && descriptionMetadatum.display ? 'description' : null)
|
||||||
|
];
|
||||||
|
this.$eventBusSearch.addFetchOnly(fetchOnlyArray.filter((fetchOnly) => fetchOnly != null).toString() , false, fetchOnlyMetadatumIds.toString());
|
||||||
|
|
||||||
// Closes dropdown
|
// Closes dropdown
|
||||||
this.$refs.displayedMetadataDropdown.toggle();
|
this.$refs.displayedMetadataDropdown.toggle();
|
||||||
|
@ -1098,13 +1100,14 @@
|
||||||
display: authorNameMetadatumDisplay
|
display: authorNameMetadatumDisplay
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$eventBusSearch.addFetchOnly(
|
let fetchOnlyArray = [
|
||||||
(thumbnailMetadatumDisplay ? 'thumbnail' : null) +','+
|
(thumbnailMetadatumDisplay ? 'thumbnail' : null),
|
||||||
(creationDateMetadatumDisplay ? 'creation_date' : null) +','+
|
(creationDateMetadatumDisplay ? 'creation_date' : null),
|
||||||
(authorNameMetadatumDisplay ? 'author_name' : null) +','+
|
(authorNameMetadatumDisplay ? 'author_name' : null),
|
||||||
(this.isRepositoryLevel ? 'title' : null) +','+
|
(this.isRepositoryLevel ? 'title' : null),
|
||||||
(this.isRepositoryLevel ? 'description' : null)
|
(this.isRepositoryLevel ? 'description' : null)
|
||||||
, false, fetchOnlyMetadatumIds.toString());
|
];
|
||||||
|
this.$eventBusSearch.addFetchOnly(fetchOnlyArray.filter((fetchOnly) => fetchOnly != null).toString() , false, fetchOnlyMetadatumIds.toString());
|
||||||
|
|
||||||
// Sorting metadata
|
// Sorting metadata
|
||||||
if (this.isRepositoryLevel) {
|
if (this.isRepositoryLevel) {
|
||||||
|
|
|
@ -6,6 +6,11 @@
|
||||||
.icon {
|
.icon {
|
||||||
color: var(--tainacan-secondary);
|
color: var(--tainacan-secondary);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
svg {
|
||||||
|
fill: var(--tainacan-secondary);
|
||||||
|
overflow: hidden;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.gray-icon {
|
.gray-icon {
|
||||||
padding-right: 0 !important;
|
padding-right: 0 !important;
|
||||||
|
@ -54,7 +59,10 @@
|
||||||
&:hover { background-color: var(--tainacan-input-border-color); }
|
&:hover { background-color: var(--tainacan-input-border-color); }
|
||||||
.is-small { color: var(--tainacan-info-color); }
|
.is-small { color: var(--tainacan-info-color); }
|
||||||
&.is-active { background-color: var(--tainacan-primary); }
|
&.is-active { background-color: var(--tainacan-primary); }
|
||||||
|
svg {
|
||||||
|
overflow: hidden;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
.media {
|
.media {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
@ -254,7 +254,7 @@ class Admin {
|
||||||
'wp_elasticpress' => \Tainacan\Elastic_Press::get_instance()->is_active(),
|
'wp_elasticpress' => \Tainacan\Elastic_Press::get_instance()->is_active(),
|
||||||
'item_submission_captcha_site_key' => get_option("tnc_option_recaptch_site_key")
|
'item_submission_captcha_site_key' => get_option("tnc_option_recaptch_site_key")
|
||||||
];
|
];
|
||||||
|
|
||||||
$maps = [
|
$maps = [
|
||||||
'collections' => $Tainacan_Collections->get_map(),
|
'collections' => $Tainacan_Collections->get_map(),
|
||||||
'metadata' => $Tainacan_Metadata->get_map(),
|
'metadata' => $Tainacan_Metadata->get_map(),
|
||||||
|
|
|
@ -31,13 +31,21 @@ class Component_Hooks {
|
||||||
private function init() {
|
private function init() {
|
||||||
// the priority should see less than on function
|
// the priority should see less than on function
|
||||||
// `load_admin_page()` of class `Admin` in file /src/views/class-tainacan-admin.php
|
// `load_admin_page()` of class `Admin` in file /src/views/class-tainacan-admin.php
|
||||||
add_action( 'admin_enqueue_scripts', array( &$this, 'register_component' ), 80 );
|
add_action( 'init', array( &$this, 'register_component' ), 80 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function register_component() {
|
public function register_component() {
|
||||||
do_action('tainacan-register-vuejs-component', $this);
|
do_action('tainacan-register-vuejs-component', $this);
|
||||||
foreach($this->registered_component as $handle => $component) {
|
foreach($this->registered_component as $handle => $component) {
|
||||||
wp_enqueue_script($handle, $component['script_path']);
|
$deps = isset($component['args']['deps']) ? $component['args']['deps'] : [];
|
||||||
|
|
||||||
|
if ( is_admin() ) {
|
||||||
|
wp_enqueue_script($handle, $component['script_path'], $deps);
|
||||||
|
} else {
|
||||||
|
if (isset($component['args']['public']) == true && $component['args']['public'] != false) {
|
||||||
|
wp_enqueue_script($handle, $component['script_path'], $deps);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,8 @@ function tainacan_blocks_add_gutenberg_blocks_actions() {
|
||||||
add_action('init', 'tainacan_blocks_register_tainacan_facets_list');
|
add_action('init', 'tainacan_blocks_register_tainacan_facets_list');
|
||||||
add_action('init', 'tainacan_blocks_register_tainacan_item_submission_form');
|
add_action('init', 'tainacan_blocks_register_tainacan_item_submission_form');
|
||||||
|
|
||||||
add_action('init', 'tainacan_blocks_add_plugin_settings');
|
add_action('init', 'tainacan_blocks_add_plugin_settings', 90);
|
||||||
|
add_action('init', 'tainacan_blocks_add_plugin_admin_settings', 90);
|
||||||
|
|
||||||
add_filter('block_categories', 'tainacan_blocks_register_categories', 10, 2);
|
add_filter('block_categories', 'tainacan_blocks_register_categories', 10, 2);
|
||||||
add_action('init', 'tainacan_blocks_register_category_icon');
|
add_action('init', 'tainacan_blocks_register_category_icon');
|
||||||
|
@ -403,14 +404,13 @@ function tainacan_blocks_get_plugin_js_settings(){
|
||||||
'base_url' => $TAINACAN_BASE_URL,
|
'base_url' => $TAINACAN_BASE_URL,
|
||||||
'admin_url' => admin_url(),
|
'admin_url' => admin_url(),
|
||||||
'site_url' => site_url(),
|
'site_url' => site_url(),
|
||||||
'theme_items_list_url' => esc_url_raw( get_site_url() ) . '/' . \Tainacan\Theme_Helper::get_instance()->get_items_list_slug(),
|
'theme_items_list_url' => esc_url_raw( get_site_url() ) . '/' . \Tainacan\Theme_Helper::get_instance()->get_items_list_slug()
|
||||||
];
|
];
|
||||||
|
|
||||||
return $settings;
|
return $settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
function tainacan_blocks_add_plugin_settings() {
|
function tainacan_blocks_add_plugin_settings() {
|
||||||
|
|
||||||
$settings = tainacan_blocks_get_plugin_js_settings();
|
$settings = tainacan_blocks_get_plugin_js_settings();
|
||||||
|
|
||||||
wp_localize_script( 'terms-list', 'tainacan_blocks', $settings );
|
wp_localize_script( 'terms-list', 'tainacan_blocks', $settings );
|
||||||
|
@ -423,6 +423,9 @@ function tainacan_blocks_add_plugin_settings() {
|
||||||
wp_localize_script( 'collections-list', 'tainacan_blocks', $settings );
|
wp_localize_script( 'collections-list', 'tainacan_blocks', $settings );
|
||||||
wp_localize_script( 'carousel-collections-list', 'tainacan_blocks', $settings );
|
wp_localize_script( 'carousel-collections-list', 'tainacan_blocks', $settings );
|
||||||
wp_localize_script( 'facets-list', 'tainacan_blocks', $settings );
|
wp_localize_script( 'facets-list', 'tainacan_blocks', $settings );
|
||||||
|
}
|
||||||
|
|
||||||
|
function tainacan_blocks_add_plugin_admin_settings() {
|
||||||
|
|
||||||
// The faceded search block uses a different settings object, the same used on the theme items list
|
// The faceded search block uses a different settings object, the same used on the theme items list
|
||||||
wp_localize_script( 'tainacan-search', 'tainacan_plugin', \Tainacan\Admin::get_instance()->get_admin_js_localization_params() );
|
wp_localize_script( 'tainacan-search', 'tainacan_plugin', \Tainacan\Admin::get_instance()->get_admin_js_localization_params() );
|
||||||
|
|
|
@ -327,7 +327,10 @@ return apply_filters( 'tainacan-admin-i18n', [
|
||||||
'label_save_as_draft' => __( 'Save as draft', 'tainacan' ),
|
'label_save_as_draft' => __( 'Save as draft', 'tainacan' ),
|
||||||
'label_update_draft' => __( 'Update draft', 'tainacan' ),
|
'label_update_draft' => __( 'Update draft', 'tainacan' ),
|
||||||
'label_return_to_draft' => __( 'Return to draft', 'tainacan' ),
|
'label_return_to_draft' => __( 'Return to draft', 'tainacan' ),
|
||||||
'label_publish' => __( 'Publish', 'tainacan' ),
|
/* translators: The verb 'to publish' not the 'publish' status */
|
||||||
|
'label_verb_publish' => _x( 'Publish', 'verb', 'tainacan' ),
|
||||||
|
/* translators: The status 'publish' not the verb 'to publish' */
|
||||||
|
'label_publish' => _x( 'Publish', 'noun', 'tainacan' ),
|
||||||
'label_update' => __( 'Update', 'tainacan' ),
|
'label_update' => __( 'Update', 'tainacan' ),
|
||||||
'label_mapper_metadata' => __( 'Mapper Metadata', 'tainacan' ),
|
'label_mapper_metadata' => __( 'Mapper Metadata', 'tainacan' ),
|
||||||
'label_add_more_mapper_metadata' => __( 'Add more mapper\'s metadata', 'tainacan' ),
|
'label_add_more_mapper_metadata' => __( 'Add more mapper\'s metadata', 'tainacan' ),
|
||||||
|
|
|
@ -31,7 +31,7 @@ export const viewModesMixin = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.isSlideshowViewModeEnabled = this.enabledViewModes.findIndex((viewMode) => viewMode == 'slideshow') >= 0;
|
this.isSlideshowViewModeEnabled = (this.enabledViewModes && Array.isArray(this.enabledViewModes)) ? (this.enabledViewModes.findIndex((viewMode) => viewMode == 'slideshow') >= 0) : false;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getItemLink(itemUrl, index) {
|
getItemLink(itemUrl, index) {
|
||||||
|
|
|
@ -411,7 +411,7 @@
|
||||||
:trap-focus="filtersAsModal"
|
:trap-focus="filtersAsModal"
|
||||||
full-screen
|
full-screen
|
||||||
:custom-class="'tainacan-form filters-menu' + (filtersAsModal ? ' filters-menu-modal' : '')"
|
:custom-class="'tainacan-form filters-menu' + (filtersAsModal ? ' filters-menu-modal' : '')"
|
||||||
:can-cancel="hideHideFiltersButton ? ['x', 'outside'] : ['x', 'escape', 'outside']">
|
:can-cancel="hideHideFiltersButton || !filtersAsModal ? ['x', 'outside'] : ['x', 'escape', 'outside']">
|
||||||
<filters-items-list
|
<filters-items-list
|
||||||
:is-loading-items="isLoadingItems"
|
:is-loading-items="isLoadingItems"
|
||||||
:autofocus="filtersAsModal"
|
:autofocus="filtersAsModal"
|
||||||
|
@ -467,18 +467,18 @@
|
||||||
class="loading-container">
|
class="loading-container">
|
||||||
|
|
||||||
<!-- Default loading, to be used view modes without any skeleton-->
|
<!-- Default loading, to be used view modes without any skeleton-->
|
||||||
<b-loading
|
<b-loading
|
||||||
v-if="!(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].skeleton_template != undefined)"
|
v-if="!(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].skeleton_template != undefined)"
|
||||||
:is-full-page="false"
|
:is-full-page="false"
|
||||||
:active="showLoading"/>
|
:active.sync="showLoading"/>
|
||||||
|
|
||||||
<!-- Custom skeleton templates used by some view modes -->
|
<!-- Custom skeleton templates used by some view modes -->
|
||||||
<div
|
<div
|
||||||
v-if="(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].skeleton_template != undefined)"
|
v-if="(registeredViewModes[viewMode] != undefined && registeredViewModes[viewMode].skeleton_template != undefined)"
|
||||||
v-html="registeredViewModes[viewMode].skeleton_template"/>
|
v-html="registeredViewModes[viewMode].skeleton_template"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Alert if custom metada is being used for sorting -->
|
<!-- Alert if custom metadata is being used for sorting -->
|
||||||
<div
|
<div
|
||||||
v-if="hasAnOpenAlert &&
|
v-if="hasAnOpenAlert &&
|
||||||
isSortingByCustomMetadata &&
|
isSortingByCustomMetadata &&
|
||||||
|
@ -509,7 +509,7 @@
|
||||||
<!-- Theme View Modes -->
|
<!-- Theme View Modes -->
|
||||||
<div
|
<div
|
||||||
v-if="((openAdvancedSearch && advancedSearchResults) || !openAdvancedSearch) &&
|
v-if="((openAdvancedSearch && advancedSearchResults) || !openAdvancedSearch) &&
|
||||||
!isLoadingItems &&
|
!showLoading &&
|
||||||
registeredViewModes[viewMode] != undefined &&
|
registeredViewModes[viewMode] != undefined &&
|
||||||
registeredViewModes[viewMode].type == 'template'"
|
registeredViewModes[viewMode].type == 'template'"
|
||||||
v-html="itemsListTemplate"/>
|
v-html="itemsListTemplate"/>
|
||||||
|
@ -775,7 +775,7 @@
|
||||||
const userPrefViewMode = this.$userPrefs.get(prefsViewMode);
|
const userPrefViewMode = this.$userPrefs.get(prefsViewMode);
|
||||||
|
|
||||||
let existingViewModeIndex = Object.keys(this.registeredViewModes).findIndex(viewMode => viewMode == userPrefViewMode);
|
let existingViewModeIndex = Object.keys(this.registeredViewModes).findIndex(viewMode => viewMode == userPrefViewMode);
|
||||||
let enabledViewModeIndex = this.enabledViewModes.findIndex((viewMode) => viewMode == userPrefViewMode);
|
let enabledViewModeIndex = (this.enabledViewModes && Array.isArray(this.enabledViewModes)) ? this.enabledViewModes.findIndex((viewMode) => viewMode == userPrefViewMode) : -1;
|
||||||
if (existingViewModeIndex >= 0 && enabledViewModeIndex >= 0)
|
if (existingViewModeIndex >= 0 && enabledViewModeIndex >= 0)
|
||||||
this.$eventBusSearch.setInitialViewMode(userPrefViewMode);
|
this.$eventBusSearch.setInitialViewMode(userPrefViewMode);
|
||||||
else
|
else
|
||||||
|
@ -933,11 +933,13 @@
|
||||||
let descriptionMetadatum = this.localDisplayedMetadata.find(metadatum => metadatum.metadata_type_object != undefined ? metadatum.metadata_type_object.related_mapped_prop == 'description' : false);
|
let descriptionMetadatum = this.localDisplayedMetadata.find(metadatum => metadatum.metadata_type_object != undefined ? metadatum.metadata_type_object.related_mapped_prop == 'description' : false);
|
||||||
|
|
||||||
// Updates Search
|
// Updates Search
|
||||||
this.$eventBusSearch.addFetchOnly(
|
let fetchOnlyArray = [
|
||||||
((thumbnailMetadatum != undefined && thumbnailMetadatum.display) ? 'thumbnail' : null) + ',' +
|
((thumbnailMetadatum != undefined && thumbnailMetadatum.display) ? 'thumbnail' : null),
|
||||||
((creationDateMetadatum != undefined && creationDateMetadatum.display) ? 'creation_date' : null) + ',' +
|
((creationDateMetadatum != undefined && creationDateMetadatum.display) ? 'creation_date' : null),
|
||||||
(this.isRepositoryLevel ? 'title' : null) + ',' +
|
(this.isRepositoryLevel ? 'title' : null),
|
||||||
(this.isRepositoryLevel && descriptionMetadatum.display ? 'description' : null), false, fetchOnlyMetadatumIds.toString());
|
(this.isRepositoryLevel && descriptionMetadatum.display ? 'description' : null)
|
||||||
|
];
|
||||||
|
this.$eventBusSearch.addFetchOnly(fetchOnlyArray.filter((fetchOnly) => fetchOnly != null).toString(), false, fetchOnlyMetadatumIds.toString());
|
||||||
|
|
||||||
// Closes dropdown
|
// Closes dropdown
|
||||||
this.$refs.displayedMetadataDropdown.toggle();
|
this.$refs.displayedMetadataDropdown.toggle();
|
||||||
|
@ -1064,12 +1066,13 @@
|
||||||
|
|
||||||
let creationDateMetadatumDisplay = prefsFetchOnlyObject ? (prefsFetchOnlyObject[1] != 'null') : true;
|
let creationDateMetadatumDisplay = prefsFetchOnlyObject ? (prefsFetchOnlyObject[1] != 'null') : true;
|
||||||
|
|
||||||
this.$eventBusSearch.addFetchOnly(
|
let fetchOnlyArray = [
|
||||||
(thumbnailMetadatumDisplay ? 'thumbnail' : null) +','+
|
(thumbnailMetadatumDisplay ? 'thumbnail' : null),
|
||||||
(creationDateMetadatumDisplay ? 'creation_date' : null) +','+
|
(creationDateMetadatumDisplay ? 'creation_date' : null),
|
||||||
(this.isRepositoryLevel ? 'title' : null) +','+
|
(this.isRepositoryLevel ? 'title' : null),
|
||||||
(this.isRepositoryLevel ? 'description' : null)
|
(this.isRepositoryLevel ? 'description' : null)
|
||||||
, false, fetchOnlyMetadatumIds.toString());
|
];
|
||||||
|
this.$eventBusSearch.addFetchOnly(fetchOnlyArray.filter((fetchOnly) => fetchOnly != null).toString(), false, fetchOnlyMetadatumIds.toString());
|
||||||
|
|
||||||
// Sorting metadata
|
// Sorting metadata
|
||||||
if (this.isRepositoryLevel) {
|
if (this.isRepositoryLevel) {
|
||||||
|
@ -1450,10 +1453,20 @@
|
||||||
font-size: 1.3125em !important;
|
font-size: 1.3125em !important;
|
||||||
color: var(--tainacan-info-color) !important;
|
color: var(--tainacan-info-color) !important;
|
||||||
max-width: 1.25em;
|
max-width: 1.25em;
|
||||||
|
svg {
|
||||||
|
color: var(--tainacan-info-color) !important;
|
||||||
|
overflow: hidden;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.has-text-secondary.gray-icon .icon i::before,
|
.has-text-secondary.gray-icon .icon i::before,
|
||||||
.has-text-secondary.gray-icon i::before {
|
.has-text-secondary.gray-icon i::before {
|
||||||
color: var(--tainacan-secondary) !important;
|
color: var(--tainacan-secondary) !important;
|
||||||
|
svg {
|
||||||
|
fill: var(--tainacan-secondary) !important;
|
||||||
|
overflow: hidden;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-menu {
|
.dropdown-menu {
|
||||||
|
|
Loading…
Reference in New Issue