// each-resource-in.js
/*
   Copyright (c) 2014 3 Round Stones Inc, Some Rights Reserved
   Licensed under the Apache License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0
*/

(function($){

if (!window.calli) {
    window.calli = {};
}

window.calli.checkEachResourceIn = function(container) {
    var group = $(container);
    return function(element, index) {
        var el = typeof element == 'number' ? index : element;
        var resource = el.getAttribute('resource');
        group.find('[value="' + resource + '"]').prop('checked', true).change();
    };
};

window.calli.selectEachResourceIn = function(container) {
    var group = $(container);
    return function(element, index) {
        var el = typeof element == 'number' ? index : element;
        var resource = el.getAttribute('resource');
        group.find('[value="' + resource + '"]').prop('selected', true).closest('select').change();
    };
};

})(jQuery);


@@ -481,32 +481,47 @@
 ource');%0A       
+ var checkbox =
  group.find('%5Bva
@@ -542,24 +542,57 @@
 rce + '%22%5D').
+first();%0A        return checkbox.
 prop('checke
@@ -601,32 +601,39 @@
 , true).change()
+.get(0)
 ;%0A    %7D;%0A%7D;%0A%0Awin
@@ -877,16 +877,29 @@
 %0A       
+ var option =
  group.f
@@ -932,16 +932,40 @@
 + '%22%5D').
+first();%0A        option.
 prop('se
@@ -1003,24 +1003,54 @@
 ).change();%0A
+        return option.get(0);%0A
     %7D;%0A%7D;%0A%0A%7D

Return selected options for use with map function