Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
pix666 committed Dec 31, 2023
2 parents 3b025b3 + 7ea6f2b commit 0c5b24b
Show file tree
Hide file tree
Showing 47 changed files with 69 additions and 118 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Change Log

## [7.6.3](https://github.com/dldevinc/paper-admin/tree/v7.6.3) - 2023-12-31

### Features

- The size of the `Apply` button in the filters block has been reduced.
- Added CSS class `field-medium` to facilitate styling of form fields.

### Bug Fixes

- The `HierarchyFilter` remains on the page if nothing is found as a result
of filtering.
- The `Filters` block is no longer displayed if there are no filters within it.

## [7.6.2](https://github.com/dldevinc/paper-admin/tree/v7.6.2) - 2023-12-13

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "paper-admin",
"version": "7.6.2",
"version": "7.6.3",
"description": "",
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion paper_admin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "7.6.2"
__version__ = "7.6.3"
default_app_config = "paper_admin.apps.Config"
5 changes: 1 addition & 4 deletions paper_admin/admin/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,7 @@ class CategoryFilter(HierarchyFilter):
parameter_name = "category"
def lookups(self, changelist):
return (
(pk, title)
for pk, title in Category.objects.values_list("pk", "title")
)
return Category.objects.values_list("pk", "title")
def queryset(self, request, queryset):
value = self.value()
Expand Down
12 changes: 12 additions & 0 deletions paper_admin/patches/django/changelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,20 @@
class PatchChangeList(ChangeList, metaclass=MonkeyPatchMeta):
def __init__(self, request, *args, **kwargs):
self.request = request
self.has_toolbar_filters = False
get_original(ChangeList)(self, request, *args, **kwargs)

def get_queryset(self, request, *args, **kwargs):
qs = get_original(ChangeList)(self, request, *args, **kwargs)

for filter_spec in self.filter_specs:
placement = getattr(filter_spec, "placement", None)
if placement != "top":
self.has_toolbar_filters = True
break

return qs

@property
def has_actions(self):
return bool(self.model_admin.get_actions(self.request))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$field-medium-size: 360px !default;
1 change: 1 addition & 0 deletions paper_admin/static/paper_admin/src/css/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
// components
@import "css/components/icons";
@import "css/components/container";
@import "css/components/field-size";
@import "css/components/lists";
@import "css/components/table-height-hack";
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@import "css/abstracts/bootstrap";
@import "css/abstracts/variables/field_size";


.field-medium {
@include media-breakpoint-up(sm) {
max-width: $field-medium-size;
}
}
1 change: 1 addition & 0 deletions paper_admin/static/paper_admin/src/css/env.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
@import "css/abstracts/functions/sum";

@import "css/abstracts/variables/colors";
@import "css/abstracts/variables/field_size";
@import "css/abstracts/variables/input_invalid";
3 changes: 0 additions & 3 deletions paper_admin/static/paper_admin/src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ import "widgets/clearable-file-field/index.js";
import "widgets/date-field/index.js";
import "widgets/email-field/index.js";
import "widgets/file-field/index.js";
import "widgets/fk-raw-field/index.js";
import "widgets/ip-field/index.js";
import "widgets/number-field/index.js";
import "widgets/password-field/index.js";
import "widgets/related-widget-wrapper/index.js";
import "widgets/select-field/index.js";
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import "./index.scss";

function update(event) {
const widget = event.target.closest(".email-field");
if (widget) {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
@import "css/abstracts/bootstrap";
@import "./variables";


.file-field {
position: relative;
@include media-breakpoint-up(sm) {
max-width: $file-field-max-width;
}

input.form-control {
position: absolute;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import "./index.scss";

const inputTypes = ["text", "password"];
const iconClasses = ["bi-eye-slash", "bi-eye"];

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
$select-date-field-max-width: 360px !default;
$select-date-field-gutter-width: 10px !default;
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
@import "css/abstracts/bootstrap";
@import "./variables";

.select-date-field {
display: flex;
@include media-breakpoint-up(sm) {
max-width: $select-date-field-max-width;
}

.select-field {
max-width: none;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@import "css/abstracts/bootstrap";
@import "./variables";
@import "css/abstracts/variables/field_size";

.select-field {
max-width: 100%;
@include media-breakpoint-up(sm) {
&:not(:has([data-select2-id][multiple])) {
max-width: $select-field-max-width;
max-width: $field-medium-size;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
$split-datetime-field-max-width: 360px !default;
$split-datetime-field-gutter-width: 10px !default;

$split-datetime-date-field-max-width: 220px !default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

.split-datetime-field {
display: flex;
@include media-breakpoint-up(sm) {
max-width: $split-datetime-field-max-width;
}

.date-field {
margin-right: $split-datetime-field-gutter-width;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { v4 as uuidv4 } from "uuid";

import "./index.scss";

document.addEventListener("click", event => {
const button = event.target.closest(".uuid-field__link");
if (button) {
Expand Down

This file was deleted.

30 changes: 15 additions & 15 deletions paper_admin/templates/admin/change_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ <h1>{{ page_title|capfirst }}</h1>


{% block toolbar %}
{% if cl.has_filters %}
{% if cl.has_filters and cl.has_toolbar_filters %}
<div class="paper-card card">
<h3 class="card-header">{{ _("Filters") }}</h3>
<div class="card-body overflow-hidden">
Expand All @@ -85,7 +85,7 @@ <h3 class="card-header">{{ _("Filters") }}</h3>
<input type="hidden" name="{{ name }}" value="{{ value }}">
{% endfor %}

<button type="submit" class="btn btn-info btn-lg btn-block mt-3">
<button type="submit" class="btn btn-info btn-block mt-3">
{{ _("Apply") }}
</button>

Expand Down Expand Up @@ -121,13 +121,15 @@ <h3 class="card-header">{{ _("Filters") }}</h3>


{% block content %}
{% if cl.result_count %}
{% if cl.result_count or cl.full_result_count %}
{% for spec in cl.filter_specs %}
{% if spec.placement == "top" %}
{% paper_list_filter cl spec %}
{% endif %}
{% endfor %}
{% endif %}

{% if cl.result_count %}
{% if cl.date_hierarchy %}
<div class="paper-card card mb-3">
<h5 class="card-header">
Expand Down Expand Up @@ -195,18 +197,16 @@ <h5 class="card-header">
{% endif %}
</div>
{% endif %}
{% elif cl.full_result_count %}
<div class="paper-message paper-message--info">
<h4>{{ _("Nothing found") }}!</h4>
<a href="?{% if cl.is_popup %}{{ POPUP_VAR }}=1{% endif %}">
{{ _("Reset search and filters") }}
</a>
</div>
{% else %}
{% if cl.full_result_count %}
<div class="paper-message paper-message--info">
<h4>{{ _("Nothing found") }}!</h4>
<a href="?{% if cl.is_popup %}{{ POPUP_VAR }}=1{% endif %}">
{{ _("Reset search and filters") }}
</a>
</div>
{% else %}
<p class="paper-message paper-message--warning">
{% blocktrans with cl.opts.verbose_name_plural|capfirst as name_plural %}{{ name_plural }} are not created yet{% endblocktrans %}.
</p>
{% endif %}
<p class="paper-message paper-message--warning">
{% blocktrans with cl.opts.verbose_name_plural|capfirst as name_plural %}{{ name_plural }} are not created yet{% endblocktrans %}.
</p>
{% endif %}
{% endblock %}
2 changes: 1 addition & 1 deletion paper_admin/templates/django/forms/widgets/email.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% if widget.is_hidden %}
{% include "django/forms/widgets/hidden.html" %}
{% else %}
<div class="email-field paper-input-group input-group">
<div class="email-field field-medium paper-input-group input-group">
{% include "django/forms/widgets/input.html" %}

<div class="input-group-append">
Expand Down
2 changes: 1 addition & 1 deletion paper_admin/templates/django/forms/widgets/file.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% if widget.is_hidden %}
{% include "django/forms/widgets/hidden.html" %}
{% else %}
<div class="file-field">
<div class="file-field field-medium">
{% include "django/forms/widgets/input.html" %}

<div class="paper-input-group input-group">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% if widget.is_hidden %}
{% include "django/forms/widgets/hidden.html" %}
{% else %}
<div class="fk-raw-field paper-input-group input-group">
<div class="fk-raw-field field-medium paper-input-group input-group">
{% include "django/forms/widgets/input.html" %}

{% if link_label %}
Expand Down
2 changes: 1 addition & 1 deletion paper_admin/templates/django/forms/widgets/ip.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="ip-field">
<div class="ip-field field-medium">
{% include "django/forms/widgets/input.html" %}
</div>
2 changes: 1 addition & 1 deletion paper_admin/templates/django/forms/widgets/number.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="number-field">
<div class="number-field field-medium">
{% include "django/forms/widgets/input.html" %}
</div>
2 changes: 1 addition & 1 deletion paper_admin/templates/django/forms/widgets/password.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% if widget.is_hidden %}
{% include "django/forms/widgets/hidden.html" %}
{% else %}
<div class="password-field paper-input-group input-group">
<div class="password-field field-medium paper-input-group input-group">
{% include "django/forms/widgets/input.html" %}

<div class="input-group-append">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="select-date-field">
<div class="select-date-field field-medium">
{% include "django/forms/widgets/multiwidget.html" %}
</div>
4 changes: 2 additions & 2 deletions paper_admin/templates/django/forms/widgets/splitdatetime.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="split-datetime-field">
<div class="split-datetime-field field-medium">
{% include "django/forms/widgets/multiwidget.html" %}
</div>
</div>
2 changes: 1 addition & 1 deletion paper_admin/templates/django/forms/widgets/uuid.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% if widget.is_hidden %}
{% include "django/forms/widgets/hidden.html" %}
{% else %}
<div class="uuid-field paper-input-group input-group">
<div class="uuid-field field-medium paper-input-group input-group">
{% include "django/forms/widgets/input.html" %}

<div class="input-group-append">
Expand Down
5 changes: 1 addition & 4 deletions tests/app/admin/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ class GroupFilter(HierarchyFilter):
parameter_name = "group"

def lookups(self, changelist):
return (
(pk, name)
for pk, name in Group.objects.values_list("pk", "name")
)
return Group.objects.values_list("pk", "name")

def queryset(self, request, queryset):
value = self.value()
Expand Down

0 comments on commit 0c5b24b

Please sign in to comment.