Skip to content

Commit

Permalink
fix: Alignment w/ Django 4.2+ admin style (#1453)
Browse files Browse the repository at this point in the history
* Fix #1377

* Fix: styles for django 4.2+ admin

* Fix: Unintended scroll when clearing file widget

* Fix linting errors.
  • Loading branch information
fsbraun authored Mar 22, 2024
1 parent fa385bd commit 011d804
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions filer/private/sass/components/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ body {
}
}

.filer-widget {
width: 100%;
}

.field-file,
.field-sha1 {
word-wrap: break-word;
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.

3 changes: 2 additions & 1 deletion filer/static/filer/js/addons/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (django.jQuery) {
}

djQuery(function ($) {
var filer_clear = function () {
var filer_clear = function (ev) {
var clearer = $(this);
var container = clearer.closest('.filerFile');
var input = container.find(':input');
Expand All @@ -20,6 +20,7 @@ djQuery(function ($) {
var dropzoneMessage = container.siblings('.dz-message');
var hiddenClass = 'hidden';

ev.preventDefault();
clearer.addClass(hiddenClass);
input.val('');
thumbnail.addClass(hiddenClass);
Expand Down
2 changes: 2 additions & 0 deletions filer/templates/admin/filer/widgets/admin_file.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% load i18n filer_admin_tags static %}

{% spaceless %}
<div class="filer-widget">
<div class="clearfix"></div>

<div class="dz-preview dz-file-preview hidden js-filer-dropzone-template">
Expand Down Expand Up @@ -67,4 +68,5 @@
</script>
</span>
</div>
</div>
{% endspaceless %}

0 comments on commit 011d804

Please sign in to comment.