unpoly-rails 0.60.0 → 0.60.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.
Potentially problematic release.
This version of unpoly-rails might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -1
- data/README_RAILS.md +46 -34
- data/dist/unpoly.js +29 -23
- data/dist/unpoly.min.js +4 -4
- data/lib/assets/javascripts/unpoly/classes/follow_variant.coffee +4 -1
- data/lib/assets/javascripts/unpoly/classes/scroll_motion.coffee +2 -2
- data/lib/assets/javascripts/unpoly/element.coffee.erb +4 -4
- data/lib/assets/javascripts/unpoly/event.coffee.erb +3 -3
- data/lib/assets/javascripts/unpoly/fragment.coffee.erb +1 -1
- data/lib/assets/javascripts/unpoly/link.coffee.erb +6 -4
- data/lib/assets/javascripts/unpoly/motion.coffee.erb +1 -1
- data/lib/assets/javascripts/unpoly/protocol.coffee +1 -1
- data/lib/assets/javascripts/unpoly/proxy.coffee +2 -2
- data/lib/assets/javascripts/unpoly/syntax.coffee.erb +3 -3
- data/lib/assets/javascripts/unpoly/viewport.coffee.erb +1 -1
- data/lib/unpoly/rails/version.rb +1 -1
- data/package.json +1 -1
- data/spec_app/app/controllers/compiler_test_controller.rb +5 -0
- data/spec_app/app/views/compiler_test/timestamp.erb +9 -0
- data/spec_app/app/views/pages/start.erb +1 -0
- data/spec_app/config/routes.rb +1 -0
- data/spec_app/spec/javascripts/up/feedback_spec.js.coffee +9 -0
- data/spec_app/spec/javascripts/up/fragment_spec.js.coffee +24 -0
- metadata +4 -3
- data/design/todo_jquery.txt +0 -13
@@ -372,7 +372,7 @@ up.motion = do ->
|
|
372
372
|
|
373
373
|
scrollNew = ->
|
374
374
|
# Don't animate the scrolling.
|
375
|
-
scrollOptions = u.merge(options,
|
375
|
+
scrollOptions = u.merge(options, scrollBehavior: 'auto')
|
376
376
|
# Scroll newElement into position before we start the enter animation.
|
377
377
|
up.viewport.scrollAfterInsertFragment(newElement, scrollOptions)
|
378
378
|
|
@@ -154,7 +154,7 @@ This fixes two edge cases you might or might not care about:
|
|
154
154
|
2. Some browsers have a bug where the initial request method is used for all
|
155
155
|
subsequently pushed states. That means if the user reloads the page on a later
|
156
156
|
GET state, the browser will wrongly attempt a POST request.
|
157
|
-
This issue affects Safari 9
|
157
|
+
This issue affects Safari 9-12 (last tested in 2019-03).
|
158
158
|
Modern Firefoxes, Chromes and IE10+ don't have this behavior.
|
159
159
|
|
160
160
|
In order to allow Unpoly to detect the HTTP method of the initial page load,
|
@@ -158,7 +158,7 @@ up.proxy = do ->
|
|
158
158
|
|
159
159
|
\#\#\# Example
|
160
160
|
|
161
|
-
up.request('/search', params: { query: 'sunshine' }).then(function(response) {
|
161
|
+
up.request('/search', { params: { query: 'sunshine' } }).then(function(response) {
|
162
162
|
console.log('The response text is %o', response.text)
|
163
163
|
}).catch(function() {
|
164
164
|
console.error('The request failed')
|
@@ -266,7 +266,7 @@ up.proxy = do ->
|
|
266
266
|
|
267
267
|
\#\#\# Example
|
268
268
|
|
269
|
-
up.request('/search', params: { query: 'sunshine' }).then(function(text) {
|
269
|
+
up.request('/search', { params: { query: 'sunshine' } }).then(function(text) {
|
270
270
|
console.log('The response text is %o', text)
|
271
271
|
}).catch(function() {
|
272
272
|
console.error('The request failed')
|
@@ -82,7 +82,7 @@ up.syntax = do ->
|
|
82
82
|
\#\#\# Cleaning up after yourself
|
83
83
|
|
84
84
|
If your compiler returns a function, Unpoly will use this as a *destructor* to
|
85
|
-
clean up if the element leaves the DOM. Note that in Unpoly the same DOM
|
85
|
+
clean up if the element leaves the DOM. Note that in Unpoly the same DOM and JavaScript environment
|
86
86
|
will persist through many page loads, so it's important to not create
|
87
87
|
[memory leaks](https://makandracards.com/makandra/31325-how-to-create-memory-leaks-in-jquery).
|
88
88
|
|
@@ -126,7 +126,7 @@ up.syntax = do ->
|
|
126
126
|
{ "lat": 48.75, "lng": 11.45, "title": "Ingolstadt" }
|
127
127
|
]'></div>
|
128
128
|
|
129
|
-
The JSON will parsed and handed to your compiler as a second argument:
|
129
|
+
The JSON will be parsed and handed to your compiler as a second argument:
|
130
130
|
|
131
131
|
up.compiler('.google-map', function(element, pins) {
|
132
132
|
var map = new google.maps.Map(element)
|
@@ -416,7 +416,7 @@ up.syntax = do ->
|
|
416
416
|
{ "lat": 48.75, "lng": 11.45, "title": "Ingolstadt" }
|
417
417
|
]'></div>
|
418
418
|
|
419
|
-
The JSON will parsed and handed to your compiler as a second argument:
|
419
|
+
The JSON will be parsed and handed to your compiler as a second argument:
|
420
420
|
|
421
421
|
up.compiler('.google-map', function(element, pins) {
|
422
422
|
var map = new google.maps.Map(element)
|
@@ -18,7 +18,7 @@ layout, such as navigation bars or headers. Unpoly will respect these sticky
|
|
18
18
|
elements when [revealing updated fragments](/up.reveal).
|
19
19
|
|
20
20
|
You should also [tell Unpoly](/up.viewport.config#config.viewports) when your application has more than one viewport,
|
21
|
-
|
21
|
+
so Unpoly can pick the right viewport to scroll for each fragment update.
|
22
22
|
|
23
23
|
|
24
24
|
\#\#\# Bootstrap integration
|
data/lib/unpoly/rails/version.rb
CHANGED
data/package.json
CHANGED
@@ -72,6 +72,7 @@
|
|
72
72
|
<li><%= link_to 'Scrolling behavior', '/scroll_test/long1' %></li>
|
73
73
|
<li><%= link_to 'Animations', '/motion_test/animations' %></li>
|
74
74
|
<li><%= link_to 'Transitions', '/motion_test/transitions' %></li>
|
75
|
+
<li><%= link_to 'Compilers', '/compiler_test/timestamp' %></li>
|
75
76
|
</ul>
|
76
77
|
|
77
78
|
</div>
|
data/spec_app/config/routes.rb
CHANGED
@@ -15,6 +15,7 @@ Rails.application.routes.draw do
|
|
15
15
|
get 'reveal_test/:action', controller: 'reveal_test'
|
16
16
|
get 'scroll_test/:action', controller: 'scroll_test'
|
17
17
|
get 'motion_test/:action', controller: 'motion_test'
|
18
|
+
get 'compiler_test/:action', controller: 'compiler_test'
|
18
19
|
|
19
20
|
namespace :form_test do
|
20
21
|
resource :basic, only: [:new, :create]
|
@@ -347,6 +347,15 @@ describe 'up.feedback', ->
|
|
347
347
|
next =>
|
348
348
|
expect($area).not.toHaveClass('up-active')
|
349
349
|
|
350
|
+
it 'removes .up-active when a link with [up-confirm] was not confirmed', asyncSpec (next) ->
|
351
|
+
$link = $fixture('a[href="/foo"][up-modal=".main"][up-confirm="Really follow?"]')
|
352
|
+
spyOn(up.browser, 'whenConfirmed').and.returnValue(Promise.reject('User aborted'))
|
353
|
+
|
354
|
+
Trigger.clickSequence($link)
|
355
|
+
|
356
|
+
next =>
|
357
|
+
expect($link).not.toHaveClass('up-active')
|
358
|
+
|
350
359
|
it 'marks clicked modal openers as .up-active while the modal is loading', asyncSpec (next) ->
|
351
360
|
$link = $fixture('a[href="/foo"][up-modal=".main"]')
|
352
361
|
fixture('.main')
|
@@ -1965,6 +1965,30 @@ describe 'up.fragment', ->
|
|
1965
1965
|
next =>
|
1966
1966
|
expect(swapDirectlySpy).toHaveBeenCalled()
|
1967
1967
|
|
1968
|
+
describe 'with { scrollBehavior } option', ->
|
1969
|
+
|
1970
|
+
beforeEach ->
|
1971
|
+
up.viewport.knife.mock('reveal').and.callFake (element, options) =>
|
1972
|
+
@revealScrollBehavior = options.behavior ? options.scrollBehavior
|
1973
|
+
|
1974
|
+
it 'animates the revealing when prepending an element', asyncSpec (next) ->
|
1975
|
+
fixture('.element', text: 'version 1')
|
1976
|
+
up.extract('.element:before', '<div class="element">version 2</div>', reveal: true, scrollBehavior: 'smooth')
|
1977
|
+
next =>
|
1978
|
+
expect(@revealScrollBehavior).toEqual('smooth')
|
1979
|
+
|
1980
|
+
it 'animates the revealing when appending an element', asyncSpec (next) ->
|
1981
|
+
fixture('.element', text: 'version 1')
|
1982
|
+
up.extract('.element:after', '<div class="element">version 2</div>', reveal: true, scrollBehavior: 'smooth')
|
1983
|
+
next =>
|
1984
|
+
expect(@revealScrollBehavior).toEqual('smooth')
|
1985
|
+
|
1986
|
+
it 'does not animate the revealing when swapping out an element', asyncSpec (next) ->
|
1987
|
+
fixture('.element', text: 'version 1')
|
1988
|
+
up.extract('.element', '<div class="element">version 2</div>', reveal: true, scrollBehavior: 'smooth')
|
1989
|
+
next =>
|
1990
|
+
expect(@revealScrollBehavior).toEqual('auto')
|
1991
|
+
|
1968
1992
|
describe 'handling of [up-keep] elements', ->
|
1969
1993
|
|
1970
1994
|
squish = (string) ->
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unpoly-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.60.
|
4
|
+
version: 0.60.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henning Koch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -84,7 +84,6 @@ files:
|
|
84
84
|
- design/positioning.txt
|
85
85
|
- design/rename.txt
|
86
86
|
- design/test_rejected_promise.txt
|
87
|
-
- design/todo_jquery.txt
|
88
87
|
- design/unpoly errors.txt
|
89
88
|
- dist/unpoly-bootstrap3.css
|
90
89
|
- dist/unpoly-bootstrap3.js
|
@@ -189,6 +188,7 @@ files:
|
|
189
188
|
- spec_app/app/assets/stylesheets/jasmine_specs.sass
|
190
189
|
- spec_app/app/controllers/application_controller.rb
|
191
190
|
- spec_app/app/controllers/binding_test_controller.rb
|
191
|
+
- spec_app/app/controllers/compiler_test_controller.rb
|
192
192
|
- spec_app/app/controllers/css_test_controller.rb
|
193
193
|
- spec_app/app/controllers/error_test_controller.rb
|
194
194
|
- spec_app/app/controllers/form_test/basics_controller.rb
|
@@ -204,6 +204,7 @@ files:
|
|
204
204
|
- spec_app/app/helpers/application_helper.rb
|
205
205
|
- spec_app/app/mailers/.keep
|
206
206
|
- spec_app/app/models/concerns/.keep
|
207
|
+
- spec_app/app/views/compiler_test/timestamp.erb
|
207
208
|
- spec_app/app/views/css_test/modal.erb
|
208
209
|
- spec_app/app/views/css_test/modal_contents.erb
|
209
210
|
- spec_app/app/views/css_test/modal_contents_wide.erb
|
data/design/todo_jquery.txt
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
- PUBLISH
|
2
|
-
|
3
|
-
- deploy cards with new version
|
4
|
-
|
5
|
-
- deploy unpoly-guide
|
6
|
-
|
7
|
-
- upgrade roca-style.org PR
|
8
|
-
- better claim
|
9
|
-
- no jquery
|
10
|
-
|
11
|
-
- Update card with https://unpoly.com/up.util.parseUrl
|
12
|
-
- https://makandracards.com/makandra/29377-the-easiest-way-to-parse-urls-with-javascript
|
13
|
-
|