Added a utility method for finding elements with a classname

Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/e53983cd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/e53983cd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/e53983cd

Branch: refs/heads/blur-console-v2
Commit: e53983cd97a561ea1f6d33fb09f0578174fbc251
Parents: 6931af3
Author: Chris Rohr <[email protected]>
Authored: Tue Nov 12 22:29:03 2013 -0500
Committer: Chris Rohr <[email protected]>
Committed: Tue Nov 12 22:29:03 2013 -0500

----------------------------------------------------------------------
 .../org/apache/blur/console/webapp/js/app.js          | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e53983cd/contrib/blur-console/src/main/resources/org/apache/blur/console/webapp/js/app.js
----------------------------------------------------------------------
diff --git 
a/contrib/blur-console/src/main/resources/org/apache/blur/console/webapp/js/app.js
 
b/contrib/blur-console/src/main/resources/org/apache/blur/console/webapp/js/app.js
index 1a51a66..82dd831 100644
--- 
a/contrib/blur-console/src/main/resources/org/apache/blur/console/webapp/js/app.js
+++ 
b/contrib/blur-console/src/main/resources/org/apache/blur/console/webapp/js/app.js
@@ -15,4 +15,16 @@
  * limitations under the License.
  */
 
-var blurApp = angular.module('blurApp', ['ui.bootstrap', 'flotr']);
\ No newline at end of file
+var blurApp = angular.module('blurApp', ['ui.bootstrap', 'flotr']);
+
+var Utils = {
+       filterByClassName: function(els, className) {
+               var result = [];
+               angular.forEach(els, function(el, i) {
+                       if(angular.element(el).hasClass(className)) {
+                               result.push(el);
+                       }
+               });
+               return result.length == 1 ? result[0] : result;
+       }
+}
\ No newline at end of file

Reply via email to