Closed alecdotninja closed 8 years ago
r? @Thibaut
(@rails-bot has picked a reviewer for you, use r? to override)
Again, the issue with the specs on 209.17 seems to be upstream on Rails master.
Nice PR.
I'd prefer making prepend
/ append
act like change
in JS:
Turbolinks.visit(url, prepend: ['id'])
Turbolinks.replace(string, append: ['id'])
instead of having them be booleans.
@Thibaut The API now matches what you have requested.
I should note, however, that exactly one of the append
, prepend
, or change
options may be used in call to Turbolinks.visit
or Turbolinks.replace
.
Do you think there should be support for using several of these options at the same time?
After some experimenting with my own projects, it quickly became clear to me that in order for the append
and prepend
options to be most useful, they should be allowed in combination with each other and the change
option.
For example, when progressively enhancing to create an infinitely scrollable list, it is intuitive to want to append
new entries to the list container while performing a change
on a node at the bottom of the page containing pagination links. From this point, a small amount of unobtrusive JavaScript can be added to programmatically click the "next" link as it approaches the viewport.
The combination of the append
and change
options allows the easy creation of an infinitely scrollable list that seamlessly degrades when JavaScript is not available (and perhaps more importantly, remains indexable by search engines).
These changes are now reflected on my branch.
Sorry for the delay. I'll review this next week-end.
If you rebase the tests should pass.
@Thibaut I have rebased to master and squashed my commits.
Thanks
thanks @anarchocurious you did amazing job :)
Although the interface works slightly differently than requested, this would accommodate #563.