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 +4 -4
- data/assets/css/romo/buttons.scss +1 -0
- data/assets/css/romo/modal.scss +5 -0
- data/assets/js/romo/ajax.js +75 -89
- data/assets/js/romo/base.js +699 -274
- data/assets/js/romo/currency_text_input.js +93 -83
- data/assets/js/romo/date.js +3 -3
- data/assets/js/romo/datepicker.js +227 -234
- data/assets/js/romo/dropdown.js +235 -344
- data/assets/js/romo/dropdown_form.js +77 -76
- data/assets/js/romo/form.js +215 -159
- data/assets/js/romo/indicator_text_input.js +64 -95
- data/assets/js/romo/inline.js +66 -59
- data/assets/js/romo/inline_form.js +74 -73
- data/assets/js/romo/modal.js +218 -294
- data/assets/js/romo/modal_form.js +83 -82
- data/assets/js/romo/onkey.js +25 -22
- data/assets/js/romo/option_list_dropdown.js +318 -298
- data/assets/js/romo/picker.js +175 -181
- data/assets/js/romo/select.js +177 -165
- data/assets/js/romo/select_dropdown.js +86 -93
- data/assets/js/romo/selected_options_list.js +66 -76
- data/assets/js/romo/sortable.js +154 -120
- data/assets/js/romo/{indicator.js → spinner.js} +74 -89
- data/assets/js/romo/tooltip.js +257 -271
- data/assets/js/romo/word_boundary_filter.js +7 -10
- data/lib/romo/dassets.rb +1 -1
- data/lib/romo/version.rb +1 -1
- data/test/unit/dassets_tests.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f26940a49cc868326a0fdd6d5d995250d6a48e06
|
4
|
+
data.tar.gz: 35b274e5aecc37282b95a6a400e4cac0ad1685e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5409e3fca1c02e626c6415c083bc5f27e5c0579fbb07639fdd38d6c3cca7abf3127108ca60b6f6f2c55c8687015974d24f1720c0db306053e2b17c8f0890e76
|
7
|
+
data.tar.gz: fcfa1a63a2148aff2d008398070318139e7ec1ffc35349e735367524ab3cd2e1311d51752f966d560012ca7f583d2a2dd3b43e464f07e0596ac4efcc924434bd
|
data/assets/css/romo/modal.scss
CHANGED
data/assets/js/romo/ajax.js
CHANGED
@@ -1,143 +1,129 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
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
|
13
|
-
|
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
|
18
|
-
this.urlAttr = this.elem
|
19
|
-
this.callOnlyOnce = this.elem
|
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.
|
32
|
-
this._trigger('romoAjax:ready', [this]);
|
33
|
-
}
|
22
|
+
this._bindElem();
|
34
23
|
|
35
|
-
|
36
|
-
|
37
|
-
}
|
24
|
+
this._trigger('romoAjax:ready', [this]);
|
25
|
+
});
|
38
26
|
|
39
|
-
RomoAjax.prototype.
|
40
|
-
this.
|
41
|
-
|
42
|
-
|
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
|
-
|
37
|
+
Romo.off(this.elem, this.invokeOn, Romo.proxy(this._onInvoke, this));
|
50
38
|
}
|
51
|
-
this.elem
|
39
|
+
Romo.off(this.elem, 'romoAjax:triggerInvoke', Romo.proxy(this._onTriggerInvoke, this));
|
52
40
|
}
|
53
41
|
|
54
|
-
|
55
|
-
if (e !== undefined) {
|
56
|
-
e.preventDefault();
|
57
|
-
}
|
42
|
+
// private
|
58
43
|
|
59
|
-
|
60
|
-
|
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.
|
65
|
-
|
66
|
-
|
67
|
-
}
|
52
|
+
RomoAjax.prototype._invoke = function() {
|
53
|
+
this.invokeQueued = false;
|
54
|
+
this.invokeRunning = true;
|
68
55
|
|
69
|
-
|
70
|
-
|
71
|
-
}
|
72
|
-
}
|
56
|
+
var data = this.queuedInvokeData;
|
57
|
+
this.queuedInvokeData = undefined;
|
73
58
|
|
74
|
-
|
75
|
-
this.
|
76
|
-
|
77
|
-
|
78
|
-
|
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.
|
70
|
+
RomoAjax.prototype._call = function(callUrl, data) {
|
83
71
|
this._trigger('romoAjax:callStart', [this]);
|
84
72
|
|
85
|
-
|
73
|
+
Romo.ajax({
|
86
74
|
type: this.callMethod,
|
87
75
|
url: callUrl,
|
88
76
|
data: (data || {}),
|
89
|
-
success:
|
90
|
-
error:
|
77
|
+
success: Romo.proxy(this._onCallSuccess, this),
|
78
|
+
error: Romo.proxy(this._onCallError, this)
|
91
79
|
});
|
92
80
|
}
|
93
81
|
|
94
|
-
RomoAjax.prototype.
|
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.
|
85
|
+
this._invoke();
|
110
86
|
} else {
|
111
87
|
this.invokeRunning = false;
|
112
88
|
}
|
113
89
|
}
|
114
90
|
|
115
|
-
RomoAjax.prototype.
|
116
|
-
this.
|
117
|
-
|
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
|
-
|
120
|
-
this.queuedInvokeData = undefined;
|
99
|
+
// event functions
|
121
100
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
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.
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
this.
|
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
|
-
|
142
|
-
|
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);
|