diff --git a/src/classes/repositories/class-tainacan-collections.php b/src/classes/repositories/class-tainacan-collections.php
index 8a39617cd..d547cfefa 100644
--- a/src/classes/repositories/class-tainacan-collections.php
+++ b/src/classes/repositories/class-tainacan-collections.php
@@ -132,7 +132,7 @@ class Collections extends Repository {
'title' => __( 'Enabled view modes', 'tainacan' ),
'type' => 'array',
'description' => __( 'Which visualization modes will be available for the public to choose from', 'tainacan' ),
- 'default' => [ 'table', 'cards' ],
+ 'default' => [ 'table', 'cards', 'masonry' ],
'items' => [ 'type' => 'string' ],
//'validation' => v::stringType(),
],
diff --git a/src/classes/theme-helper/class-tainacan-theme-helper.php b/src/classes/theme-helper/class-tainacan-theme-helper.php
index 051499878..5c422ff8c 100644
--- a/src/classes/theme-helper/class-tainacan-theme-helper.php
+++ b/src/classes/theme-helper/class-tainacan-theme-helper.php
@@ -2485,5 +2485,23 @@ class Theme_Helper {
'requires_thumbnail' => false,
'placeholder_template' => $map_view_mode_placeholder
]);
+
+ $this->register_view_mode('mosaic', [
+ 'label' => __('Mosaic', 'tainacan'),
+ 'dynamic_metadata' => false,
+ 'description' => __('A mosaic view, similar to Flickr and Google Photos, which will display images without cropping.', 'tainacan'),
+ 'icon' => '',
+ 'type' => 'component',
+ 'implements_skeleton' => true,
+ 'placeholder_template' => '
' .
+ array_reduce( range(0,11), function($container, $i) {
+ $container .= '-
+
+
+
';
+ return $container;
+ }) .
+ '
'
+ ]);
}
}
diff --git a/src/views/admin/components/lists/items-list.vue b/src/views/admin/components/lists/items-list.vue
index da167dd1d..043399001 100644
--- a/src/views/admin/components/lists/items-list.vue
+++ b/src/views/admin/components/lists/items-list.vue
@@ -1979,6 +1979,181 @@
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -2674,6 +2849,12 @@ export default {
duration: 3000
});
}
+ },
+ getAcceptableWidthBasedOnRatio(thumbnail, size, defaultSize) {
+ const width = this.$thumbHelper.getWidth(thumbnail, size, defaultSize);
+ const height = this.$thumbHelper.getHeight(thumbnail, size, defaultSize);
+
+ return (width / height) > 0.7 ? width : ( height * 0.7 );
}
}
}
@@ -2685,6 +2866,7 @@ export default {
@import "../../scss/_tables.scss";
@import "../../scss/_view-mode-cards.scss";
@import "../../scss/_view-mode-masonry.scss";
+ @import "../../scss/_view-mode-mosaic.scss";
@import "../../scss/_view-mode-grid.scss";
@import "../../scss/_view-mode-records.scss";
@import "../../scss/_view-mode-list.scss";
diff --git a/src/views/admin/pages/lists/items-page.vue b/src/views/admin/pages/lists/items-page.vue
index 6a7578bc1..8f9738e7d 100644
--- a/src/views/admin/pages/lists/items-page.vue
+++ b/src/views/admin/pages/lists/items-page.vue
@@ -226,13 +226,13 @@
show: 500,
hide: 300,
},
- content: (totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry') ? (adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry') ? $i18n.get('info_current_view_mode_metadata_not_allowed') : $i18n.get('info_cant_select_metadata_without_items') : '',
+ content: (totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry' || adminViewMode == 'mosaic') ? (adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry' || adminViewMode == 'mosaic') ? $i18n.get('info_current_view_mode_metadata_not_allowed') : $i18n.get('info_cant_select_metadata_without_items') : '',
autoHide: false,
placement: 'auto-start',
popperClass: ['tainacan-tooltip', 'tooltip', isRepositoryLevel ? 'tainacan-repository-tooltip' : '']
}"
:mobile-modal="true"
- :disabled="totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry'"
+ :disabled="totalItems <= 0 || adminViewMode == 'grid'|| adminViewMode == 'cards' || adminViewMode == 'masonry' || adminViewMode == 'mosaic'"
class="show metadata-options-dropdown"
aria-role="list"
trap-focus>
@@ -383,12 +383,15 @@