Added support to dropdown list filter
parent
d2846b7420
commit
9080948f7c
|
|
@ -43,6 +43,10 @@ class ThemeAdmin(admin.ModelAdmin):
|
||||||
'classes': ('wide', ),
|
'classes': ('wide', ),
|
||||||
'fields': ('css_delete_button_background_color', 'css_delete_button_background_hover_color', 'css_delete_button_text_color', )
|
'fields': ('css_delete_button_background_color', 'css_delete_button_background_hover_color', 'css_delete_button_text_color', )
|
||||||
}),
|
}),
|
||||||
|
('Extras', {
|
||||||
|
'classes': ('wide', ),
|
||||||
|
'fields': ('list_filter_dropdown', )
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
save_on_top = True
|
save_on_top = True
|
||||||
|
|
|
||||||
|
|
@ -210,8 +210,17 @@
|
||||||
white-space:nowrap;
|
white-space:nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.inline-group thead th img {
|
||||||
|
vertical-align: -2px;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
form .form-row p.file-upload > a {
|
||||||
|
margin-right:10px;
|
||||||
|
}
|
||||||
|
|
||||||
form .form-row p.file-upload .clearable-file-input {
|
form .form-row p.file-upload .clearable-file-input {
|
||||||
margin-left:15px;
|
display:inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
form .wide p.help {
|
form .wide p.help {
|
||||||
|
|
@ -345,6 +354,63 @@
|
||||||
border-bottom:1px solid #fcfcfc !important;
|
border-bottom:1px solid #fcfcfc !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.list-filter-dropdown {
|
||||||
|
margin-top:10px;
|
||||||
|
margin-bottom:20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-filter-dropdown select {
|
||||||
|
width:90%;
|
||||||
|
margin-right:5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ckeditor + light theme - https://github.com/Ikimea/ckeditor-light-theme */
|
||||||
|
|
||||||
|
.cke_inner, .cke_wysiwyg_frame {
|
||||||
|
border-top-left-radius: 4px !important;
|
||||||
|
border-top-right-radius: 4px !important;
|
||||||
|
border-bottom-left-radius: 4px !important;
|
||||||
|
border-bottom-right-radius: 4px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cke_top {
|
||||||
|
background: #f6f6f6 !important;
|
||||||
|
border-top: none;
|
||||||
|
|
||||||
|
border-top-left-radius: 4px !important;
|
||||||
|
border-top-right-radius: 4px !important;
|
||||||
|
|
||||||
|
-moz-box-shadow: none !important;
|
||||||
|
-webkit-box-shadow: none !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cke_bottom {
|
||||||
|
background: #f6f6f6 !important;
|
||||||
|
border-top: 1px solid #efefef !important;
|
||||||
|
|
||||||
|
border-bottom-left-radius: 4px !important;
|
||||||
|
border-bottom-right-radius: 4px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cke_source {
|
||||||
|
padding: 13px 15px !important;
|
||||||
|
box-sizing: border-box !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.cke_button_on {
|
||||||
|
-moz-box-shadow: none !important;
|
||||||
|
-webkit-box-shadow: none !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
background-color: rgba(0,0,0,0.1) !important;
|
||||||
|
border-radius: 4px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cke_resizer {
|
||||||
|
border-color: transparent #999 transparent transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
{% if theme.css %}
|
{% if theme.css %}
|
||||||
{{ theme.css|safe }}
|
{{ theme.css|safe }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
{% load i18n admin_interface_tags %}
|
||||||
|
|
||||||
|
{% get_admin_interface_theme as theme %}
|
||||||
|
|
||||||
|
{% if theme.list_filter_dropdown %}
|
||||||
|
|
||||||
|
{% include "admin_interface/dropdown_filter.html" %}
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
{% comment %}
|
||||||
|
|
||||||
|
Use the default list filter template -> https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/filter.html
|
||||||
|
|
||||||
|
{% endcomment %}
|
||||||
|
|
||||||
|
<h3>{% blocktrans with filter_title=title %} By {{ filter_title }} {% endblocktrans %}</h3>
|
||||||
|
<ul>
|
||||||
|
{% for choice in choices %}
|
||||||
|
<li{% if choice.selected %} class="selected"{% endif %}>
|
||||||
|
<a href="{{ choice.query_string|iriencode }}">{{ choice.display }}</a></li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
{% load i18n admin_interface_tags %}
|
||||||
|
|
||||||
|
<div class="list-filter-dropdown">
|
||||||
|
<h3>{% blocktrans with title as filter_title %} By {{ filter_title }} {% endblocktrans %}</h3>
|
||||||
|
<div align="right">
|
||||||
|
<select onChange="javascript:window.location = this.options[this.selectedIndex].value;">
|
||||||
|
{% for choice in choices %}
|
||||||
|
<option {% if choice.selected %}selected{% endif %} value="{{ choice.query_string|iriencode }}">{{ choice.display }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
Loading…
Reference in New Issue