Filter contributions by current contributor on contribution search
This commit is contained in:
parent
ecbc75df06
commit
5eb426449f
2 changed files with 6 additions and 2 deletions
|
@ -342,8 +342,9 @@ on_nav_search_form_input=function(e) {
|
||||||
var pattern=ipt.val();
|
var pattern=ipt.val();
|
||||||
|
|
||||||
group=groups[$('#view-group').data('uuid')];
|
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);
|
show_contributions(group,null,found);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -341,10 +341,13 @@ function Group(uuid,name,data) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
this.searchContributions=function(pattern) {
|
this.searchContributions=function(pattern,contributor) {
|
||||||
var ret=[];
|
var ret=[];
|
||||||
substrRegex = new RegExp(pattern, 'i');
|
substrRegex = new RegExp(pattern, 'i');
|
||||||
for (uuid in this.contributions) {
|
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)) {
|
if (substrRegex.test(this.contributions[uuid].title) || substrRegex.test(this.contributions[uuid].cost)) {
|
||||||
ret.push(this.contributions[uuid]);
|
ret.push(this.contributions[uuid]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue