Skip to content

Commit b5a8191

Browse files
committed
Support findAll/pluck #238
1 parent e7387cb commit b5a8191

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

grails-app/assets/javascripts/forms.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,21 @@ function orEmptyArray(v) {
306306
}
307307

308308
return moment(value).format('DD-MM-YYYY');
309-
}
309+
};
310+
311+
parser.functions.findAll = function(list, property, value) {
312+
var obj = {};
313+
obj[property] = value;
314+
return _.where(list, obj);
315+
};
316+
317+
parser.functions.pluck = function(list, property, defaultValue) {
318+
var result = _.pluck(list, property);
319+
if (!result || result.length == 0) {
320+
result = [defaultValue];
321+
}
322+
return result;
323+
};
310324

311325
var specialBindings = function() {
312326

0 commit comments

Comments
 (0)