upjs-rails 0.12.4 → 0.12.5
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/CHANGELOG.md +12 -3
- data/dist/up.js +495 -300
- data/dist/up.min.js +2 -2
- data/lib/assets/javascripts/up.js.coffee +3 -1
- data/lib/assets/javascripts/up/browser.js.coffee +8 -8
- data/lib/assets/javascripts/up/bus.js.coffee +77 -37
- data/lib/assets/javascripts/up/flow.js.coffee +40 -6
- data/lib/assets/javascripts/up/form.js.coffee +5 -7
- data/lib/assets/javascripts/up/history.js.coffee +8 -10
- data/lib/assets/javascripts/up/layout.js.coffee +22 -20
- data/lib/assets/javascripts/up/link.js.coffee +10 -15
- data/lib/assets/javascripts/up/modal.js.coffee +92 -72
- data/lib/assets/javascripts/up/motion.js.coffee +16 -17
- data/lib/assets/javascripts/up/navigation.js.coffee +3 -6
- data/lib/assets/javascripts/up/popup.js.coffee +55 -27
- data/lib/assets/javascripts/up/proxy.js.coffee +71 -20
- data/lib/assets/javascripts/up/syntax.js.coffee +30 -15
- data/lib/assets/javascripts/up/tooltip.js.coffee +5 -8
- data/lib/assets/javascripts/up/util.js.coffee +39 -22
- data/lib/upjs/rails/version.rb +1 -1
- data/spec_app/spec/javascripts/up/flow_spec.js.coffee +30 -0
- data/spec_app/spec/javascripts/up/link_spec.js.coffee +6 -0
- data/spec_app/spec/javascripts/up/proxy_spec.js.coffee +8 -8
- metadata +2 -3
- data/lib/assets/javascripts/up/boot.js.coffee +0 -3
@@ -36,8 +36,7 @@ up.tooltip = (($) ->
|
|
36
36
|
###*
|
37
37
|
Sets default options for future tooltips.
|
38
38
|
|
39
|
-
@
|
40
|
-
@property
|
39
|
+
@property up.tooltip.config
|
41
40
|
@param {String} [config.position]
|
42
41
|
The default position of tooltips relative to the element.
|
43
42
|
Can be either `"top"` or `"bottom"`.
|
@@ -85,7 +84,7 @@ up.tooltip = (($) ->
|
|
85
84
|
html: 'Enter multiple words or phrases'
|
86
85
|
});
|
87
86
|
|
88
|
-
@
|
87
|
+
@function up.tooltip.attach
|
89
88
|
@param {Element|jQuery|String} elementOrSelector
|
90
89
|
@param {String} [options.html]
|
91
90
|
The HTML to display in the tooltip.
|
@@ -110,7 +109,7 @@ up.tooltip = (($) ->
|
|
110
109
|
Closes a currently shown tooltip.
|
111
110
|
Does nothing if no tooltip is currently shown.
|
112
111
|
|
113
|
-
@
|
112
|
+
@function up.tooltip.close
|
114
113
|
@param {Object} options
|
115
114
|
See options for [`up.animate`](/up.animate).
|
116
115
|
###
|
@@ -131,7 +130,7 @@ up.tooltip = (($) ->
|
|
131
130
|
|
132
131
|
<a href="/decks" up-tooltip="Show all decks" up-position="bottom">Decks</a>
|
133
132
|
|
134
|
-
@
|
133
|
+
@selector [up-tooltip]
|
135
134
|
@param {String} [up-animation]
|
136
135
|
The animation used to open the tooltip.
|
137
136
|
Defaults to [`up.tooltip.config.openAnimation`](/up.tooltip.config).
|
@@ -139,7 +138,6 @@ up.tooltip = (($) ->
|
|
139
138
|
The default position of tooltips relative to the element.
|
140
139
|
Can be either `"top"` or `"bottom"`.
|
141
140
|
Defaults to [`up.tooltip.config.position`](/up.tooltip.config).
|
142
|
-
@ujs
|
143
141
|
###
|
144
142
|
|
145
143
|
###*
|
@@ -147,8 +145,7 @@ up.tooltip = (($) ->
|
|
147
145
|
|
148
146
|
<a href="/decks" up-tooltip="Show <b>all</b> decks">Decks</a>
|
149
147
|
|
150
|
-
@
|
151
|
-
@ujs
|
148
|
+
@selector [up-tooltip-html]
|
152
149
|
###
|
153
150
|
up.compiler('[up-tooltip], [up-tooltip-html]', ($link) ->
|
154
151
|
# Don't register these events on document since *every*
|
@@ -32,7 +32,7 @@ up.util = (($) ->
|
|
32
32
|
$.ajax(request)
|
33
33
|
|
34
34
|
###*
|
35
|
-
@
|
35
|
+
@function up.util.isStandardPort
|
36
36
|
@private
|
37
37
|
###
|
38
38
|
isStandardPort = (protocol, port) ->
|
@@ -44,22 +44,17 @@ up.util = (($) ->
|
|
44
44
|
|
45
45
|
By default hashes are ignored, search queries are included.
|
46
46
|
|
47
|
-
@
|
47
|
+
@function up.util.normalizeUrl
|
48
48
|
@param {Boolean} [options.hash=false]
|
49
|
+
Whether to include an `#hash` anchor in the normalized URL
|
49
50
|
@param {Boolean} [options.search=true]
|
51
|
+
Whether to include a `?query` string in the normalized URL
|
52
|
+
@param {Boolean} [options.stripTrailingSlash=false]
|
53
|
+
Whether to strip a trailing slash from the pathname
|
50
54
|
@protected
|
51
55
|
###
|
52
56
|
normalizeUrl = (urlOrAnchor, options) ->
|
53
|
-
anchor =
|
54
|
-
if isString(urlOrAnchor)
|
55
|
-
anchor = $('<a>').attr(href: urlOrAnchor).get(0)
|
56
|
-
# In IE11 the #hostname and #port properties of such a link are empty
|
57
|
-
# strings. However, we can fix this by assigning the anchor its own
|
58
|
-
# href because computer:
|
59
|
-
# https://gist.github.com/jlong/2428561#comment-1461205
|
60
|
-
anchor.href = anchor.href if isBlank(anchor.hostname)
|
61
|
-
else
|
62
|
-
anchor = unJquery(urlOrAnchor)
|
57
|
+
anchor = parseUrl(urlOrAnchor)
|
63
58
|
normalized = anchor.protocol + "//" + anchor.hostname
|
64
59
|
normalized += ":#{anchor.port}" unless isStandardPort(anchor.protocol, anchor.port)
|
65
60
|
pathname = anchor.pathname
|
@@ -74,7 +69,24 @@ up.util = (($) ->
|
|
74
69
|
normalized
|
75
70
|
|
76
71
|
###*
|
77
|
-
@
|
72
|
+
@function up.util.parseUrl
|
73
|
+
@private
|
74
|
+
###
|
75
|
+
parseUrl = (urlOrAnchor) ->
|
76
|
+
anchor = null
|
77
|
+
if isString(urlOrAnchor)
|
78
|
+
anchor = $('<a>').attr(href: urlOrAnchor).get(0)
|
79
|
+
# In IE11 the #hostname and #port properties of such a link are empty
|
80
|
+
# strings. However, we can fix this by assigning the anchor its own
|
81
|
+
# href because computer:
|
82
|
+
# https://gist.github.com/jlong/2428561#comment-1461205
|
83
|
+
anchor.href = anchor.href if isBlank(anchor.hostname)
|
84
|
+
else
|
85
|
+
anchor = unJquery(urlOrAnchor)
|
86
|
+
anchor
|
87
|
+
|
88
|
+
###*
|
89
|
+
@function up.util.normalizeMethod
|
78
90
|
@protected
|
79
91
|
###
|
80
92
|
normalizeMethod = (method) ->
|
@@ -115,7 +127,7 @@ up.util = (($) ->
|
|
115
127
|
element
|
116
128
|
|
117
129
|
###*
|
118
|
-
@
|
130
|
+
@function up.debug
|
119
131
|
@protected
|
120
132
|
###
|
121
133
|
debug = (message, args...) ->
|
@@ -123,7 +135,7 @@ up.util = (($) ->
|
|
123
135
|
up.browser.puts('debug', message, args...)
|
124
136
|
|
125
137
|
###*
|
126
|
-
@
|
138
|
+
@function up.warn
|
127
139
|
@protected
|
128
140
|
###
|
129
141
|
warn = (message, args...) ->
|
@@ -142,7 +154,7 @@ up.util = (($) ->
|
|
142
154
|
up.error('Division by zero')
|
143
155
|
up.error('Unexpected result %o', result)
|
144
156
|
|
145
|
-
@
|
157
|
+
@function up.error
|
146
158
|
###
|
147
159
|
error = (args...) ->
|
148
160
|
args[0] = "[UP] #{args[0]}"
|
@@ -349,7 +361,7 @@ up.util = (($) ->
|
|
349
361
|
In that case you cannot change the sources with a `||` operator
|
350
362
|
(since that doesn't short-circuit at `false`).
|
351
363
|
|
352
|
-
@
|
364
|
+
@function up.util.option
|
353
365
|
@param {Array} args...
|
354
366
|
###
|
355
367
|
option = (args...) ->
|
@@ -429,7 +441,7 @@ up.util = (($) ->
|
|
429
441
|
Modifies the given function so it only runs once.
|
430
442
|
Subsequent calls will return the previous return value.
|
431
443
|
|
432
|
-
@
|
444
|
+
@function up.util.once
|
433
445
|
@private
|
434
446
|
###
|
435
447
|
once = (fun) ->
|
@@ -442,7 +454,7 @@ up.util = (($) ->
|
|
442
454
|
###*
|
443
455
|
# Temporarily sets the CSS for the given element.
|
444
456
|
#
|
445
|
-
# @
|
457
|
+
# @function up.util.temporaryCss
|
446
458
|
# @param {jQuery} $element
|
447
459
|
# @param {Object} css
|
448
460
|
# @param {Function} [block]
|
@@ -483,7 +495,7 @@ up.util = (($) ->
|
|
483
495
|
To improve performance, the element will be forced into compositing for
|
484
496
|
the duration of the animation.
|
485
497
|
|
486
|
-
@
|
498
|
+
@function up.util.cssAnimate
|
487
499
|
@param {Element|jQuery|String} elementOrSelector
|
488
500
|
The element to animate.
|
489
501
|
@param {Object} lastFrame
|
@@ -544,7 +556,7 @@ up.util = (($) ->
|
|
544
556
|
|
545
557
|
Also see [`up.motion.finish`](/up.motion.finish).
|
546
558
|
|
547
|
-
@
|
559
|
+
@function up.util.finishCssAnimate
|
548
560
|
@protected
|
549
561
|
@param {Element|jQuery|String} elementOrSelector
|
550
562
|
###
|
@@ -655,6 +667,9 @@ up.util = (($) ->
|
|
655
667
|
resolvedPromise = ->
|
656
668
|
resolvedDeferred().promise()
|
657
669
|
|
670
|
+
unresolvablePromise = ->
|
671
|
+
$.Deferred().promise()
|
672
|
+
|
658
673
|
nullJquery = ->
|
659
674
|
is: -> false
|
660
675
|
attr: ->
|
@@ -734,7 +749,7 @@ up.util = (($) ->
|
|
734
749
|
obj
|
735
750
|
|
736
751
|
###*
|
737
|
-
@
|
752
|
+
@function up.util.cache
|
738
753
|
@param {Number|Function} [config.size]
|
739
754
|
Maximum number of cache entries.
|
740
755
|
Set to `undefined` to not limit the cache size.
|
@@ -899,6 +914,7 @@ up.util = (($) ->
|
|
899
914
|
fixedToAbsolute: fixedToAbsolute
|
900
915
|
presentAttr: presentAttr
|
901
916
|
createElement: createElement
|
917
|
+
parseUrl: parseUrl
|
902
918
|
normalizeUrl: normalizeUrl
|
903
919
|
normalizeMethod: normalizeMethod
|
904
920
|
createElementFromHtml: createElementFromHtml
|
@@ -966,6 +982,7 @@ up.util = (($) ->
|
|
966
982
|
clientSize: clientSize
|
967
983
|
only: only
|
968
984
|
trim: trim
|
985
|
+
unresolvablePromise: unresolvablePromise
|
969
986
|
resolvedPromise: resolvedPromise
|
970
987
|
resolvedDeferred: resolvedDeferred
|
971
988
|
resolvableWhen: resolvableWhen
|
data/lib/upjs/rails/version.rb
CHANGED
@@ -161,6 +161,36 @@ describe 'up.flow', ->
|
|
161
161
|
expect(@revealedHTML).toContain('new-middle')
|
162
162
|
done()
|
163
163
|
|
164
|
+
describe 'when there is an anchor #hash in the URL', ->
|
165
|
+
|
166
|
+
it 'reveals a child with the ID of that #hash', (done) ->
|
167
|
+
@request = up.replace('.middle', '/path#three', reveal: true)
|
168
|
+
@responseText =
|
169
|
+
"""
|
170
|
+
<div class="middle">
|
171
|
+
<div id="one">one</div>
|
172
|
+
<div id="two">two</div>
|
173
|
+
<div id="three">three</div>
|
174
|
+
</div>
|
175
|
+
"""
|
176
|
+
@respond()
|
177
|
+
@request.then =>
|
178
|
+
expect(@revealedHTML).toEqual('<div id="three">three</div>')
|
179
|
+
done()
|
180
|
+
|
181
|
+
it "reveals the entire element if it has no child with the ID of that #hash", (done) ->
|
182
|
+
@request = up.replace('.middle', '/path#four', reveal: true)
|
183
|
+
@responseText =
|
184
|
+
"""
|
185
|
+
<div class="middle">
|
186
|
+
new-middle
|
187
|
+
</div>
|
188
|
+
"""
|
189
|
+
@respond()
|
190
|
+
@request.then =>
|
191
|
+
expect(@revealedHTML).toContain('new-middle')
|
192
|
+
done()
|
193
|
+
|
164
194
|
it 'reveals a new element that is being appended', (done) ->
|
165
195
|
@request = up.replace('.middle:after', '/path', reveal: true)
|
166
196
|
@respond()
|
@@ -135,6 +135,12 @@ describe 'up.link', ->
|
|
135
135
|
|
136
136
|
expect($viewport.scrollTop()).toEqual(65)
|
137
137
|
|
138
|
+
# describe "when the browser is already on the link's destination", ->
|
139
|
+
#
|
140
|
+
# it "doesn't make a request and reveals the target container"
|
141
|
+
#
|
142
|
+
# it "doesn't make a request and reveals the target of a #hash in the URL"
|
143
|
+
|
138
144
|
else
|
139
145
|
|
140
146
|
it 'follows the given link', ->
|
@@ -106,7 +106,7 @@ describe 'up.proxy', ->
|
|
106
106
|
beforeEach ->
|
107
107
|
up.proxy.config.busyDelay = 0
|
108
108
|
@events = []
|
109
|
-
u.each ['up:proxy:load', 'up:proxy:
|
109
|
+
u.each ['up:proxy:load', 'up:proxy:received', 'up:proxy:busy', 'up:proxy:idle'], (eventName) =>
|
110
110
|
up.on eventName, =>
|
111
111
|
@events.push eventName
|
112
112
|
|
@@ -136,7 +136,7 @@ describe 'up.proxy', ->
|
|
136
136
|
'up:proxy:load',
|
137
137
|
'up:proxy:busy',
|
138
138
|
'up:proxy:load',
|
139
|
-
'up:proxy:
|
139
|
+
'up:proxy:received'
|
140
140
|
])
|
141
141
|
|
142
142
|
jasmine.Ajax.requests.at(1).respondWith
|
@@ -148,8 +148,8 @@ describe 'up.proxy', ->
|
|
148
148
|
'up:proxy:load',
|
149
149
|
'up:proxy:busy',
|
150
150
|
'up:proxy:load',
|
151
|
-
'up:proxy:
|
152
|
-
'up:proxy:
|
151
|
+
'up:proxy:received',
|
152
|
+
'up:proxy:received',
|
153
153
|
'up:proxy:idle'
|
154
154
|
])
|
155
155
|
|
@@ -180,7 +180,7 @@ describe 'up.proxy', ->
|
|
180
180
|
expect(@events).toEqual([
|
181
181
|
'up:proxy:load',
|
182
182
|
'up:proxy:busy',
|
183
|
-
'up:proxy:
|
183
|
+
'up:proxy:received',
|
184
184
|
'up:proxy:idle'
|
185
185
|
])
|
186
186
|
expect(up.proxy.busy()).toBe(false)
|
@@ -213,7 +213,7 @@ describe 'up.proxy', ->
|
|
213
213
|
expect(@events).toEqual([
|
214
214
|
'up:proxy:load',
|
215
215
|
'up:proxy:busy',
|
216
|
-
'up:proxy:
|
216
|
+
'up:proxy:received',
|
217
217
|
'up:proxy:idle'
|
218
218
|
])
|
219
219
|
|
@@ -237,7 +237,7 @@ describe 'up.proxy', ->
|
|
237
237
|
|
238
238
|
expect(@events).toEqual([
|
239
239
|
'up:proxy:load',
|
240
|
-
'up:proxy:
|
240
|
+
'up:proxy:received'
|
241
241
|
])
|
242
242
|
|
243
243
|
it 'emits up:proxy:idle if a request returned but failed', ->
|
@@ -257,7 +257,7 @@ describe 'up.proxy', ->
|
|
257
257
|
expect(@events).toEqual([
|
258
258
|
'up:proxy:load',
|
259
259
|
'up:proxy:busy',
|
260
|
-
'up:proxy:
|
260
|
+
'up:proxy:received',
|
261
261
|
'up:proxy:idle'
|
262
262
|
])
|
263
263
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upjs-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henning Koch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -92,7 +92,6 @@ files:
|
|
92
92
|
- lib/assets/javascripts/up-bootstrap/modal-ext.js.coffee
|
93
93
|
- lib/assets/javascripts/up-bootstrap/navigation-ext.js.coffee
|
94
94
|
- lib/assets/javascripts/up.js.coffee
|
95
|
-
- lib/assets/javascripts/up/boot.js.coffee
|
96
95
|
- lib/assets/javascripts/up/browser.js.coffee
|
97
96
|
- lib/assets/javascripts/up/bus.js.coffee
|
98
97
|
- lib/assets/javascripts/up/flow.js.coffee
|