detect OS/browser version for search results (bug 688344)

This commit is contained in:
Chris Van 2011-09-26 18:59:21 -07:00
Родитель 0254dfbfe6
Коммит 716a4dc6a3
6 изменённых файлов: 16 добавлений и 6 удалений

Просмотреть файл

@ -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):

Просмотреть файл

@ -3,6 +3,8 @@
<input name="q" placeholder="{{ search_form.placeholder() }}"
type="search" {% if query %}value="{{ query }}"{% endif %}>
{{ search_form.cat }}
{{ search_form.appver }}
{{ search_form.platform }}
<button type="submit" value="">
<svg width="22" height="23" xmlns="http://www.w3.org/2000/svg" version="1.1"><polygon fill="#ffffff" points="22,12 11,23 8,20 14,14 0,14 0,10 14,10 8,4 11,1"/></svg>
</button>

Просмотреть файл

@ -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();
});
});

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -1,10 +1,12 @@
{% set search_form = SimpleSearchForm(request, search_cat) %}
<form action="{{ url('search.search') }}">
<form id="search" action="{{ url('search.search') }}">
<input id="search-q" type="text" name="q" required title=""
class="text {% if not search_form.q.data %}placeholder{% endif %}"
placeholder="{{ search_form.placeholder() }}"
value="{{ search_form.q.data or '' }}">
{{ search_form.cat }}
{{ search_form.appver }}
{{ search_form.platform }}
<button class="search-button" type="submit" title="{{ _('Search') }}"
src="{{ media('img/zamboni/global/btn-search.png') }}"></button>
</form>

Просмотреть файл

@ -1,11 +1,13 @@
{% set search_form = SimpleSearchForm(request, search_cat) %}
<form action="{{ url('search.search') }}">
<form id="search" action="{{ url('search.search') }}">
<span class="wrap">
<input id="search-q" type="text" name="q" required
class="text {% if not search_form.q.data %}placeholder{% endif %}"
placeholder="{{ search_form.placeholder() }}"
value="{{ search_form.q.data or '' }}">
{{ search_form.cat }}
{{ search_form.appver }}
{{ search_form.platform }}
</span>
<input id="search-button" type="image" class="submit" title="{{ _('Search') }}"
src="{{ media('img/zamboni/global/btn-search.png') }}">