New default string for blurhash and adds creation date to lists view mode.

This commit is contained in:
mateuswetah 2020-12-17 18:07:19 -03:00
parent b1c5f8af1b
commit ff927fd348
4 changed files with 25 additions and 11 deletions

View File

@ -132,7 +132,7 @@ class Item extends Entity {
if( in_array('tainacan-small', $sizes ) ) {
$tmp_src = wp_get_attachment_image_src( $this->get__thumbnail_id(), 'tainacan-small' );
$blurhash = $this->get_iamge_blurhash($tmp_src[0], $tmp_src[1], $tmp_src[2]);
$blurhash = $this->get_image_blurhash($tmp_src[0], $tmp_src[1], $tmp_src[2]);
}
foreach ( $sizes as $size ) {
@ -143,9 +143,9 @@ class Item extends Entity {
return apply_filters("tainacan-item-get-thumbnail", $thumbs, $this);
}
private function get_iamge_blurhash($file_path, $width, $height) {
private function get_image_blurhash($file_path, $width, $height) {
if (!$image = @imagecreatefromstring(file_get_contents($file_path))) {
return "L2OzSs00j[_3D%xuWBt700_3IU%M";
return "V4P?:h00Rj~qM{of%MRjWBRjD%%MRjayofj[%M-;RjRj";
}
if($image == false)
return '';

View File

@ -839,9 +839,10 @@
column.metadatum !== 'row_description'"
v-html="renderMetadata(item.metadata, column) != '' ? renderMetadata(item.metadata, column) : `<span class='has-text-gray3 is-italic'>` + $i18n.get('label_value_not_provided') + `</span>`"/>
<span v-if="column.metadatum == 'row_thumbnail'">
<span
class="table-thumb"
v-if="column.metadatum == 'row_thumbnail'">
<blur-hash-image
class="table-thumb"
:width="$thumbHelper.getWidth(item['thumbnail'], 'tainacan-small', 40)"
:height="$thumbHelper.getHeight(item['thumbnail'], 'tainacan-small', 40)"
:hash="$thumbHelper.getBlurhashString(item['thumbnail'], 'tainacan-small')"
@ -1051,7 +1052,7 @@
<div
class="tainacan-list-thumbnail"
v-if="item.thumbnail != undefined">
<blur-hash-image
<!-- <blur-hash-image
:width="$thumbHelper.getWidth(item['thumbnail'], 'tainacan-medium-full', 120)"
:height="$thumbHelper.getHeight(item['thumbnail'], 'tainacan-medium-full', 120)"
:hash="$thumbHelper.getBlurhashString(item['thumbnail'], 'tainacan-medium-full')"
@ -1059,7 +1060,11 @@
:srcset="$thumbHelper.getSrcSet(item['thumbnail'], 'tainacan-medium-full', item.document_type)"
:alt="item.thumbnail_alt ? item.thumbnail_alt : $i18n.get('label_thumbnail')"
:transition-duration="500"
/>
/> -->
<img
src="$thumbHelper.getSrc(item['thumbnail'], 'tainacan-medium-full', item.document_type)"
:srcset="$thumbHelper.getSrcSet(item['thumbnail'], 'tainacan-medium-full', item.document_type)"
:alt="item.thumbnail_alt ? item.thumbnail_alt : $i18n.get('label_thumbnail')">
</div>
<div class="list-metadata media-body">
<span
@ -1072,6 +1077,15 @@
v-html="renderMetadata(item.metadata, column)"
class="metadata-value"/>
</span>
<span
v-for="(column, metadatumIndex) in displayedMetadata"
:key="metadatumIndex"
v-if="(column.metadatum == 'row_creation' || column.metadatum == 'row_author') && item[column.slug] != undefined">
<h3 class="metadata-label">{{ column.name }}</h3>
<p
v-html="column.metadatum == 'row_creation' ? parseDateToNavigatorLanguage(item[column.slug]) : item[column.slug]"
class="metadata-value"/>
</span>
</div>
</div>
</div>
@ -1486,6 +1500,9 @@ export default {
@import "../../scss/_view-mode-grid.scss";
@import "../../scss/_view-mode-records.scss";
@import "../../scss/_view-mode-list.scss";
// Vue Blurhash transtition effect
@import '../../../../../node_modules/vue-blurhash/dist/vue-blurhash.css';
.selection-control {
margin-bottom: 6px;

View File

@ -203,7 +203,7 @@
}
}
img.table-thumb,
.table-thumb img {
.table-thumb>div {
max-height: 38px !important;
min-height: 38px;
max-width: 38px;

View File

@ -9,9 +9,6 @@
@import "../../../../node_modules/bulma/bulma.sass";
@import "../../../../node_modules/buefy/src/scss/buefy.scss";
// Vue Blurhash transtition effect
@import '../../../../node_modules/vue-blurhash/dist/vue-blurhash.css';
// Import Tainacan custom styles
@import "../scss/_tainacan-form.scss";
@import "../scss/_control.scss";