tao_on_rails 0.4.4 → 0.5.0

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: ee5c1ce74ea9c153ec454cf382fb5a6d43986f17
4
- data.tar.gz: 13aa04bbd3a5241ae07645c85f1c995cd63293da
3
+ metadata.gz: 97072384321842b0296230ccebbb6ac422930d74
4
+ data.tar.gz: f5bff7b878000d5fb9254e14ccc1d4b68c6ffa94
5
5
  SHA512:
6
- metadata.gz: d45f90e9408f63f357b98c11bb72758bd5dba94ca7faac1b766ffa1110246e29fe8f35cb776098ed1d91e591827f5c7ed7a9356db2de4c9c6591203e91a0f30f
7
- data.tar.gz: ba4ce83888594bf2985b26c7caca07d460a7370166043ddd6301e48f996ec9e95cb2e2eb63a733d4a7b7831d210fc5a360f2049e7242c68de1ed4fc0a578c194
6
+ metadata.gz: ced456663bc4e5af9756daaa06abb0f4b9379d91ac3f88b3711c54e1b78f8ec34d7b75339f6c94f443fadee900c16ca0a0981fb0449ae54e1976fd1fe424253e
7
+ data.tar.gz: 4aa051dcf5cc7855f5802c6998cb4b3ff0f3f720b27fa180a7520ea30e06d02480730074f6048d33255b970234554f50acce56e6bcf63ee001b6c664acc827f9
data/dist/tao.js CHANGED
@@ -27746,21 +27746,21 @@ return jQuery;
27746
27746
  return this;
27747
27747
  };
27748
27748
 
27749
- TaoModule.get = function(propertyName, getMethod) {
27750
- return Object.defineProperty(this.prototype, propertyName, {
27749
+ TaoModule.get = function(attributeName, getMethod) {
27750
+ return Object.defineProperty(this.prototype, attributeName, {
27751
27751
  get: getMethod,
27752
27752
  configurable: true
27753
27753
  });
27754
27754
  };
27755
27755
 
27756
- TaoModule.set = function(propertyName, setMethod) {
27757
- return Object.defineProperty(this.prototype, propertyName, {
27756
+ TaoModule.set = function(attributeName, setMethod) {
27757
+ return Object.defineProperty(this.prototype, attributeName, {
27758
27758
  set: setMethod,
27759
27759
  configurable: true
27760
27760
  });
27761
27761
  };
27762
27762
 
27763
- TaoModule.property = function() {
27763
+ TaoModule.attribute = function() {
27764
27764
  var i, names, options;
27765
27765
  names = 2 <= arguments.length ? slice.call(arguments, 0, i = arguments.length - 1) : (i = 0, []), options = arguments[i++];
27766
27766
  if (options == null) {
@@ -27774,14 +27774,14 @@ return jQuery;
27774
27774
  return function(name) {
27775
27775
  _this.get(name, function() {
27776
27776
  var ref;
27777
- return (ref = this._properties[name]) != null ? ref : options["default"];
27777
+ return (ref = this._attributes[name]) != null ? ref : options["default"];
27778
27778
  });
27779
27779
  return _this.set(name, function(val) {
27780
27780
  var name1;
27781
- if (this._properties[name] === val) {
27781
+ if (this._attributes[name] === val) {
27782
27782
  return;
27783
27783
  }
27784
- this._properties[name] = val;
27784
+ this._attributes[name] = val;
27785
27785
  return typeof this[name1 = "_" + name + "Changed"] === "function" ? this[name1]() : void 0;
27786
27786
  });
27787
27787
  };
@@ -27793,7 +27793,7 @@ return jQuery;
27793
27793
  if (options == null) {
27794
27794
  options = {};
27795
27795
  }
27796
- this._properties = {};
27796
+ this._attributes = {};
27797
27797
  if (typeof options === 'object') {
27798
27798
  for (key in options) {
27799
27799
  val = options[key];
@@ -27874,7 +27874,9 @@ return jQuery;
27874
27874
  };
27875
27875
 
27876
27876
  TaoApplication.prototype._initI18n = function() {
27877
- return typeof I18n !== "undefined" && I18n !== null ? I18n.locale = this.locale : void 0;
27877
+ if (I18n && this.locale) {
27878
+ return I18n.locale = this.locale;
27879
+ }
27878
27880
  };
27879
27881
 
27880
27882
  TaoApplication.prototype._initIcons = function($page) {
@@ -27930,12 +27932,12 @@ return jQuery;
27930
27932
  };
27931
27933
  })(this)).on('turbolinks:render', (function(_this) {
27932
27934
  return function(e) {
27933
- return _this.trigger('page-render', [$('body > .page')]);
27935
+ return _this.trigger('page-render', [$('body > .tao-page')]);
27934
27936
  };
27935
27937
  })(this)).on('turbolinks:load', (function(_this) {
27936
27938
  return function(e) {
27937
27939
  var $page;
27938
- $page = $('body > .page');
27940
+ $page = $('body > .tao-page');
27939
27941
  if (!($page.length > 0)) {
27940
27942
  return;
27941
27943
  }
@@ -30930,21 +30932,21 @@ var Deferred = void 0;
30930
30932
  return this;
30931
30933
  };
30932
30934
 
30933
- _Class.get = function(propertyName, getMethod) {
30934
- return Object.defineProperty(this.prototype, propertyName, {
30935
+ _Class.get = function(attributeName, getMethod) {
30936
+ return Object.defineProperty(this.prototype, attributeName, {
30935
30937
  get: getMethod,
30936
30938
  configurable: true
30937
30939
  });
30938
30940
  };
30939
30941
 
30940
- _Class.set = function(propertyName, setMethod) {
30941
- return Object.defineProperty(this.prototype, propertyName, {
30942
+ _Class.set = function(attributeName, setMethod) {
30943
+ return Object.defineProperty(this.prototype, attributeName, {
30942
30944
  set: setMethod,
30943
30945
  configurable: true
30944
30946
  });
30945
30947
  };
30946
30948
 
30947
- _Class.property = function() {
30949
+ _Class.attribute = function() {
30948
30950
  var i, names, options;
30949
30951
  names = 2 <= arguments.length ? slice.call(arguments, 0, i = arguments.length - 1) : (i = 0, []), options = arguments[i++];
30950
30952
  if (options == null) {
@@ -31029,25 +31031,25 @@ var Deferred = void 0;
31029
31031
  _Class.prototype.on = function() {
31030
31032
  var args, ref;
31031
31033
  args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
31032
- return (ref = $(this)).on.apply(ref, args);
31034
+ return (ref = this.jq).on.apply(ref, args);
31033
31035
  };
31034
31036
 
31035
31037
  _Class.prototype.off = function() {
31036
31038
  var args, ref;
31037
31039
  args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
31038
- return (ref = $(this)).off.apply(ref, args);
31040
+ return (ref = this.jq).off.apply(ref, args);
31039
31041
  };
31040
31042
 
31041
31043
  _Class.prototype.trigger = function() {
31042
31044
  var args, ref;
31043
31045
  args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
31044
- return (ref = $(this)).triggerHandler.apply(ref, args);
31046
+ return (ref = this.jq).triggerHandler.apply(ref, args);
31045
31047
  };
31046
31048
 
31047
31049
  _Class.prototype.one = function() {
31048
31050
  var args, ref;
31049
31051
  args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
31050
- return (ref = $(this)).one.apply(ref, args);
31052
+ return (ref = this.jq).one.apply(ref, args);
31051
31053
  };
31052
31054
 
31053
31055
  _Class.prototype._init = function() {};
@@ -31080,7 +31082,7 @@ var Deferred = void 0;
31080
31082
  return TaoPage.__super__.constructor.apply(this, arguments);
31081
31083
  }
31082
31084
 
31083
- TaoPage.property('layout');
31085
+ TaoPage.attribute('layout');
31084
31086
 
31085
31087
  TaoPage.prototype.prepareCache = function() {
31086
31088
  return $(this).find('.tao-component').each((function(_this) {
@@ -21,7 +21,7 @@ class TaoApplication extends TaoModule
21
21
  $(@).removeClass 'disabled'
22
22
 
23
23
  _initI18n: ->
24
- I18n?.locale = @locale
24
+ I18n.locale = @locale if I18n && @locale
25
25
 
26
26
  _initIcons: ($page) ->
27
27
  $icons = $page.siblings('#tao-icons')
@@ -57,10 +57,10 @@ class TaoApplication extends TaoModule
57
57
  @trigger 'before-page-render', [$ e.originalEvent?.data.newBody]
58
58
 
59
59
  .on 'turbolinks:render', (e) =>
60
- @trigger 'page-render', [$('body > .page')]
60
+ @trigger 'page-render', [$('body > .tao-page')]
61
61
 
62
62
  .on 'turbolinks:load', (e) =>
63
- $page = $ 'body > .page'
63
+ $page = $ 'body > .tao-page'
64
64
  return unless $page.length > 0
65
65
  @_initIcons $page
66
66
  @_initPage $page
@@ -28,17 +28,17 @@ TaoComponentBasedOn = (superClass = 'HTMLElement') ->
28
28
  obj.included?.call(@)
29
29
  @
30
30
 
31
- @get: (propertyName, getMethod) ->
32
- Object.defineProperty @prototype, propertyName,
31
+ @get: (attributeName, getMethod) ->
32
+ Object.defineProperty @prototype, attributeName,
33
33
  get: getMethod
34
34
  configurable: true
35
35
 
36
- @set: (propertyName, setMethod) ->
37
- Object.defineProperty @prototype, propertyName,
36
+ @set: (attributeName, setMethod) ->
37
+ Object.defineProperty @prototype, attributeName,
38
38
  set: setMethod
39
39
  configurable: true
40
40
 
41
- @property: (names..., options = {}) ->
41
+ @attribute: (names..., options = {}) ->
42
42
  unless typeof options == 'object'
43
43
  names.push(options)
44
44
  options = {}
@@ -92,16 +92,16 @@ TaoComponentBasedOn = (superClass = 'HTMLElement') ->
92
92
  @["_#{_.camelCase attrName}Changed"]?()
93
93
 
94
94
  on: (args...) ->
95
- $(@).on args...
95
+ @jq.on args...
96
96
 
97
97
  off: (args...) ->
98
- $(@).off args...
98
+ @jq.off args...
99
99
 
100
100
  trigger: (args...) ->
101
- $(@).triggerHandler(args...)
101
+ @jq.triggerHandler(args...)
102
102
 
103
103
  one: (args...) ->
104
- $(@).one args...
104
+ @jq.one args...
105
105
 
106
106
  _init: ->
107
107
  # to be implemented
@@ -20,32 +20,32 @@ class TaoModule
20
20
  obj.included?.call(@)
21
21
  @
22
22
 
23
- @get: (propertyName, getMethod) ->
24
- Object.defineProperty @prototype, propertyName,
23
+ @get: (attributeName, getMethod) ->
24
+ Object.defineProperty @prototype, attributeName,
25
25
  get: getMethod
26
26
  configurable: true
27
27
 
28
- @set: (propertyName, setMethod) ->
29
- Object.defineProperty @prototype, propertyName,
28
+ @set: (attributeName, setMethod) ->
29
+ Object.defineProperty @prototype, attributeName,
30
30
  set: setMethod
31
31
  configurable: true
32
32
 
33
- @property: (names..., options = {}) ->
33
+ @attribute: (names..., options = {}) ->
34
34
  unless typeof options == 'object'
35
35
  names.push(options)
36
36
  options = {}
37
37
 
38
38
  names.forEach (name) =>
39
39
  @get name, ->
40
- @_properties[name] ? options.default
40
+ @_attributes[name] ? options.default
41
41
  @set name, (val) ->
42
- return if @_properties[name] == val
43
- @_properties[name] = val
42
+ return if @_attributes[name] == val
43
+ @_attributes[name] = val
44
44
  @["_#{name}Changed"]?()
45
45
 
46
46
  constructor: (options = {}) ->
47
- @_properties = {}
48
-
47
+ @_attributes = {}
48
+
49
49
  if typeof options == 'object'
50
50
  @[key] = val for key, val of options
51
51
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  class TaoPage extends TaoComponent
4
4
 
5
- @property 'layout'
5
+ @attribute 'layout'
6
6
 
7
7
  prepareCache: ->
8
8
  $(@).find('.tao-component').each (i, el) =>
@@ -1,5 +1,5 @@
1
1
  module TaoOnRails
2
2
  module Rails
3
- VERSION = "0.4.4"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tao_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siyuan Liu
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-12-26 00:00:00.000000000 Z
12
+ date: 2016-12-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: turbolinks