Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
add clear search link for reviewers (bug 852557)
Browse files Browse the repository at this point in the history
  • Loading branch information
spasovski committed Mar 20, 2013
1 parent 81cd614 commit deedc0a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
18 changes: 14 additions & 4 deletions media/js/mkt/reviewers.js
Expand Up @@ -82,24 +82,34 @@
var search_results = getTemplate($('#queue-search-template'));
var search_result_row = getTemplate($('#queue-search-row-template'));
var no_results = getTemplate($('#queue-search-empty-template'));
var $clear = $('#clear-queue-search'),
$appQueue = $('.search-toggle'),
$searchIsland = $('#search-island');

$clear.click(_pd(function() {
$appQueue.show();
$('#id_q').val('');
$clear.hide();
$searchIsland.hide();
}));

if ($search.length) {
var api_url = $search.data('api-url');
var search_island = $('#search-island');
$search.on('submit', 'form', _pd(function() {
var $form = $(this);
$.get(api_url, $form.serialize()).done(function(data) {
// Hide app queue.
$('.search-toggle').hide();
$appQueue.hide();
$clear.show();
// Show results.
if (data.meta.total_count === 0) {
search_island.html(no_results({})).show();
$searchIsland.html(no_results({})).show();
} else {
var results = [];
$.each(data.objects, function(i, item) {
results.push(search_result_row(item));
});
search_island.html(
$searchIsland.html(
search_results({rows: results.join('')})).show();
}
});
Expand Down
4 changes: 1 addition & 3 deletions mkt/reviewers/templates/reviewers/includes/queue_search.html
Expand Up @@ -7,9 +7,7 @@
{{ search_form.q }}
<button class="button" type="submit"><span>{{ _('Search') }}</button>
<a class="toggle-queue-search" href="#">{{ _('Advanced Search') }}</a>
{% if searching %}
(<a id="clear-queue-search" href="{{ url('reviewers.apps.queue_%s' % tab) }}">{{ _('Clear Search') }}</a>)
{% endif %}
<a id="clear-queue-search" class="hidden" href="{{ url('reviewers.apps.queue_%s' % tab) }}">({{ _('Clear Search') }})</a>

<div class="advanced-search c{% if not adv_searching %} hidden{% endif %}">
<div class="basic-filters">
Expand Down

0 comments on commit deedc0a

Please sign in to comment.