Filter contributions by current contributor on contribution search

This commit is contained in:
Benjamin Renard 2014-12-01 23:20:18 +01:00 committed by root
parent ecbc75df06
commit 5eb426449f
2 changed files with 6 additions and 2 deletions

View file

@ -342,8 +342,9 @@ on_nav_search_form_input=function(e) {
var pattern=ipt.val();
group=groups[$('#view-group').data('uuid')];
contributor_email=$('#view-group #contributor')[0].value;
var found=group.searchContributions(pattern);
var found=group.searchContributions(pattern,contributor_email);
show_contributions(group,null,found);
}

View file

@ -341,10 +341,13 @@ function Group(uuid,name,data) {
};
}
this.searchContributions=function(pattern) {
this.searchContributions=function(pattern,contributor) {
var ret=[];
substrRegex = new RegExp(pattern, 'i');
for (uuid in this.contributions) {
if (contributor && contributor!=this.contributions[uuid].contributor.email) {
continue;
}
if (substrRegex.test(this.contributions[uuid].title) || substrRegex.test(this.contributions[uuid].cost)) {
ret.push(this.contributions[uuid]);
}