Skip to content

Commit

Permalink
Dynamic css for new setting FILER_THUMBNAIL_ICON_SIZE
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Aug 20, 2024
1 parent 8ecdae1 commit 9d309e6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions filer/admin/folderadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ def directory_listing(self, request, folder_id=None, viewtype=None):
'show_result_count': show_result_count,
'folder_children': folder_qs,
'folder_files': file_qs,
'thumbnail_size': FILER_THUMBNAIL_ICON_SIZE,
'limit_search_to_folder': limit_search_to_folder,
'is_popup': popup_status(request),
'filer_admin_context': AdminContext(request),
Expand Down
12 changes: 6 additions & 6 deletions filer/private/sass/components/_navigator.scss
Original file line number Diff line number Diff line change
Expand Up @@ -728,17 +728,17 @@ body {
float: left;
display: inline-block;
padding: 10px;
width: 125px;
height: 125px;
width: calc(var(--thumbnail-size, 125px) + 5px);
height: calc(var(--thumbnail-size, 125px) + 5px);
border: 1px solid $gray-lighter;
margin: 16px 12px;
background-color: $white;
position: relative;
overflow: hidden;
.thumbnail-file-item-box {
padding: 10px;
width: 125px;
height: 125px;
width: calc(var(--thumbnail-size, 125px) + 5px);
height: calc(var(--thumbnail-size, 125px) + 5px);
border: 1px solid $gray-lighter;
margin: 16px 12px;
background-color: $white;
Expand Down Expand Up @@ -787,8 +787,8 @@ body {
}
.thumbnail-file-item {
float: none;
width: 147px;
height: 200px;
width: calc(var(--thumbnail-size, 125px) + 22px);
height: calc(var(--thumbnail-size, 125px) + 75px);
border: 0;
padding: 0;
background-color: transparent;
Expand Down
4 changes: 2 additions & 2 deletions filer/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
FILER_ADMIN_ICON_SIZES = [str(i) for i in sorted([int(s) for s in _ICON_SIZES])]

# Currently, these two icon sizes are hard-coded into the admin and admin templates
FILER_TABLE_ICON_SIZE = getattr(settings, "_FILER_TABLE_ICON_SIZE", 40)
FILER_THUMBNAIL_ICON_SIZE = getattr(settings, "_FILER_THUMBNAIL_ICON_SIZE", 160)
FILER_TABLE_ICON_SIZE = getattr(settings, "FILER_TABLE_ICON_SIZE", 40)
FILER_THUMBNAIL_ICON_SIZE = getattr(settings, "FILER_THUMBNAIL_ICON_SIZE", 160)
DEFERRED_THUMBNAIL_SIZES = (
FILER_TABLE_ICON_SIZE,
2 * FILER_TABLE_ICON_SIZE,
Expand Down
2 changes: 1 addition & 1 deletion filer/static/filer/css/admin_filer.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion filer/static/filer/css/maps/admin_filer.css.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load i18n l10n admin_list filer_tags filer_admin_tags static thumbnail %}
<div class="drag-hover-border thumbnail-drag-hover-border"></div>
<section class="navigator{% if is_popup %} navigator-popup{% endif %} navigator-thumbnail-list">
<section class="navigator{% if is_popup %} navigator-popup{% endif %} navigator-thumbnail-list" style="--thumbnail-size: {{ thumbnail_size }}px;">

<div class="js-filer-dropzone js-filer-dropzone-base navigator-list" id="result_list" data-url="{% if folder.id %}{% url 'admin:filer-ajax_upload' folder_id=folder.id %}{% else %}{% url 'admin:filer-ajax_upload' %}{% endif %}" data-folder-name="{% if folder.is_root %}{% translate 'Unsorted Uploads' %}{% else %}{{ folder.name }}{% endif %}" data-max-uploader-connections="{{ uploader_connections }}"
data-max-files="{{ max_files|safe }}"
Expand Down

0 comments on commit 9d309e6

Please sign in to comment.