Skip to content

Commit

Permalink
Bug fixed. Refs #6164
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Fiala committed Jun 30, 2010
1 parent 3abe943 commit a40e830
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
26 changes: 22 additions & 4 deletions ella/newman/media/js/newman.js
Expand Up @@ -1065,10 +1065,13 @@ $( function() {
$('#search-form select[name=action]').live('keypress', search_on_enter);

// Search in change lists
function changelist_search($input) {
function changelist_search($input, $pop) {
if ($('#changelist').length == 0) return; // We're not in changelist
var search_terms = $input.val();
var adr_term = str_concat('&q=' , search_terms);
if ($pop.length > 0) {
adr_term = str_concat('&pop=', adr_term);
}
var loaded = Kobayashi.closest_loaded( $input.get(0) );
if (loaded.id == 'content') {
adr(adr_term);
Expand All @@ -1081,11 +1084,13 @@ $( function() {
$('#filters-handler .btn.search').live('click', function(evt) {
if (evt.button != 0) return;
var $input = $(this).prev('input#searchbar');
return changelist_search( $input );
var $pop = $(this).siblings('input#id_pop');
return changelist_search( $input, $pop );
});
$('#filters-handler #searchbar').live('keyup', function(evt) {
if (evt.keyCode == CR || evt.keyCode == LF) { } else return;
return changelist_search( $(this) );
var $pop = $(this).siblings('input#id_pop');
return changelist_search( $(this), $pop );
});
});

Expand Down Expand Up @@ -1579,17 +1584,30 @@ $( function() {
modify_getpar_href(this);
});

// search button
$target.find('#filters-handler .btn.icn.search').attr('href', 'filters::overlay-content::filters/');

// filters
var $filt = $('#filters-handler .popup-filter');
if ($filt.length) {
$filt.addClass('js-simpleload').attr( 'href', $filt.attr('href').replace(/::::/, str_concat('::',$target.attr('id'),'::') ) );
function init_filters() {
$(this).find('.filter li a').each( function() {
$(this).attr('href', $(this).attr('href').replace(/^\?/, 'overlay-content::&')).addClass('js-simpleload');
var $this = $(this);
$this.attr('href', $this.attr('href').replace(/^\?/, 'overlay-content::&')).addClass('js-simpleload');
var href = $this.attr('href');
var params = href.split(/&/);
// params[1] is part after token 'overlay-content::'
if (params.length == 2 && params[1].indexOf('pop') >= 0) {
// there is no other GET parameter, addition of string '&q=' is needed
$this.attr('href', href + '&q=');
}
});
}
log_generic.log('HREF: ', $filt.attr('href'));
$('#filters').unbind('content_added', init_filters).one('content_added', init_filters);
}
log_generic.log('init_overlay_content');

var $cancel = $('#filters-handler a.js-clear').not('.overlay-adapted');
if ($cancel.length) $cancel
Expand Down
3 changes: 3 additions & 0 deletions ella/newman/templates/newman/tpl_tags/search_form.html
@@ -1,6 +1,9 @@
{% spaceless %}
{% if cl.search_fields %}
{# <form class="js-form" id="changelist-search" action="." method="get" style="display: inline; margin: 0; padding: 0; vertical-align: middle;"> #}
{% if cl.is_popup %}
<input type="hidden" id="id_pop" name="pop" value="" />
{% endif %}
<input type="text" size="32" name="{{ search_var }}" value="{{ cl.query }}" id="searchbar" />
<a class="btn icn search def" href="">{% trans 'Search' %}</a>
{% if show_result_count %}
Expand Down

0 comments on commit a40e830

Please sign in to comment.