summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/templates/filtersnippet.html3
-rw-r--r--bitbake/lib/toaster/toastergui/templatetags/projecttags.py11
2 files changed, 13 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/filtersnippet.html b/bitbake/lib/toaster/toastergui/templates/filtersnippet.html
index d4a4f328ce..4626ffecae 100644
--- a/bitbake/lib/toaster/toastergui/templates/filtersnippet.html
+++ b/bitbake/lib/toaster/toastergui/templates/filtersnippet.html
@@ -1,3 +1,4 @@
1{% load projecttags %}
1<!-- '{{f.class}}' filter --> 2<!-- '{{f.class}}' filter -->
2<form id="filter_{{f.class}}" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true"> 3<form id="filter_{{f.class}}" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
3 <input type="hidden" name="search" value="{{request.GET.search}}"/> 4 <input type="hidden" name="search" value="{{request.GET.search}}"/>
@@ -8,7 +9,7 @@
8 <div class="modal-body"> 9 <div class="modal-body">
9 <p>{{f.label}}</p> 10 <p>{{f.label}}</p>
10 <label class="radio"> 11 <label class="radio">
11 <input type="radio" name="filter" value=""> All {{objectname}} 12 <input type="radio" name="filter" {%if request.GET.filter%}{{f.options|check_filter_status:request.GET.filter}} {%else%} checked {%endif%} value=""> All {{objectname}}
12 </label> 13 </label>
13 {% for option in f.options %} 14 {% for option in f.options %}
14 <label class="radio"> 15 <label class="radio">
diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
index 042d6927c5..7e2c8e98fa 100644
--- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
+++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
@@ -114,3 +114,14 @@ def filtered_filesizeformat(value):
114def filtered_packagespec(value): 114def filtered_packagespec(value):
115 """Strip off empty version and revision""" 115 """Strip off empty version and revision"""
116 return re.sub(r'(--$)', '', value) 116 return re.sub(r'(--$)', '', value)
117
118@register.filter
119def check_filter_status(options, filter):
120 """Check if the active filter is among the available options, and return 'checked'
121 if filter is not active.
122 Used in FilterDialog to select the first radio button if the filter is not active.
123 """
124 for option in options:
125 if filter == option[1]:
126 return ""
127 return "checked"