Permalink
Browse files

add student filter

  • Loading branch information...
1 parent 322669b commit 5648bf0acc95b2fdd70a6601c1be2040fcad4372 @rmarianski rmarianski committed Nov 10, 2012
Showing with 23 additions and 6 deletions.
  1. +18 −6 search/templates/home.html
  2. +5 −0 search/views.py
View
@@ -43,14 +43,19 @@
var newEl = $("#template_" + val).clone();
newEl.removeAttr("id").addClass("searchParam");
var newElWrapper = $("<div>").addClass("searchParamContainer");
- var isToggleElt = $("#template_istoggle").clone();
- isToggleElt.removeAttr("id");
- isToggleElt.show();
- isToggleElt.appendTo(newElWrapper);
+ if (newEl.hasClass('no-choice')) {
+ var hiddenInput = newEl.find('input[type=hidden]');
+ hiddenInput.attr('name', $(this).attr('name') + "_" + newEl.attr("name"));
+ } else {
+ var isToggleElt = $("#template_istoggle").clone();
+ isToggleElt.removeAttr("id");
+ isToggleElt.show();
+ isToggleElt.appendTo(newElWrapper);
+ isToggleElt.attr("name", newEl.attr("name") + "_" + isToggleElt.attr("name"));
+ newEl.attr("name", $(this).attr("name") + "_" + newEl.attr("name"));
+ }
newEl.appendTo(newElWrapper);
- newEl.attr("name", $(this).attr("name") + "_" + newEl.attr("name"));
newEl.show();
- isToggleElt.attr("name", newEl.attr("name") + "_" + isToggleElt.attr("name"));
newElWrapper.appendTo(that);
if( newEl[0].tagName == "SELECT" ) {
if( newEl.data("filtertype") == "state" ) {
@@ -283,6 +288,13 @@
{% endfor %}
</select>
+ <div id="template_student"
+ name="student"
+ class="no-choice">
+ <label style="margin-left: 0.5em">Searching for students</label>
+ <input type="hidden" name="student" value="yes" />
+ </div>
+
<select id="template_language"
name="language"
multiple="multiple">
View
@@ -258,6 +258,10 @@ def make_donated_times_query(users, query_data, values, search_on, extra_data={}
'query': "fields__value",
'extra': {"fields__name": "engagement_level"},
},
+ 'student': {
+ 'query': "fields__value",
+ 'extra': {"fields__name": "student"},
+ },
'language': {
'query': "lang__id",
},
@@ -435,6 +439,7 @@ def home(request):
('skills', "Skills"),
('engagement_level', "Engagement Level"),
('language', "Preferred Language"),
+ ('student', "Student"),
('created_before', "Created Before"),
('created_after', "Created After"),
),

0 comments on commit 5648bf0

Please sign in to comment.