From 716a4dc6a38b20edbd54af72e66ee707d61ff25b Mon Sep 17 00:00:00 2001 From: Chris Van Date: Mon, 26 Sep 2011 18:59:21 -0700 Subject: [PATCH] detect OS/browser version for search results (bug 688344) --- apps/search/forms.py | 2 ++ apps/search/templates/search/mobile/search.html | 2 ++ media/js/impala/search.js | 6 ++---- media/js/zamboni/init.js | 4 ++++ templates/impala/search.html | 4 +++- templates/search.html | 4 +++- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/apps/search/forms.py b/apps/search/forms.py index da24609414..282af0869c 100644 --- a/apps/search/forms.py +++ b/apps/search/forms.py @@ -88,6 +88,8 @@ class SimpleSearchForm(forms.Form): """Powers the search box on every page.""" q = forms.CharField(required=False) cat = forms.CharField(required=False, widget=forms.HiddenInput) + appver = forms.CharField(required=False, widget=forms.HiddenInput) + platform = forms.CharField(required=False, widget=forms.HiddenInput) choices = dict(SEARCH_CHOICES) def clean_cat(self): diff --git a/apps/search/templates/search/mobile/search.html b/apps/search/templates/search/mobile/search.html index 6cc8275cc6..fc5c1a5471 100644 --- a/apps/search/templates/search/mobile/search.html +++ b/apps/search/templates/search/mobile/search.html @@ -3,6 +3,8 @@ {{ search_form.cat }} + {{ search_form.appver }} + {{ search_form.platform }} diff --git a/media/js/impala/search.js b/media/js/impala/search.js index 919e4ab4a3..5fb4697923 100644 --- a/media/js/impala/search.js +++ b/media/js/impala/search.js @@ -1,6 +1,5 @@ $(function() { - var $facets = $('#search-facets'); - $facets.delegate('li.facet', 'click', function() { + $('#search-facets').delegate('li.facet', 'click', function() { var $this = $(this); if ($this.hasClass('active')) { $this.removeClass('active'); @@ -8,8 +7,7 @@ $(function() { $this.closest('ul').find('.active').removeClass('active'); $this.addClass('active'); } - }); - $facets.delegate('li.facet a', 'click', function(e) { + }).delegate('li.facet a', 'click', function(e) { e.stopPropagation(); }); }); diff --git a/media/js/zamboni/init.js b/media/js/zamboni/init.js index e4391e57d4..562c3df324 100644 --- a/media/js/zamboni/init.js +++ b/media/js/zamboni/init.js @@ -151,6 +151,10 @@ if (z.browser.firefox) { if (z.fxBeta) { $(document.body).addClass('fxbeta'); } + + // Populate search form with browser version and OS. + $('#search #id_appver').val(z.browserVersion); + $('#search #id_platform').val(z.platform); } else { z.fxBeta = false; } diff --git a/templates/impala/search.html b/templates/impala/search.html index 56f4a45865..3328194392 100644 --- a/templates/impala/search.html +++ b/templates/impala/search.html @@ -1,10 +1,12 @@ {% set search_form = SimpleSearchForm(request, search_cat) %} -
+ {{ search_form.cat }} + {{ search_form.appver }} + {{ search_form.platform }}
diff --git a/templates/search.html b/templates/search.html index 0a6e40bd0c..c3a8f2e556 100644 --- a/templates/search.html +++ b/templates/search.html @@ -1,11 +1,13 @@ {% set search_form = SimpleSearchForm(request, search_cat) %} -
+ {{ search_form.cat }} + {{ search_form.appver }} + {{ search_form.platform }}