kopia lustrzana https://github.com/wagtail/wagtail
add classnames template tag for generating classnames
- use classnames template tag in shared header template - add classname as documented variable for the shared header templatepull/8799/head
rodzic
524cab82e3
commit
e2d4cb7745
|
@ -54,6 +54,7 @@ Changelog
|
|||
* Prefetch workflow states in edit page view to to avoid queries in other parts of the view/templates that need it (Tidiane Dia)
|
||||
* Remove the edit link from edit bird in previews to avoid confusion (Sævar Öfjörð Magnússon)
|
||||
* Introduce new template fragment and block level enclosure tags for easier template composition (Thibaud Colas)
|
||||
* Add a `classnames` template tag to easily build up classes from variables provided to a template (Paarth Agarwal)
|
||||
* Fix: Typo in `ResumeWorkflowActionFormatter` message (Stefan Hammer)
|
||||
* Fix: Throw a meaningful error when saving an image to an unrecognised image format (Christian Franke)
|
||||
* Fix: Remove extra padding for headers with breadcrumbs on mobile viewport (Steven Steinwand)
|
||||
|
|
|
@ -61,6 +61,7 @@ When using a queryset to render a list of images, you can now use the `prefetch_
|
|||
* Prefetch workflow states in edit page view to to avoid queries in other parts of the view/templates that need it (Tidiane Dia)
|
||||
* Remove the edit link from edit bird in previews to avoid confusion (Sævar Öfjörð Magnússon)
|
||||
* Introduce new template fragment and block level enclosure tags for easier template composition (Thibaud Colas)
|
||||
* Add a `classnames` template tag to easily build up classes from variables provided to a template (Paarth Agarwal)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
Variables accepted by this template:
|
||||
|
||||
- `classname` - if present, adds classname to the header class list. This will be the class/classes added to the header class list
|
||||
- `title` - Displayed as `h1`
|
||||
- `subtitle` - Within the `h1` tag but smaller
|
||||
- `search_url` - if present, display a search box. This is a URL route name (taking no parameters) to be used as the action for that search box
|
||||
|
@ -14,7 +15,7 @@
|
|||
- `action_icon` - icon for the 'action' button, default is 'icon-plus'
|
||||
|
||||
{% endcomment %}
|
||||
<header class="header {% if merged %}merged{% endif %} {% if search_form %}hasform{% endif %}">
|
||||
<header class="{% classnames "header" classname merged|yesno:"merged," search_form|yesno:"hasform," %}">
|
||||
{% block breadcrumb %}{% endblock %}
|
||||
<div class="row">
|
||||
<div class="left">
|
||||
|
|
|
@ -153,6 +153,14 @@ def page_permissions(context, page):
|
|||
return _get_user_page_permissions(context).for_page(page)
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def classnames(*classes):
|
||||
"""
|
||||
Returns any args as a space-separated joined string for using in HTML class names.
|
||||
"""
|
||||
return " ".join([classname.strip() for classname in classes if classname])
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def test_collection_is_public(context, collection):
|
||||
"""
|
||||
|
|
Ładowanie…
Reference in New Issue