romo 0.19.10 → 0.20.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: 83d0ec2bedb12e733a86fa6d0a254dc1c07e658a
4
- data.tar.gz: c2fab8071132f725db5672a8675beea8d1bd54b2
3
+ metadata.gz: f26940a49cc868326a0fdd6d5d995250d6a48e06
4
+ data.tar.gz: 35b274e5aecc37282b95a6a400e4cac0ad1685e3
5
5
  SHA512:
6
- metadata.gz: 779da3ae030a76a15a52bef091ad4c1bcfe6a0527c8e6e5ca321f8b0e8449a496882961a4d7c284386dc64722b255dd4905eec9e9456370eb92782dea7af7386
7
- data.tar.gz: 528c8ddf489a8bcb07d0e0a2e776bbcab94d49cc938fd5231239b7d03c317c21fd75a268104692dd13408e429b9e7654645cd9aa07524b275e1db406a31580ea
6
+ metadata.gz: d5409e3fca1c02e626c6415c083bc5f27e5c0579fbb07639fdd38d6c3cca7abf3127108ca60b6f6f2c55c8687015974d24f1720c0db306053e2b17c8f0890e76
7
+ data.tar.gz: fcfa1a63a2148aff2d008398070318139e7ec1ffc35349e735367524ab3cd2e1311d51752f966d560012ca7f583d2a2dd3b43e464f07e0596ac4efcc924434bd
@@ -15,6 +15,7 @@
15
15
  @include border1;
16
16
  border-color: $btnBorder;
17
17
  border-bottom-color: darken($btnBorder, 10%);
18
+ @include border-radius(0px);
18
19
  @include box-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
19
20
  }
20
21
 
@@ -29,6 +29,11 @@
29
29
  border-color: rgba(0, 0, 0, 0.2);
30
30
  }
31
31
 
32
+ .romo-modal-body,
33
+ .romo-modal-content {
34
+ position: relative;
35
+ }
36
+
32
37
  .romo-modal-popup:not([class*="romo-modal-open"]) {
33
38
  display: none;
34
39
  }
@@ -1,143 +1,129 @@
1
- $.fn.romoAjax = function() {
2
- return $.map(this, function(element) {
3
- return new RomoAjax(element);
4
- });
5
- }
6
-
7
- var RomoAjax = function(element) {
8
- this.elem = $(element);
9
- this.targetElem = $(this.elem.data('romo-ajax-target'));
1
+ var RomoAjax = RomoComponent(function(elem) {
2
+ this.elem = elem;
3
+ this.targetElem = Romo.f(Romo.data(this.elem, 'romo-ajax-target'))[0];
10
4
 
11
5
  this.defaultInvokeOn = 'click';
12
- this.invokeOn = this.elem.data('romo-ajax-invoke-on');
13
- if (this.invokeOn === undefined && this.elem.data('romo-ajax-disable-default-invoke-on') !== true) {
6
+ this.invokeOn = Romo.data(this.elem, 'romo-ajax-invoke-on');
7
+
8
+ if (this.invokeOn === undefined && Romo.data(this.elem, 'romo-ajax-disable-default-invoke-on') !== true) {
14
9
  this.invokeOn = this.defaultInvokeOn;
15
10
  }
16
11
 
17
- this.callMethod = this.elem.data('romo-ajax-call-method') || 'GET';
18
- this.urlAttr = this.elem.data('romo-ajax-url-attr') || 'href';
19
- this.callOnlyOnce = this.elem.data('romo-ajax-call-once') === true;
12
+ this.callMethod = Romo.data(this.elem, 'romo-ajax-call-method') || 'GET';
13
+ this.urlAttr = Romo.data(this.elem, 'romo-ajax-url-attr') || 'href';
14
+ this.callOnlyOnce = Romo.data(this.elem, 'romo-ajax-call-once') === true;
20
15
 
21
16
  this.invokeQueued = false;
22
17
  this.invokeRunning = false;
23
18
 
24
19
  this.queuedInvokeData = undefined;
25
20
 
26
- if (this.invokeOn !== undefined) {
27
- this.elem.unbind(this.invokeOn);
28
- }
29
-
30
21
  this.doInit();
31
- this.doBindElem();
32
- this._trigger('romoAjax:ready', [this]);
33
- }
22
+ this._bindElem();
34
23
 
35
- RomoAjax.prototype.doInit = function() {
36
- // override as needed
37
- }
24
+ this._trigger('romoAjax:ready', [this]);
25
+ });
38
26
 
39
- RomoAjax.prototype.doBindElem = function() {
40
- this.doUnbindElem();
41
- if (this.invokeOn !== undefined) {
42
- this.elem.on(this.invokeOn, $.proxy(this.onInvoke, this));
27
+ RomoAjax.prototype.doInvoke = function(data) {
28
+ this.invokeQueued = true;
29
+ this.queuedInvokeData = data;
30
+ if (this.invokeRunning === false) {
31
+ this._invoke();
43
32
  }
44
- this.elem.on('romoAjax:triggerInvoke', $.proxy(this.onTriggerInvoke, this));
45
33
  }
46
34
 
47
35
  RomoAjax.prototype.doUnbindElem = function() {
48
36
  if (this.invokeOn !== undefined) {
49
- this.elem.off(this.invokeOn, $.proxy(this.onInvoke, this));
37
+ Romo.off(this.elem, this.invokeOn, Romo.proxy(this._onInvoke, this));
50
38
  }
51
- this.elem.off('romoAjax:triggerInvoke', $.proxy(this.onTriggerInvoke, this));
39
+ Romo.off(this.elem, 'romoAjax:triggerInvoke', Romo.proxy(this._onTriggerInvoke, this));
52
40
  }
53
41
 
54
- RomoAjax.prototype.onInvoke = function(e) {
55
- if (e !== undefined) {
56
- e.preventDefault();
57
- }
42
+ // private
58
43
 
59
- if (this.elem.hasClass('disabled') === false) {
60
- this.doInvoke();
44
+ RomoAjax.prototype._bindElem = function() {
45
+ this.doUnbindElem();
46
+ if (this.invokeOn !== undefined) {
47
+ Romo.on(this.elem, this.invokeOn, Romo.proxy(this._onInvoke, this));
61
48
  }
49
+ Romo.on(this.elem, 'romoAjax:triggerInvoke', Romo.proxy(this._onTriggerInvoke, this));
62
50
  }
63
51
 
64
- RomoAjax.prototype.onTriggerInvoke = function(e, data) {
65
- if (e !== undefined) {
66
- e.stopPropagation();
67
- }
52
+ RomoAjax.prototype._invoke = function() {
53
+ this.invokeQueued = false;
54
+ this.invokeRunning = true;
68
55
 
69
- if (this.elem.hasClass('disabled') === false) {
70
- this.doInvoke(data);
71
- }
72
- }
56
+ var data = this.queuedInvokeData;
57
+ this.queuedInvokeData = undefined;
73
58
 
74
- RomoAjax.prototype.doInvoke = function(data) {
75
- this.invokeQueued = true;
76
- this.queuedInvokeData = data;
77
- if (this.invokeRunning === false) {
78
- this._doInvoke();
59
+ var callUrl = Romo.attr(this.elem, this.urlAttr);
60
+ if (this.callOnlyOnce === true) {
61
+ Romo.rmAttr(this.elem, this.urlAttr);
62
+ }
63
+ if (callUrl !== undefined) {
64
+ this._call(callUrl, data);
65
+ } else {
66
+ this._completeInvoke();
79
67
  }
80
68
  }
81
69
 
82
- RomoAjax.prototype.doCall = function(callUrl, data) {
70
+ RomoAjax.prototype._call = function(callUrl, data) {
83
71
  this._trigger('romoAjax:callStart', [this]);
84
72
 
85
- $.ajax({
73
+ Romo.ajax({
86
74
  type: this.callMethod,
87
75
  url: callUrl,
88
76
  data: (data || {}),
89
- success: $.proxy(this.onCallSuccess, this),
90
- error: $.proxy(this.onCallError, this)
77
+ success: Romo.proxy(this._onCallSuccess, this),
78
+ error: Romo.proxy(this._onCallError, this)
91
79
  });
92
80
  }
93
81
 
94
- RomoAjax.prototype.onCallSuccess = function(data, status, xhr) {
95
- this._trigger('romoAjax:callSuccess', [data, this]);
96
- this._doCompleteInvoke();
97
- }
98
-
99
- RomoAjax.prototype.onCallError = function(xhr, errorType, error) {
100
- this._trigger('romoAjax:callError', [xhr, this]);
101
- this._doCompleteInvoke();
102
- }
103
-
104
- // private
105
-
106
- RomoAjax.prototype._doCompleteInvoke = function() {
82
+ RomoAjax.prototype._completeInvoke = function() {
107
83
  this._trigger('romoAjax:invoke', [this]);
108
84
  if (this.invokeQueued === true) {
109
- this._doInvoke();
85
+ this._invoke();
110
86
  } else {
111
87
  this.invokeRunning = false;
112
88
  }
113
89
  }
114
90
 
115
- RomoAjax.prototype._doInvoke = function() {
116
- this.invokeQueued = false;
117
- this.invokeRunning = true;
91
+ RomoAjax.prototype._trigger = function(eventName, eventData) {
92
+ if (this.targetElem !== undefined) {
93
+ Romo.trigger(this.targetElem, eventName, eventData);
94
+ } else {
95
+ Romo.trigger(this.elem, eventName, eventData);
96
+ }
97
+ }
118
98
 
119
- var data = this.queuedInvokeData;
120
- this.queuedInvokeData = undefined;
99
+ // event functions
121
100
 
122
- var callUrl = this.elem.attr(this.urlAttr);
123
- if (this.callOnlyOnce === true) {
124
- this.elem.removeAttr(this.urlAttr);
125
- }
126
- if (callUrl !== undefined) {
127
- this.doCall(callUrl, data);
128
- } else {
129
- this._doCompleteInvoke();
101
+ RomoAjax.prototype.romoEvFn._onInvoke = function(e) {
102
+ e.preventDefault();
103
+
104
+ if (Romo.hasClass(this.elem, 'disabled') === false) {
105
+ this.doInvoke();
130
106
  }
131
107
  }
132
108
 
133
- RomoAjax.prototype._trigger = function(event_name, event_data) {
134
- if (this.targetElem[0] !== undefined) {
135
- this.targetElem.trigger(event_name, event_data);
136
- } else {
137
- this.elem.trigger(event_name, event_data);
109
+ RomoAjax.prototype.romoEvFn._onTriggerInvoke = function(e, data) {
110
+ e.stopPropagation();
111
+
112
+ if (Romo.hasClass(this.elem, 'disabled') === false) {
113
+ this.doInvoke(data);
138
114
  }
139
115
  }
140
116
 
141
- Romo.onInitUI(function(e) {
142
- Romo.initUIElems(e, '[data-romo-ajax-auto="true"]').romoAjax();
143
- });
117
+ RomoAjax.prototype.romoEvFn._onCallSuccess = function(data, status, xhr) {
118
+ this._trigger('romoAjax:callSuccess', [data, this]);
119
+ this._completeInvoke();
120
+ }
121
+
122
+ RomoAjax.prototype.romoEvFn._onCallError = function(xhr, errorType, error) {
123
+ this._trigger('romoAjax:callError', [xhr, this]);
124
+ this._completeInvoke();
125
+ }
126
+
127
+ // init
128
+
129
+ Romo.addElemsInitSelector('[data-romo-ajax-auto="true"]', RomoAjax);