romo 0.18.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/assets/css/romo/base.scss +5 -3
- data/assets/css/romo/indicator_text_input.scss +0 -1
- data/assets/js/romo/base.js +9 -7
- data/assets/js/romo/currency.js +45 -0
- data/assets/js/romo/currency_text_input.js +168 -0
- data/assets/js/romo/datepicker.js +1 -0
- data/assets/js/romo/indicator_text_input.js +36 -7
- data/assets/js/romo/select_dropdown.js +1 -0
- data/assets/js/romo/sortable.js +46 -14
- data/lib/romo/dassets.rb +2 -0
- data/lib/romo/version.rb +1 -1
- data/test/unit/dassets_tests.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: ea1f09e9f40345733333214f4eb518f1683931a0
|
4
|
-
data.tar.gz: c809d3cc92caa7e10c23bc3f8a58f514e6451887
|
5
2
|
SHA512:
|
6
|
-
|
7
|
-
|
3
|
+
data.tar.gz: 50cbf6926495cdfb0d4f37c8de78223765e090f8a8776ce411f6d82d98a7194bbd0ebd2f75a6c50632018e36f31590794844fa24b327056c4a94215f3a9dcd90
|
4
|
+
metadata.gz: 98362f39c7531bce3483f67ee32f6b5cbd5d2891ddff83af346a313b1f2b45a7fda4c097bd22d61fc2b8433f67891f11799f53d403a86130a691b982f0b0f212
|
5
|
+
SHA1:
|
6
|
+
data.tar.gz: cad251f2088b1bee923e9f1309edc208ef893721
|
7
|
+
metadata.gz: 77d4306dc8c5de5e50c12e15c7089f0b78d5380a
|
data/assets/css/romo/base.scss
CHANGED
@@ -101,7 +101,7 @@ a.romo-text {
|
|
101
101
|
/* images */
|
102
102
|
|
103
103
|
.romo-img-rounded { @include border-radius(6px); }
|
104
|
-
.romo-img-circle { @include border-radius(
|
104
|
+
.romo-img-circle { @include border-radius(50%); }
|
105
105
|
.romo-img-card {
|
106
106
|
padding: 3px;
|
107
107
|
background-color: $baseBgColor;
|
@@ -435,8 +435,10 @@ h3 { @include text1; }
|
|
435
435
|
.romo-border2-bottom-left-radius-hover:hover { @include border2-bottom-left-radius(!important); }
|
436
436
|
.romo-rm-border-bottom-left-radius-hover:hover { @include rm-border-bottom-left-radius(!important); }
|
437
437
|
|
438
|
-
.romo-border-radius-circle
|
439
|
-
.romo-border-radius-circle-hover:hover { @include border-radius(
|
438
|
+
.romo-border-radius-circle { @include border-radius(50%); }
|
439
|
+
.romo-border-radius-circle-hover:hover { @include border-radius(50%); }
|
440
|
+
.romo-border-radius-pill { @include border-radius(500px); }
|
441
|
+
.romo-border-radius-pill-hover:hover { @include border-radius(500px); }
|
440
442
|
|
441
443
|
/* spacing */
|
442
444
|
|
data/assets/js/romo/base.js
CHANGED
@@ -275,7 +275,7 @@ var RomoParentChildElems = function() {
|
|
275
275
|
this.elemId = 0;
|
276
276
|
this.elems = {};
|
277
277
|
|
278
|
-
var
|
278
|
+
var parentRemovedObserver = new MutationObserver($.proxy(function(mutationRecords) {
|
279
279
|
mutationRecords.forEach($.proxy(function(mutationRecord) {
|
280
280
|
if (mutationRecord.type === 'childList' && mutationRecord.removedNodes.length > 0) {
|
281
281
|
$.each($(mutationRecord.removedNodes), $.proxy(function(idx, node) {
|
@@ -285,7 +285,7 @@ var RomoParentChildElems = function() {
|
|
285
285
|
}, this));
|
286
286
|
}, this));
|
287
287
|
|
288
|
-
|
288
|
+
parentRemovedObserver.observe($('body')[0], {
|
289
289
|
childList: true,
|
290
290
|
subtree: true
|
291
291
|
});
|
@@ -296,12 +296,14 @@ RomoParentChildElems.prototype.add = function(parentElem, childElems) {
|
|
296
296
|
}
|
297
297
|
|
298
298
|
RomoParentChildElems.prototype.remove = function(nodeElem) {
|
299
|
-
if(nodeElem.data(
|
300
|
-
this.
|
299
|
+
if (nodeElem.data('romo-parent-removed-observer-disabled') !== true) {
|
300
|
+
if (nodeElem.data(this.attrName) !== undefined) {
|
301
|
+
this._removeChildElems(nodeElem); // node is a parent elem itself
|
302
|
+
}
|
303
|
+
$.each(nodeElem.find('[data-'+this.attrName+']'), $.proxy(function(idx, parent) {
|
304
|
+
this._removeChildElems($(parent));
|
305
|
+
}, this));
|
301
306
|
}
|
302
|
-
$.each(nodeElem.find('[data-'+this.attrName+']'), $.proxy(function(idx, parent) {
|
303
|
-
this._removeChildElems($(parent));
|
304
|
-
}, this));
|
305
307
|
}
|
306
308
|
|
307
309
|
// private
|
@@ -0,0 +1,45 @@
|
|
1
|
+
var RomoCurrency = {
|
2
|
+
|
3
|
+
format: function(numberString, opts) {
|
4
|
+
var unFormattedString = RomoCurrency.unFormat(numberString);
|
5
|
+
if (unFormattedString === '') {
|
6
|
+
return '';
|
7
|
+
}
|
8
|
+
|
9
|
+
opts = opts || {};
|
10
|
+
var symbol = opts.symbol || '';
|
11
|
+
var thousandsDelim = opts.thousandsDelm || ',';
|
12
|
+
var decimalDelim = opts.decimalDelim || '.';
|
13
|
+
var numDecimalPlaces = opts.numDecimalPlaces || 2;
|
14
|
+
|
15
|
+
var number = Number(unFormattedString);
|
16
|
+
var negative = number < 0 ? '-' : '';
|
17
|
+
var u_d = Math.abs(number).toFixed(numDecimalPlaces).split('.');
|
18
|
+
var units = (u_d[0] || '').replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1"+thousandsDelim);
|
19
|
+
var decimals = u_d[1] || '';
|
20
|
+
|
21
|
+
return symbol+negative+units+decimalDelim+decimals;
|
22
|
+
},
|
23
|
+
|
24
|
+
unFormat: function(currencyString, opts) {
|
25
|
+
if (currencyString === undefined || currencyString === '') {
|
26
|
+
return '';
|
27
|
+
}
|
28
|
+
|
29
|
+
var numString = currencyString.replace(/[^0-9\.\-]+/g,"");
|
30
|
+
if (numString === '') {
|
31
|
+
return '';
|
32
|
+
}
|
33
|
+
|
34
|
+
var num = Number(numString);
|
35
|
+
if (isNaN(num)) {
|
36
|
+
return '';
|
37
|
+
} else {
|
38
|
+
opts = opts || {};
|
39
|
+
var numDecimalPlaces = opts.numDecimalPlaces || 2;
|
40
|
+
|
41
|
+
return num.toFixed(numDecimalPlaces);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
}
|
@@ -0,0 +1,168 @@
|
|
1
|
+
$.fn.romoCurrencyTextInput = function() {
|
2
|
+
return $.map(this, function(element) {
|
3
|
+
return new RomoCurrencyTextInput(element);
|
4
|
+
});
|
5
|
+
}
|
6
|
+
|
7
|
+
var RomoCurrencyTextInput = function(element) {
|
8
|
+
this.elem = $(element);
|
9
|
+
this.hiddenInputElem = undefined;
|
10
|
+
|
11
|
+
this.defaultIndicatorPosition = 'left';
|
12
|
+
this.defaultInputNameSuffix = "romo-currency-display"
|
13
|
+
this.defaultFormatThousandsDelim = ',';
|
14
|
+
this.defaultFormatDecimalDelim = '.';
|
15
|
+
this.defaultFormatNumDecimalPlaces = 2;
|
16
|
+
|
17
|
+
this.doInit();
|
18
|
+
this.doBindElem();
|
19
|
+
|
20
|
+
this.elem.trigger('romoCurrencyTextInput:ready', [this]);
|
21
|
+
}
|
22
|
+
|
23
|
+
RomoCurrencyTextInput.prototype.doInit = function() {
|
24
|
+
// override as needed
|
25
|
+
}
|
26
|
+
|
27
|
+
RomoCurrencyTextInput.prototype.doBindElem = function() {
|
28
|
+
this.doBindIndicatorTextInput();
|
29
|
+
|
30
|
+
this.hiddenInputElem = this._getHiddenInputElem();
|
31
|
+
this.elem.before(this.hiddenInputElem);
|
32
|
+
this.elem.attr('name', this._getNewInputName());
|
33
|
+
|
34
|
+
this.elem.on('change', $.proxy(function(e) {
|
35
|
+
this.doUpdateInputValue();
|
36
|
+
}, this));
|
37
|
+
this.elem.on('romoCurrencyTextInput:triggerUpdateInputValue', $.proxy(function(e) {
|
38
|
+
this.doUpdateInputValue();
|
39
|
+
}, this));
|
40
|
+
|
41
|
+
this.doUpdateInputValue();
|
42
|
+
}
|
43
|
+
|
44
|
+
RomoCurrencyTextInput.prototype.doUpdateInputValue = function() {
|
45
|
+
var unFormattedValue = this._unFormatCurrencyValue(this.elem.val());
|
46
|
+
this.hiddenInputElem.val(unFormattedValue);
|
47
|
+
if (this.elem.data('romo-currency-text-input-format-for-currency') !== false) {
|
48
|
+
this.elem.val(this._formatCurrencyValue(unFormattedValue));
|
49
|
+
} else {
|
50
|
+
this.elem.val(unFormattedValue);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
RomoCurrencyTextInput.prototype.doSetValue = function(value) {
|
55
|
+
this.elem.val(value);
|
56
|
+
this.doUpdateInputValue();
|
57
|
+
}
|
58
|
+
|
59
|
+
RomoCurrencyTextInput.prototype.doBindIndicatorTextInput = function() {
|
60
|
+
this.elem.attr(
|
61
|
+
'data-romo-indicator-text-input-indicator-position',
|
62
|
+
this.elem.data('romo-currency-text-input-indicator-position') || this.defaultIndicatorPosition
|
63
|
+
);
|
64
|
+
|
65
|
+
if (this.elem.data('romo-currency-text-input-indicator') !== undefined) {
|
66
|
+
this.elem.attr(
|
67
|
+
'data-romo-indicator-text-input-indicator',
|
68
|
+
this.elem.data('romo-currency-text-input-indicator')
|
69
|
+
);
|
70
|
+
}
|
71
|
+
if (this.elem.data('romo-currency-text-input-indicator-width-px') !== undefined) {
|
72
|
+
this.elem.attr(
|
73
|
+
'data-romo-indicator-text-input-indicator-width-px',
|
74
|
+
this.elem.data('romo-currency-text-input-indicator-width-px')
|
75
|
+
);
|
76
|
+
}
|
77
|
+
if (this.elem.data('romo-currency-text-input-indicator-padding-px') !== undefined) {
|
78
|
+
this.elem.attr(
|
79
|
+
'data-romo-indicator-text-input-indicator-padding-px',
|
80
|
+
this.elem.data('romo-currency-text-input-indicator-padding-px')
|
81
|
+
);
|
82
|
+
}
|
83
|
+
if (this.elem.data('romo-currency-text-input-elem-display') !== undefined) {
|
84
|
+
this.elem.attr(
|
85
|
+
'data-romo-indicator-text-input-elem-display',
|
86
|
+
this.elem.data('romo-currency-text-input-elem-display')
|
87
|
+
);
|
88
|
+
}
|
89
|
+
if (this.elem.data('romo-currency-text-input-btn-group') !== undefined) {
|
90
|
+
this.elem.attr(
|
91
|
+
'data-romo-indicator-text-input-btn-group',
|
92
|
+
this.elem.data('romo-currency-text-input-btn-group')
|
93
|
+
);
|
94
|
+
}
|
95
|
+
|
96
|
+
this.elem.on('indicatorTextInput:indicatorClick', $.proxy(function(e) {
|
97
|
+
this.elem.trigger('romoCurrencyTextInput:indicatorClick', []);
|
98
|
+
}, this));
|
99
|
+
|
100
|
+
this.elem.on('romoCurrencyTextInput:triggerPlaceIndicator', $.proxy(function(e) {
|
101
|
+
this.elem.trigger('indicatorTextInput:triggerPlaceIndicator', []);
|
102
|
+
}, this));
|
103
|
+
this.elem.on('romoCurrencyTextInput:triggerEnable', $.proxy(function(e) {
|
104
|
+
this.elem.trigger('indicatorTextInput:triggerEnable', []);
|
105
|
+
}, this));
|
106
|
+
this.elem.on('romoCurrencyTextInput:triggerDisable', $.proxy(function(e) {
|
107
|
+
this.elem.trigger('indicatorTextInput:triggerDisable', []);
|
108
|
+
}, this));
|
109
|
+
this.elem.on('romoCurrencyTextInput:triggerShow', $.proxy(function(e) {
|
110
|
+
this.elem.trigger('indicatorTextInput:triggerShow', []);
|
111
|
+
}, this));
|
112
|
+
this.elem.on('romoCurrencyTextInput:triggerHide', $.proxy(function(e) {
|
113
|
+
this.elem.trigger('indicatorTextInput:triggerHide', []);
|
114
|
+
}, this));
|
115
|
+
|
116
|
+
this.elem.romoIndicatorTextInput();
|
117
|
+
}
|
118
|
+
|
119
|
+
// private
|
120
|
+
|
121
|
+
RomoCurrencyTextInput.prototype._formatCurrencyValue = function(sanitizedValue) {
|
122
|
+
return RomoCurrency.format(sanitizedValue, {
|
123
|
+
'thousandsDelim': this._getFormatThousandsDelim(),
|
124
|
+
'decimalDelim': this._getFormatDecimalDelim(),
|
125
|
+
'numDecimalPlaces': this._getFormatNumDecimalPlaces()
|
126
|
+
});
|
127
|
+
}
|
128
|
+
|
129
|
+
RomoCurrencyTextInput.prototype._unFormatCurrencyValue = function(inputValue) {
|
130
|
+
return RomoCurrency.unFormat(inputValue, {
|
131
|
+
'numDecimalPlaces': this._getFormatNumDecimalPlaces()
|
132
|
+
});
|
133
|
+
}
|
134
|
+
|
135
|
+
RomoCurrencyTextInput.prototype._getFormatThousandsDelim = function() {
|
136
|
+
return (
|
137
|
+
this.elem.data('romo-currency-text-input-format-thousands-delim') ||
|
138
|
+
this.defaultFormatThousandsDelim
|
139
|
+
);
|
140
|
+
}
|
141
|
+
|
142
|
+
RomoCurrencyTextInput.prototype._getFormatDecimalDelim = function() {
|
143
|
+
return (
|
144
|
+
this.elem.data('romo-currency-text-input-format-decimal-delim') ||
|
145
|
+
this.defaultFormatDecimalDelim
|
146
|
+
);
|
147
|
+
}
|
148
|
+
|
149
|
+
RomoCurrencyTextInput.prototype._getFormatNumDecimalPlaces = function() {
|
150
|
+
var places = this.elem.data('romo-currency-text-input-format-num-decimal-places');
|
151
|
+
return !isNaN(places = Math.abs(places)) ? places : this.defaultFormatNumDecimalPlaces;
|
152
|
+
}
|
153
|
+
|
154
|
+
RomoCurrencyTextInput.prototype._getHiddenInputElem = function() {
|
155
|
+
return $('<input type="hidden" name="'+this.elem.attr('name')+'" value="'+this.elem.val()+'">');;
|
156
|
+
}
|
157
|
+
|
158
|
+
RomoCurrencyTextInput.prototype._getNewInputName = function() {
|
159
|
+
return (
|
160
|
+
this.elem.attr('name')+
|
161
|
+
'-'+
|
162
|
+
(this.elem.data('romo-currency-text-input-name-suffix') || this.defaultInputNameSuffix)
|
163
|
+
);
|
164
|
+
}
|
165
|
+
|
166
|
+
Romo.onInitUI(function(e) {
|
167
|
+
Romo.initUIElems(e, '[data-romo-currency-text-input-auto="true"]').romoCurrencyTextInput();
|
168
|
+
});
|
@@ -32,6 +32,7 @@ RomoDatepicker.prototype.doInit = function() {
|
|
32
32
|
|
33
33
|
RomoDatepicker.prototype.doBindElem = function() {
|
34
34
|
this.elem.attr('autocomplete', 'off');
|
35
|
+
this.elem.attr('data-romo-indicator-text-input-indicator-position', "right");
|
35
36
|
|
36
37
|
if (this.elem.data('romo-datepicker-indicator') !== undefined) {
|
37
38
|
this.elem.attr('data-romo-indicator-text-input-indicator', this.elem.data('romo-datepicker-indicator'));
|
@@ -6,8 +6,10 @@ $.fn.romoIndicatorTextInput = function() {
|
|
6
6
|
|
7
7
|
var RomoIndicatorTextInput = function(element) {
|
8
8
|
this.elem = $(element);
|
9
|
-
|
10
|
-
this.
|
9
|
+
|
10
|
+
this.defaultIndicatorClass = undefined;
|
11
|
+
this.defaultIndicatorPaddingPx = 5;
|
12
|
+
this.defaultIndicatorPosition = 'right';
|
11
13
|
|
12
14
|
this.doInit();
|
13
15
|
this.doBindElem();
|
@@ -75,12 +77,18 @@ RomoIndicatorTextInput.prototype.doPlaceIndicatorElem = function() {
|
|
75
77
|
this._hide(this.indicatorElem);
|
76
78
|
}
|
77
79
|
|
78
|
-
var
|
79
|
-
|
80
|
+
var indicatorPaddingPx = this._getIndicatorPaddingPx();
|
81
|
+
var indicatorWidthPx = this._getIndicatorWidthPx();
|
82
|
+
var indicatorPosition = this._getIndicatorPosition();
|
83
|
+
|
84
|
+
// add a pixel to account for the default input border
|
85
|
+
this.indicatorElem.css(indicatorPosition, indicatorPaddingPx+1);
|
86
|
+
|
87
|
+
// left-side padding
|
80
88
|
// + indicator width
|
81
|
-
// + right-side
|
82
|
-
var
|
83
|
-
this.elem.css(
|
89
|
+
// + right-side padding
|
90
|
+
var inputPaddingPx = indicatorPaddingPx + indicatorWidthPx + indicatorPaddingPx;
|
91
|
+
this.elem.css('padding-'+indicatorPosition, inputPaddingPx+'px');
|
84
92
|
}
|
85
93
|
}
|
86
94
|
|
@@ -128,6 +136,27 @@ RomoIndicatorTextInput.prototype._hide = function(elem) {
|
|
128
136
|
elem.css('display', 'none');
|
129
137
|
}
|
130
138
|
|
139
|
+
RomoIndicatorTextInput.prototype._getIndicatorPaddingPx = function() {
|
140
|
+
return (
|
141
|
+
this.elem.data('romo-indicator-text-input-indicator-padding-px') ||
|
142
|
+
this.defaultIndicatorPaddingPx
|
143
|
+
);
|
144
|
+
}
|
145
|
+
|
146
|
+
RomoIndicatorTextInput.prototype._getIndicatorWidthPx = function() {
|
147
|
+
return (
|
148
|
+
this.elem.data('romo-indicator-text-input-indicator-width-px') ||
|
149
|
+
parseInt(Romo.getComputedStyle(this.indicatorElem[0], "width"), 10)
|
150
|
+
);
|
151
|
+
}
|
152
|
+
|
153
|
+
RomoIndicatorTextInput.prototype._getIndicatorPosition = function() {
|
154
|
+
return (
|
155
|
+
this.elem.data('romo-indicator-text-input-indicator-position') ||
|
156
|
+
this.defaultIndicatorPosition
|
157
|
+
);
|
158
|
+
}
|
159
|
+
|
131
160
|
Romo.onInitUI(function(e) {
|
132
161
|
Romo.initUIElems(e, '[data-romo-indicator-text-input-auto="true"]').romoIndicatorTextInput();
|
133
162
|
});
|
@@ -385,6 +385,7 @@ RomoSelectDropdown.prototype._buildOptionFilter = function() {
|
|
385
385
|
filter.attr('placeholder', this.elem.data('romo-select-dropdown-filter-placeholder'));
|
386
386
|
}
|
387
387
|
filter.attr('data-romo-indicator-text-input-elem-display', "block");
|
388
|
+
filter.attr('data-romo-indicator-text-input-indicator-position', "right");
|
388
389
|
if (this.elem.data('romo-select-dropdown-filter-indicator') !== undefined) {
|
389
390
|
filter.attr('data-romo-indicator-text-input-indicator', this.elem.data('romo-select-dropdown-filter-indicator'));
|
390
391
|
}
|
data/assets/js/romo/sortable.js
CHANGED
@@ -14,7 +14,7 @@ var RomoSortable = function(element) {
|
|
14
14
|
this.draggedOverElem = this.dragDirection = this.lastY = null;
|
15
15
|
|
16
16
|
this.doInit();
|
17
|
-
this.
|
17
|
+
this.doBindDrag();
|
18
18
|
this.doInitPlaceholder();
|
19
19
|
this._resetGrabClasses();
|
20
20
|
|
@@ -25,30 +25,43 @@ RomoSortable.prototype.doInit = function() {
|
|
25
25
|
// override as needed
|
26
26
|
}
|
27
27
|
|
28
|
-
RomoSortable.prototype.
|
28
|
+
RomoSortable.prototype.doBindDrag = function() {
|
29
29
|
this.draggingClass = this.elem.data('romo-sortable-dragging-class') || '';
|
30
30
|
this.dragOverClass = this.elem.data('romo-sortable-dragover-class') || '';
|
31
31
|
this.placeholderClass = this.elem.data('romo-sortable-placeholder-class') || '';
|
32
32
|
|
33
|
-
this.draggableElems =
|
34
|
-
this.
|
33
|
+
this.draggableElems = $();
|
34
|
+
this.doBindDraggableElems(this.elem.find(this.draggableSelector));
|
35
|
+
|
36
|
+
this.elem.on('sortable:bindDraggableElems', $.proxy(this.onBindDraggableElems, this));
|
35
37
|
|
36
38
|
this.elem.on('dragenter', $.proxy(this.onDragEnter, this));
|
37
39
|
this.elem.on('dragover', $.proxy(this.onDragOver, this));
|
38
40
|
this.elem.on('dragend', $.proxy(this.onDragEnd, this));
|
39
41
|
this.elem.on('drop', $.proxy(this.onDragDrop, this));
|
40
42
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
this.draggableElems
|
46
|
-
|
43
|
+
$('body').on('mouseup', $.proxy(this.onWindowBodyMouseUp, this));
|
44
|
+
}
|
45
|
+
|
46
|
+
RomoSortable.prototype.onBindDraggableElems = function(e, draggableElems) {
|
47
|
+
this.doBindDraggableElems(draggableElems);
|
48
|
+
}
|
49
|
+
|
50
|
+
RomoSortable.prototype.doBindDraggableElems = function(draggableElems) {
|
51
|
+
draggableElems.prop('draggable', 'true');
|
52
|
+
|
53
|
+
draggableElems.on('dragstart', $.proxy(this.onDragStart, this));
|
54
|
+
draggableElems.on('dragenter', $.proxy(this.onDragEnter, this));
|
55
|
+
draggableElems.on('dragover', $.proxy(this.onDragOver, this));
|
56
|
+
draggableElems.on('dragend', $.proxy(this.onDragEnd, this));
|
57
|
+
draggableElems.on('drop', $.proxy(this.onDragDrop, this));
|
58
|
+
draggableElems.on('mousedown', $.proxy(this.onDraggableMouseDown, this));
|
47
59
|
|
48
|
-
var handleElems =
|
60
|
+
var handleElems = draggableElems.find(this.handleSelector);
|
49
61
|
handleElems.on('mousedown', $.proxy(this.onHandleMouseDown, this));
|
50
62
|
|
51
|
-
|
63
|
+
this.draggableElems = this.draggableElems.add(draggableElems);
|
64
|
+
this._resetGrabClasses();
|
52
65
|
}
|
53
66
|
|
54
67
|
RomoSortable.prototype.doInitPlaceholder = function() {
|
@@ -79,6 +92,18 @@ RomoSortable.prototype.onDragStart = function(e) {
|
|
79
92
|
|
80
93
|
this.draggedElem = $(e.target);
|
81
94
|
this.draggedElem.addClass(this.draggingClass);
|
95
|
+
|
96
|
+
// we need to disable Romo's parentRemovedObserver mutation
|
97
|
+
// observer which would remove any child elems (ie modal,
|
98
|
+
// dropdown, tooltip popups).
|
99
|
+
// we don't want any child elems of the draggedElem removed
|
100
|
+
// just b/c it is temporarily removed from the DOM due to
|
101
|
+
// it being dragged. It will be returned to the DOM once
|
102
|
+
// the drag is finished.
|
103
|
+
// we manually enable the mutation observer for the dragged
|
104
|
+
// elem below after we do the `insertBefore` call.
|
105
|
+
this.draggedElem.data('romo-parent-removed-observer-disabled', true);
|
106
|
+
|
82
107
|
this.draggedIndex = this.draggedElem.index();
|
83
108
|
|
84
109
|
this.placeholderElem.css({ 'height': this.draggedElem.height() });
|
@@ -160,6 +185,15 @@ RomoSortable.prototype.onDragDrop = function(e) {
|
|
160
185
|
this.draggedElem.insertBefore(this.placeholderElem);
|
161
186
|
this.draggedElem.show();
|
162
187
|
|
188
|
+
// manually enable Romo's parentRemovedObserver mutation
|
189
|
+
// observer which resumes removing any child elems (ie modal,
|
190
|
+
// dropdown, tooltip popups) like normal.
|
191
|
+
// we have to put this in a timeout so the reactor loop has a
|
192
|
+
// chance to run the mutation observer before we re-enable
|
193
|
+
setTimeout($.proxy(function() {
|
194
|
+
this.draggedElem.data('romo-parent-removed-observer-disabled', false);
|
195
|
+
}, this), 1);
|
196
|
+
|
163
197
|
var newIndex = this.draggedElem.index();
|
164
198
|
if (newIndex !== this.draggedIndex) {
|
165
199
|
this.elem.trigger('sortable:change', [this.draggedElem, this]);
|
@@ -191,13 +225,11 @@ RomoSortable.prototype.onWindowBodyMouseUp = function(e) {
|
|
191
225
|
|
192
226
|
RomoSortable.prototype._resetGrabClasses = function() {
|
193
227
|
this.draggableElems.each($.proxy(function(index, item) {
|
194
|
-
|
195
228
|
draggableElem = $(item);
|
196
229
|
handleElem = draggableElem.find(this.handleSelector);
|
197
230
|
if(handleElem.size() === 0){ handleElem = draggableElem; }
|
198
231
|
handleElem.addClass('romo-sortable-grab');
|
199
232
|
handleElem.removeClass('romo-sortable-grabbing');
|
200
|
-
|
201
233
|
}, this));
|
202
234
|
}
|
203
235
|
|
data/lib/romo/dassets.rb
CHANGED
@@ -45,6 +45,7 @@ module Romo::Dassets
|
|
45
45
|
c.combination "js/romo.js", [
|
46
46
|
'js/romo/base.js',
|
47
47
|
'js/romo/date.js',
|
48
|
+
'js/romo/currency.js',
|
48
49
|
'js/romo/word_boundary_filter.js',
|
49
50
|
'js/romo/ajax.js',
|
50
51
|
'js/romo/onkey.js',
|
@@ -52,6 +53,7 @@ module Romo::Dassets
|
|
52
53
|
'js/romo/dropdown.js',
|
53
54
|
'js/romo/dropdown_form.js',
|
54
55
|
'js/romo/indicator_text_input.js',
|
56
|
+
'js/romo/currency_text_input.js',
|
55
57
|
'js/romo/select_dropdown.js',
|
56
58
|
'js/romo/select.js',
|
57
59
|
'js/romo/datepicker.js',
|
data/lib/romo/version.rb
CHANGED
data/test/unit/dassets_tests.rb
CHANGED
@@ -47,6 +47,7 @@ module Romo::Dassets
|
|
47
47
|
exp_js_sources = [
|
48
48
|
'js/romo/base.js',
|
49
49
|
'js/romo/date.js',
|
50
|
+
'js/romo/currency.js',
|
50
51
|
'js/romo/word_boundary_filter.js',
|
51
52
|
'js/romo/ajax.js',
|
52
53
|
'js/romo/onkey.js',
|
@@ -54,6 +55,7 @@ module Romo::Dassets
|
|
54
55
|
'js/romo/dropdown.js',
|
55
56
|
'js/romo/dropdown_form.js',
|
56
57
|
'js/romo/indicator_text_input.js',
|
58
|
+
'js/romo/currency_text_input.js',
|
57
59
|
'js/romo/select_dropdown.js',
|
58
60
|
'js/romo/select.js',
|
59
61
|
'js/romo/datepicker.js',
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: romo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.18.
|
4
|
+
version: 0.18.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Redding
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2017-01-
|
13
|
+
date: 2017-01-23 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: assert
|
@@ -80,6 +80,8 @@ files:
|
|
80
80
|
- assets/css/romo/z_index.scss
|
81
81
|
- assets/js/romo/ajax.js
|
82
82
|
- assets/js/romo/base.js
|
83
|
+
- assets/js/romo/currency.js
|
84
|
+
- assets/js/romo/currency_text_input.js
|
83
85
|
- assets/js/romo/date.js
|
84
86
|
- assets/js/romo/datepicker.js
|
85
87
|
- assets/js/romo/dropdown.js
|