elementaljs-rails 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f204b8e7c8df0f68d7948096a70541f600da891
4
- data.tar.gz: 761c6833b5a5d5d96f768fccdf8ef6dea0d8ce49
3
+ metadata.gz: 603b6b1a106cf2a4bf05b38395357c0d913e8cb5
4
+ data.tar.gz: dcd03572efbf63ca06de01a7ce8ddedff3eba513
5
5
  SHA512:
6
- metadata.gz: b2e61448f3c001963610aaa8cb03921077444eba3284670253d40eb424167c733dfd06028805983b7a813fc11c530c80cad014f67a89d03f22b6044373824a72
7
- data.tar.gz: 6655e7dd48c8c3b3deb96516923c54e66236bc10ad9cfeaaef9e653b145878c18965070e2b7f2123dfe65d76481da34632ab0c6f2a8cf39d645ee7b8b3265f49
6
+ metadata.gz: 3bccf244ade751c58c967c97bb2583468b4d4448c048aec96e3f8c505ef7d04df8f67c83afa482aab0157117c0373b61361623785ebb63470b370a19167858db
7
+ data.tar.gz: 5c4871afcebb29be8328c1f9b53f8c51846e87d6e9e566a3265c249e7ea86614a1d45e391293802d40c81f83b7adebda9304a0abec584efb9e112ab17c4eb148
@@ -1,5 +1,5 @@
1
1
  module Elementaljs
2
2
  module Rails
3
- VERSION = "0.0.12"
3
+ VERSION = "0.0.13"
4
4
  end
5
5
  end
@@ -20,7 +20,11 @@
20
20
  });
21
21
 
22
22
  if(typeof fn === 'function') {
23
- return fn($element);
23
+ if(ns.options.classBased) {
24
+ return new fn($element);
25
+ } else {
26
+ return fn($element);
27
+ }
24
28
  } else {
25
29
  if (window.console && console.warn) {
26
30
  console.warn("elementalJS: Unable to find behavior:", behavior);
@@ -30,20 +34,25 @@
30
34
 
31
35
  var attachBehaviorsToElement = function(element) {
32
36
  var $element = $(element);
33
- var behaviors = $element.data('behavior');
37
+ var behaviors = $element.data('behavior') || $element.data('behaviour');
34
38
  behaviors.replace(/([^ ]+)/g, function(behavior) {
35
39
  attachBehavior($element, behavior);
36
40
  });
37
41
  };
38
42
 
43
+ ns.options = {
44
+ classBased: false
45
+ };
46
+
39
47
  ns.loadOnly = function(element) {
40
48
  attachBehaviorsToElement(element);
41
49
  };
42
50
 
43
51
  ns.load = function(container) {
44
- var $selector = $('[data-behavior]', container).add($(container).filter('[data-behavior]'));
52
+ var selector_name = '[data-behavior], [data-behaviour]';
53
+ var $behaviors = $(selector_name, container).add($(container).filter(selector_name));
45
54
 
46
- $selector.each(function(index, element) {
55
+ $behaviors.each(function(index, element) {
47
56
  attachBehaviorsToElement(element);
48
57
  });
49
58
  };
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elementaljs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robbie Clutton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-03 00:00:00.000000000 Z
11
+ date: 2016-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jquery-rails