Filter contributions by current contributor on contribution search
Benjamin Renard

Benjamin Renard commited on 2014-12-01 22:20:20
Showing 2 changed files, with 6 additions and 2 deletions.

... ...
@@ -342,8 +342,9 @@ on_nav_search_form_input=function(e) {
342 342
   var pattern=ipt.val();
343 343
 
344 344
   group=groups[$('#view-group').data('uuid')];
345
+  contributor_email=$('#view-group #contributor')[0].value;
345 346
  
346
-  var found=group.searchContributions(pattern);
347
+  var found=group.searchContributions(pattern,contributor_email);
347 348
   show_contributions(group,null,found);
348 349
 }
349 350
 
... ...
@@ -341,10 +341,13 @@ function Group(uuid,name,data) {
341 341
     };
342 342
   }
343 343
 
344
-  this.searchContributions=function(pattern) {
344
+  this.searchContributions=function(pattern,contributor) {
345 345
     var ret=[];
346 346
     substrRegex = new RegExp(pattern, 'i');
347 347
     for (uuid in this.contributions) {
348
+      if (contributor && contributor!=this.contributions[uuid].contributor.email) {
349
+        continue;
350
+      }
348 351
       if (substrRegex.test(this.contributions[uuid].title) || substrRegex.test(this.contributions[uuid].cost)) {
349 352
         ret.push(this.contributions[uuid]);
350 353
       }
351 354