Skip to content

Commit

Permalink
series: Implement a 'Show all' link to clear all current filters
Browse files Browse the repository at this point in the history
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
  • Loading branch information
Damien Lespiau committed Feb 26, 2016
1 parent 9489794 commit 1f2365a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
20 changes: 18 additions & 2 deletions htdocs/js/patchwork.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,13 @@ var pw = (function() {
}

var text, count = this.count();
if (descriptions.length === 0)
if (descriptions.length === 0) {
text = "Showing all " + count + " " + this.name;
else {
$(this.selector + '-showall').hide();
} else {
text = "Showing " + count + " " + this.name + ' ';
text += descriptions.join(', ');
$(this.selector + '-showall').show();
}
this.set_info(text);
};
Expand Down Expand Up @@ -277,6 +279,20 @@ var pw = (function() {
});
});

/* 'Show all' link */
$(o.selector + '-showall').click(function() {
for (var i = 0; i < o.filters.length; i++) {
var filter = o.filters[i];

if (!filter.is_active)
continue;

filter.clear_filter(o);
filter.set_active(false);
}
o.refresh();
});

return o;
}

Expand Down
4 changes: 3 additions & 1 deletion patchwork/templates/patchwork/series-list-table.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<div class="container-fluid">
<div class="row">
<div id="serieslist-info-container" class="alert alert-info table-info col-xs-9" style="display: none;">
<div id="serieslist-info"></div>
<span id="serieslist-info"></span>
<button id="serieslist-showall" type="button" class="btn btn-link"
style="display: none;">Show all series</button>
</div>
<div class='dynatable-pagination-links-serieslist'></div>
</div>
Expand Down

0 comments on commit 1f2365a

Please sign in to comment.