0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-25 13:10:14 +01:00
Commit Graph

16626 Commits

Author SHA1 Message Date
Sage Abdullah
601a97f8ff
Add missing parent id for bulk actions footer include
Has been missing since it was introduced
2023-12-13 10:31:09 +00:00
Sage Abdullah
24ae9a22e8
Consolidate documents IndexView and ListingResultsView
Use results_only to differentiate. Also, rename listing_results url name to index_results for consistency
2023-12-13 10:31:09 +00:00
Sage Abdullah
7dd00a84f4
Refactor documents index view to make better use of generic index view and template 2023-12-13 10:31:08 +00:00
Sage Abdullah
fa0d55fe34
Update outdated default search_target value in header.html comment
Renamed in b0dc6c1ea5
2023-12-13 10:31:08 +00:00
Sage Abdullah
4836324af5
Rename documents/results.html to documents/index_results.html for consistency 2023-12-13 10:31:08 +00:00
Sage Abdullah
3e140244f6
Make documents index results template extend from generic index results template 2023-12-13 10:31:08 +00:00
Sage Abdullah
0734633afd
Add the ability to show other searches in generic index view 2023-12-13 10:31:08 +00:00
Sage Abdullah
b04d205dd1
Move all variables to BaseListingView
There is no reason to not check for the collections in the search results view as well.
In fact, the inconsistency before this change caused an issue where the
collections column will be shown on first load, but when a search is
performed (or cleared) the column will never be shown again.

Meanwhile, the current_collection is already set in BaseListingView anyway,
so it makes sense to put it in the context from there.
2023-12-13 10:31:08 +00:00
Sage Abdullah
ba18cd3bc5
Remove unused popular tags query in documents listing view
This has been around since the start (see
cba8f851d7/wagtail/wagtaildocs/views/documents.py)

However, its use in the template was removed in
c73d5c6ecc and was never restored.
Even when it was still in place, it wasn't implemented as a proper
filter. Instead, it was treated as a search query string.

For images, this was restored in
233e7f5189 with actual database-level
filtering.
2023-12-13 10:31:07 +00:00
Sage Abdullah
613bd0b144
Reuse variables from generic IndexView 2023-12-13 10:31:07 +00:00
Sage Abdullah
d36e16c18c
Refactor documents listing view to extend generic IndexView instead of BaseListingView 2023-12-13 10:31:07 +00:00
Sage Abdullah
aa530cd09a
Use Django's urlencode in set_query_params util function
For more flexibility
2023-12-13 10:31:07 +00:00
Sage Abdullah
a2b5baee83
Replace IndexView.get_columns() with a cached_property for columns
This defers the instantiation of the columns at the point when they're needed instead of very early on in the view, when other variables needed may not be available yet

This also reduces the divergence between the BaseListingView and the IndexView
2023-12-13 10:31:07 +00:00
Sage Abdullah
d0dac2c629
Convert documents listing view to generic BaseListingView with tables UI framework 2023-12-13 10:31:07 +00:00
Sage Abdullah
1cbfd1cc89
Restore teal color on table header sort link if it's active
Regression in 4426196046
2023-12-13 10:31:07 +00:00
Sage Abdullah
d23206f54b
Move DownloadColumn to generic wagtail.admin.ui.tables 2023-12-13 10:31:06 +00:00
Sage Abdullah
50a81a6187
Update pagination tests on documents index to match Django standard 2023-12-13 10:31:06 +00:00
Sage Abdullah
170d6c74a9
Convert documents listing view to a ListView 2023-12-13 10:31:06 +00:00
Sage Abdullah
49a1b38587
Use PermissionCheckedMixin in documents listing view 2023-12-13 10:31:06 +00:00
Thibaud Colas
346f15e922 Add release notes for #11258 2023-12-13 10:29:03 +00:00
nandini584
0024751a53 ActionController - Be more explicit about element checks for select method
- Move method to alpha order (after `reset`) and check for input/text area explicitly
- Fixes #11307
2023-12-13 11:20:29 +10:00
nandini584
96349aad3e ActionController - Add noop method
- Useful for leveraging data-action approaches without needing a specific method functionality
2023-12-13 11:20:29 +10:00
Andy Chosak
c109c661c1 Docs: Clarify appropriate use of MultipleChooserPanel
This documentation change clarifies that MultipleChooserPanel can only
be used when the inline model has a ForeignKey to a model that
implements Wagtail's chooser interface. Currently the docs mention
"a chooser for a ForeignKey relation" but it's not obvious how that
restricts which models can be pointed to or how to implement this for a
non-(image, document, snippet, page) model.

Relates to #10646.
2023-12-13 07:32:00 +10:00
LB Johnston
5fa29a6c93 Add changelog/release notes - #11299 2023-12-13 07:17:43 +10:00
Sage Abdullah
260df904e9 Remove sr-only dimensions info in image listing
It is only shown for screen readers, which is inconsistent with the actual visible text.

It also makes the captions unnecessarily verbose, as the dimensions info is not very useful in the image listings
2023-12-13 07:17:06 +10:00
Sage Abdullah
3cd0094b36 Allow TitleColumn to have an id for the title text and use it in snippets
This allows the snippets' checkbox column for bulk actions to refer to
the title column correctly.
2023-12-13 07:17:06 +10:00
Sage Abdullah
539c27bc00 Consistently quote pk for title column's id and referring to it in bulk actions column
To safely handle non-integer primary keys. This is mostly useful for
snippets, but do it everywhere for consistency and in case of custom
document and image models.
2023-12-13 07:17:06 +10:00
Sage Abdullah
abe80bd279 Simplify bulk actions checkbox's aria labels to be consistent
If the aria-label is too specific, e.g. 'Select page', 'Select document'
(and in the case of images it's 'Select image <image title> <image
dimensions>), it is hard for voice control users to click on the
checkbox because they have to specify the full label.

Instead, enforce a simple 'Select' aria-label and use aria-describedby
to describe the checkbox by referring to the title in the title column.
2023-12-13 07:17:06 +10:00
Sage Abdullah
e4ec5f24eb Remove unnecessary accessor in snippets' BulkActionsCheckboxColumn
Not necessary after fbfe8fe75f and 32ff36446b
2023-12-13 07:17:06 +10:00
Sage Abdullah
2cb490a767 Simplify BulkActionsCheckboxColumn to reuse BaseColumn's instance variable
Instead of using obj for the sake of not changing the template when it was first introduced (before the column class was made)
2023-12-13 07:17:06 +10:00
LB Johnston
e101c17aea Add Changelog for #11335 2023-12-13 06:40:43 +10:00
Matt Westcott
f4bcffa9fe Bump telepath to 0.3.1
This ensures that people upgrading to Django 5.0 will have a compatible version. Now that Python <3.8 and Django <3.2 are EOL, there's no reason for anyone to be running an older version.
2023-12-13 06:26:36 +10:00
Matt Westcott
efa15daa95 Release note for #11271 2023-12-12 15:55:26 +00:00
Matt Westcott
937c237345 Rejig formattedfield to populate context as we go 2023-12-12 14:58:28 +00:00
Matt Westcott
a12de4b2cd Add a formattedfieldfromcontext template tag for use on wagtailadmin/shared/field.html
This makes the semantics of undefined variables a bit neater.
2023-12-12 14:58:28 +00:00
Matt Westcott
580ab995ab Do all processing of the field object in the formattedfield tag so that the template doesn't use it 2023-12-12 14:58:27 +00:00
Matt Westcott
8f8d847b78 Move conditional logic for generating ids / labels / help text out of formattedfield template and into tag function 2023-12-12 14:58:27 +00:00
Matt Westcott
e97449dc5f Funnel all invocations of wagtailadmin/shared/field.html through the formattedfield tag
At this point wagtailadmin/shared/field.html is still used by FieldPanel, as well as third-party code. Replace this by a template that simply pulls the relevant context variables from the template and passes them on to `{% formattedfield %}` (which renders them using the old template, now renamed formatted_field.html). This will allow us to move logic from the template to the tag function without breaking the existing wagtailadmin/shared/field.html API.
2023-12-12 14:58:27 +00:00
Matt Westcott
b3bdc0be4a Convert remaining field.html includes to formattedfield tag 2023-12-12 13:54:33 +00:00
Matt Westcott
9b445567f7 Add remaining variables from field.html as parameters to formattedfield 2023-12-12 13:41:25 +00:00
Matt Westcott
ecc6b23d64 Convert templates that extend field.html to use rawformattedfield instead
This will allow us to refactor field.html in ways that don't require preserving the `{% block form_field %}`.
2023-12-12 13:41:25 +00:00
Matt Westcott
89eb53e1d0 Allow specifying the context variable used by BlockInclusionNode
This allows us to pass the content of `{% rawformattedfield %}` as `rendered_field`, making the separate case for `children` unnecessary.
2023-12-12 13:41:25 +00:00
Matt Westcott
d220dc6e8b Convert all basic uses of wagtailadmin/shared/field.html (with no parameters other than field) to formattedfield tag 2023-12-12 13:41:23 +00:00
Matt Westcott
ba29b1832a Introduce a 'formattedfield' tag for use with Django form objects 2023-12-12 13:38:18 +00:00
Matt Westcott
84f885ff17 Rename field/endfield template tag pair to rawformattedfield/endrawformattedfield
This distinguishes the use case of wrapping form fields that are defined manually in HTML, versus working with Django form field objects which will shortly be given a `formattedfield` tag. We could have called these `rawfield` and `field`, but this avoids weirdness like `{% field field=field %}` (or just `{% field %}` which can easily be confused with `{{ field }}`) and better clarifies the purpose of the tag (and in particular why you shouldn't use it for hidden fields).
2023-12-12 13:38:18 +00:00
Sage Abdullah
456515d500
Release note for #11295 2023-12-12 13:08:18 +00:00
Sage Abdullah
feda5cb4b5
Do not set locale in LocaleMixin if model is unset
Previously, the locale will be set even if the view doesn't set a model
attribute. This means that it will load the default locale or the locale
specified by the query param.

However, in practice, this mixin is typically used for views that work
with a translatable model.

Setting the locale when the view doesn't set a model will still cause a
query to get the locale. Since it's unlikely that the view actually
needs to work with a locale if it doesn't set a model, just drop the
support for it so we can eliminate that extra query.
2023-12-12 13:05:59 +00:00
Sage Abdullah
4082acca9b
Remove unnecessary custom code in snippets index view and template
The model_opts is already supplied by generic
IndexView.get_context_data(), and can_add_snippet is already covered by
the can_add context variable in the generic view. For the template, the
only differences are:

- the title tag no longer says 'Snippet <model name>' and instead only
  says '<model name>'
- the body class for the model has been removed
2023-12-12 13:05:59 +00:00
Sage Abdullah
14a245222e
Change default add_item_label in generic IndexView to 'Add (model name)'
Unfortunately can't use 'Add a (model name)' because we can't smartly
handle the case of 'a' vs 'an'
2023-12-12 13:05:59 +00:00
Sage Abdullah
10d052aad5
Add separate block for shared header's base_actions in generic index template
The base_actions was added in 252c4015a0
for the sole purpose of fixing the position of the locale switcher on
snippets index view.

With the upcoming Universal Listings work, all of the actions and
filters will likely be moved to the slim header (breadcrumbs), so this
will be eliminated anyway. However, doing this allows us to refactor the
snippets index view to reuse as much of the generic index view code and
template as possible (see next commit).
2023-12-12 13:05:59 +00:00