ende 0.2.21 → 0.3.0
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 +4 -4
- data/lib/assets/javascripts/aura/extensions/mask.js.coffee +125 -0
- data/lib/assets/javascripts/aura/extensions/rivets.js.coffee +1 -1
- data/lib/assets/javascripts/widgets/content/main.js.coffee +4 -4
- data/lib/assets/javascripts/widgets/viewer/main.js.coffee +7 -5
- data/lib/ende/version.rb +1 -1
- data/vendor/assets/javascripts/jquery/inputmask.extensions.js +122 -0
- data/vendor/assets/javascripts/jquery/inputmask.js +1613 -0
- data/vendor/assets/javascripts/jquery/inputmask.numeric.extensions.js +177 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 428726f81f06f7cf6d296ed436b4ad4c3ea396d3
|
4
|
+
data.tar.gz: 09dd3babe623240a882f57c0f7c3246c7fc5041a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 021df6a443cb387cbfa1610266f7cd8ab6c66bc60f4f629b1b4d234ecc0b1f45505abe97490eadba4a27dae0934a60bde2e8d2529d906fd1df5eb29b5fe47c77
|
7
|
+
data.tar.gz: 90458b021186087b3e506d092d1c183b543dd1a5a0290338f2ccd4ab21f8688157e3873124a823238458bd9c18aa82bbc6c234dee3ac177f77710117787280ff
|
@@ -0,0 +1,125 @@
|
|
1
|
+
#= require 'jquery/inputmask'
|
2
|
+
#= require 'jquery/inputmask.extensions'
|
3
|
+
#= require 'jquery/inputmask.numeric.extensions'
|
4
|
+
|
5
|
+
$.extend $.inputmask.defaults.aliases.integer,
|
6
|
+
groupSeparator : '.'
|
7
|
+
autoGroup : true
|
8
|
+
autoUnmask : true
|
9
|
+
|
10
|
+
$.extend $.inputmask.defaults.aliases.decimal,
|
11
|
+
groupSeparator : '.'
|
12
|
+
radixPoint : ','
|
13
|
+
autoGroup : true
|
14
|
+
autoUnmask : true
|
15
|
+
|
16
|
+
|
17
|
+
$.extend $.inputmask.defaults.aliases,
|
18
|
+
price:
|
19
|
+
alias : 'decimal'
|
20
|
+
digits : 2
|
21
|
+
allowMinus : false
|
22
|
+
allowPlus : false
|
23
|
+
|
24
|
+
plate:
|
25
|
+
mask : 'AAA-9999'
|
26
|
+
|
27
|
+
meters:
|
28
|
+
alias : 'integer'
|
29
|
+
allowMinus : false
|
30
|
+
allowPlus : false
|
31
|
+
integerDigits : 6
|
32
|
+
|
33
|
+
cpf:
|
34
|
+
mask : '999.999.999-99'
|
35
|
+
|
36
|
+
cnpj:
|
37
|
+
mask : '99.999.999/9999-99'
|
38
|
+
|
39
|
+
phone:
|
40
|
+
mask : '(99) 9999[9]-9999'
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
define 'aura/extensions/mask', (mask) ->
|
45
|
+
|
46
|
+
'use strict'
|
47
|
+
|
48
|
+
|
49
|
+
(application) ->
|
50
|
+
|
51
|
+
|
52
|
+
mask = (selector, mask, options) ->
|
53
|
+
$(selector).inputmask mask, options
|
54
|
+
|
55
|
+
|
56
|
+
# version: '0.1.0'
|
57
|
+
|
58
|
+
initialize: (application) ->
|
59
|
+
application.sandbox.ui.mask = mask
|
60
|
+
|
61
|
+
afterAppStart: (application) ->
|
62
|
+
#
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
#
|
70
|
+
#
|
71
|
+
#
|
72
|
+
#
|
73
|
+
# # TODO Remove .call null
|
74
|
+
# # TODO Remove .call null
|
75
|
+
# loader.require.call null, 'modernizr'
|
76
|
+
# loader.require.call null, 'ened/vendor/assets/javascripts/lennon/lennon.js'
|
77
|
+
# query = loader.require.call null, 'querystring'
|
78
|
+
# router = null
|
79
|
+
#
|
80
|
+
# # TODO rename to router stationg
|
81
|
+
# (application) ->
|
82
|
+
# core = application.core
|
83
|
+
# mediator = core.mediator
|
84
|
+
#
|
85
|
+
# # TODO unify router api
|
86
|
+
# router = new Lennon
|
87
|
+
# # TODO implement logger api for lennon or change lennon library
|
88
|
+
# # logger: application.logger
|
89
|
+
# publishEvent: (name, params) ->
|
90
|
+
#
|
91
|
+
# current_route = window.location.href
|
92
|
+
# if router.last_route != current_route
|
93
|
+
# mediator.emit 'route.changed'
|
94
|
+
# router.last_route = current_route
|
95
|
+
#
|
96
|
+
# # TODO method parsing (get, delete, put, post)
|
97
|
+
# mediator.emit name, params
|
98
|
+
#
|
99
|
+
# router.location = (href, process = true) ->
|
100
|
+
# if Modernizr.history
|
101
|
+
# window.history.pushState null, null, href
|
102
|
+
# else
|
103
|
+
# # TODO parse href and extract path!
|
104
|
+
# window.location.hash = href
|
105
|
+
#
|
106
|
+
# process and router.process()
|
107
|
+
#
|
108
|
+
#
|
109
|
+
# application.core.router = router
|
110
|
+
#
|
111
|
+
# location = Object.create null,
|
112
|
+
# # TODO cache query parsing
|
113
|
+
# query:
|
114
|
+
# get: -> query.parse window.location.search.substring(1)
|
115
|
+
#
|
116
|
+
# toString: -> window.location
|
117
|
+
#
|
118
|
+
# version: '0.2.1'
|
119
|
+
#
|
120
|
+
# initialize: (application) ->
|
121
|
+
# application.sandbox.ui.mask = mask
|
122
|
+
#
|
123
|
+
# afterAppStart: (application) ->
|
124
|
+
# router.process()
|
125
|
+
#
|
@@ -212,7 +212,7 @@ define 'aura/extensions/rivets', ->
|
|
212
212
|
el.value = if value? then value else ''
|
213
213
|
|
214
214
|
# TODO isntall formatters from the external custom formatters repo
|
215
|
-
rivets.formatters.is ||= (
|
215
|
+
rivets.formatters.is ||= (one, other) -> one == other
|
216
216
|
|
217
217
|
rivets.formatters.float ||= (value) ->
|
218
218
|
throw new TypeError "Invalid value passed to float formatter: #{value}" unless value?
|
@@ -38,11 +38,11 @@ define ->
|
|
38
38
|
|
39
39
|
# TODO move to handlers
|
40
40
|
load: (options) ->
|
41
|
-
|
42
|
-
|
41
|
+
|
43
42
|
# TODO move to anoter method
|
44
43
|
if @loads > 0
|
45
|
-
@
|
44
|
+
_.invoke @sandbox._children, 'stop' if @sandbox._children?.length
|
45
|
+
@$el.html ''
|
46
46
|
|
47
47
|
@loading?.abort()
|
48
48
|
@spinner?.stop()
|
@@ -53,7 +53,7 @@ define ->
|
|
53
53
|
@spinner = @sandbox.ui.loader @$el
|
54
54
|
@$el.addClass "loading"
|
55
55
|
@$el.removeClass "idle"
|
56
|
-
|
56
|
+
|
57
57
|
|
58
58
|
# TODO remove jQuery dependency
|
59
59
|
@loading = $.ajax(@request_options options).done(@loaded).fail(@failed).always(@ended)
|
@@ -161,9 +161,11 @@ define [
|
|
161
161
|
@repopulate()
|
162
162
|
|
163
163
|
repopulate: ->
|
164
|
-
|
164
|
+
unless @fetching?
|
165
165
|
@load.stop()
|
166
166
|
@load = null
|
167
|
+
else
|
168
|
+
@fetching?.abort()
|
167
169
|
|
168
170
|
# TODO store spinner instance, instead of creating a new one every time
|
169
171
|
unless @load?
|
@@ -173,12 +175,12 @@ define [
|
|
173
175
|
@$el.addClass 'idle'
|
174
176
|
@$el.removeClass 'loading'
|
175
177
|
|
176
|
-
viewer = @presentation
|
178
|
+
{viewer} = @presentation
|
177
179
|
|
178
180
|
# ✔ Generalize this filtering option
|
179
181
|
# TODO make scope.all method use scope too, and replace @scope.fetch by it
|
180
182
|
options = @options # TODO better options accessing
|
181
|
-
|
183
|
+
@fetching = @scope.fetch null, (records) =>
|
182
184
|
|
183
185
|
# TODO instantiate records before calling this callback
|
184
186
|
records = _.map records, @resource, @resource unless records[0]?.resource or records[0]?.itemable
|
@@ -187,7 +189,7 @@ define [
|
|
187
189
|
# use it here instead of pushing each record
|
188
190
|
viewer.items = records
|
189
191
|
|
190
|
-
|
192
|
+
@fetching.then (records) =>
|
191
193
|
if viewer.items.length
|
192
194
|
# boo.initialize @$el.find '.results .items'
|
193
195
|
@$el.addClass 'filled'
|
@@ -199,7 +201,7 @@ define [
|
|
199
201
|
|
200
202
|
@sandbox.emit "viewer.#{@identifier}.populated", records
|
201
203
|
|
202
|
-
|
204
|
+
@fetching.always =>
|
203
205
|
# TODO implement status for viewer widget
|
204
206
|
@$el.addClass 'idle'
|
205
207
|
@$el.removeClass 'loading'
|
data/lib/ende/version.rb
CHANGED
@@ -0,0 +1,122 @@
|
|
1
|
+
/*
|
2
|
+
Input Mask plugin extensions
|
3
|
+
http://github.com/RobinHerbots/jquery.inputmask
|
4
|
+
Copyright (c) 2010 - 2014 Robin Herbots
|
5
|
+
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
6
|
+
Version: 0.0.0
|
7
|
+
|
8
|
+
Optional extensions on the jquery.inputmask base
|
9
|
+
*/
|
10
|
+
(function ($) {
|
11
|
+
//extra definitions
|
12
|
+
$.extend($.inputmask.defaults.definitions, {
|
13
|
+
'A': {
|
14
|
+
validator: "[A-Za-z]",
|
15
|
+
cardinality: 1,
|
16
|
+
casing: "upper" //auto uppercasing
|
17
|
+
},
|
18
|
+
'#': {
|
19
|
+
validator: "[A-Za-z\u0410-\u044F\u0401\u04510-9]",
|
20
|
+
cardinality: 1,
|
21
|
+
casing: "upper"
|
22
|
+
}
|
23
|
+
});
|
24
|
+
$.extend($.inputmask.defaults.aliases, {
|
25
|
+
'url': {
|
26
|
+
mask: "ir",
|
27
|
+
placeholder: "",
|
28
|
+
separator: "",
|
29
|
+
defaultPrefix: "http://",
|
30
|
+
regex: {
|
31
|
+
urlpre1: new RegExp("[fh]"),
|
32
|
+
urlpre2: new RegExp("(ft|ht)"),
|
33
|
+
urlpre3: new RegExp("(ftp|htt)"),
|
34
|
+
urlpre4: new RegExp("(ftp:|http|ftps)"),
|
35
|
+
urlpre5: new RegExp("(ftp:/|ftps:|http:|https)"),
|
36
|
+
urlpre6: new RegExp("(ftp://|ftps:/|http:/|https:)"),
|
37
|
+
urlpre7: new RegExp("(ftp://|ftps://|http://|https:/)"),
|
38
|
+
urlpre8: new RegExp("(ftp://|ftps://|http://|https://)")
|
39
|
+
},
|
40
|
+
definitions: {
|
41
|
+
'i': {
|
42
|
+
validator: function (chrs, buffer, pos, strict, opts) {
|
43
|
+
return true;
|
44
|
+
},
|
45
|
+
cardinality: 8,
|
46
|
+
prevalidator: (function () {
|
47
|
+
var result = [], prefixLimit = 8;
|
48
|
+
for (var i = 0; i < prefixLimit; i++) {
|
49
|
+
result[i] = (function () {
|
50
|
+
var j = i;
|
51
|
+
return {
|
52
|
+
validator: function (chrs, buffer, pos, strict, opts) {
|
53
|
+
if (opts.regex["urlpre" + (j + 1)]) {
|
54
|
+
var tmp = chrs, k;
|
55
|
+
if (((j + 1) - chrs.length) > 0) {
|
56
|
+
tmp = buffer.join('').substring(0, ((j + 1) - chrs.length)) + "" + tmp;
|
57
|
+
}
|
58
|
+
var isValid = opts.regex["urlpre" + (j + 1)].test(tmp);
|
59
|
+
if (!strict && !isValid) {
|
60
|
+
pos = pos - j;
|
61
|
+
for (k = 0; k < opts.defaultPrefix.length; k++) {
|
62
|
+
buffer[pos] = opts.defaultPrefix[k]; pos++;
|
63
|
+
}
|
64
|
+
for (k = 0; k < tmp.length - 1; k++) {
|
65
|
+
buffer[pos] = tmp[k]; pos++;
|
66
|
+
}
|
67
|
+
return { "pos": pos };
|
68
|
+
}
|
69
|
+
return isValid;
|
70
|
+
} else {
|
71
|
+
return false;
|
72
|
+
}
|
73
|
+
}, cardinality: j
|
74
|
+
};
|
75
|
+
})();
|
76
|
+
}
|
77
|
+
return result;
|
78
|
+
})()
|
79
|
+
},
|
80
|
+
"r": {
|
81
|
+
validator: ".",
|
82
|
+
cardinality: 50
|
83
|
+
}
|
84
|
+
},
|
85
|
+
insertMode: false,
|
86
|
+
autoUnmask: false
|
87
|
+
},
|
88
|
+
"ip": { //ip-address mask
|
89
|
+
mask: ["[[x]y]z.[[x]y]z.[[x]y]z.x[yz]", "[[x]y]z.[[x]y]z.[[x]y]z.[[x]y][z]"],
|
90
|
+
definitions: {
|
91
|
+
'x': {
|
92
|
+
validator: "[012]",
|
93
|
+
cardinality: 1,
|
94
|
+
definitionSymbol: "i"
|
95
|
+
},
|
96
|
+
'y': {
|
97
|
+
validator: function (chrs, buffer, pos, strict, opts) {
|
98
|
+
if (pos - 1 > -1 && buffer[pos - 1] != ".")
|
99
|
+
chrs = buffer[pos - 1] + chrs;
|
100
|
+
else chrs = "0" + chrs;
|
101
|
+
return new RegExp("2[0-5]|[01][0-9]").test(chrs);
|
102
|
+
},
|
103
|
+
cardinality: 1,
|
104
|
+
definitionSymbol: "i"
|
105
|
+
},
|
106
|
+
'z': {
|
107
|
+
validator: function (chrs, buffer, pos, strict, opts) {
|
108
|
+
if (pos - 1 > -1 && buffer[pos - 1] != ".") {
|
109
|
+
chrs = buffer[pos - 1] + chrs;
|
110
|
+
if (pos - 2 > -1 && buffer[pos - 2] != ".") {
|
111
|
+
chrs = buffer[pos - 2] + chrs;
|
112
|
+
} else chrs = "0" + chrs;
|
113
|
+
} else chrs = "00" + chrs;
|
114
|
+
return new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
|
115
|
+
},
|
116
|
+
cardinality: 1,
|
117
|
+
definitionSymbol: "i"
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
121
|
+
});
|
122
|
+
})(jQuery);
|