-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configure admin turbolinks #1882
Conversation
# @!attribute [rw] use_turbolinks | ||
preference :use_turbolinks, :boolean, default: false | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra blank line detected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please satisfy Hound here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 👌
Especially the fallback to Spree.ready
is a neat trick that will help stores and extensions to upgrade!
I would like to have some small changes and please send the last commit as PR to current master
as I want to see them pass without Turbolinks first.
Thanks for your work on this 👏
@@ -159,7 +159,6 @@ Spree.ready(function(){ | |||
return ui; | |||
}; | |||
|
|||
$('table.sortable').ready(function(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a change in the actual implementation and not necessary for Turbolinks to work, right? I think this should not be in this PR.
// comment line necessary for correct interpolation of use_turbolinks | ||
Turbolinks.supported = <%= Spree::Backend::Config.use_turbolinks %>; | ||
|
||
// override jQuery.ready to support Turbolinks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is misleading. You are doing this because we want to print out a deprecation warning and use Spree.ready
even if it was not used explicitly. Turbolinks works without this change.
# @!attribute [rw] use_turbolinks | ||
preference :use_turbolinks, :boolean, default: false | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please satisfy Hound here.
@@ -0,0 +1,20 @@ | |||
// comment line necessary for correct interpolation of use_turbolinks | |||
Turbolinks.supported = <%= Spree::Backend::Config.use_turbolinks %>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat little trick 👌
But we remove the internal check of Turbolinks for supported browsers with this. Imagine someone enables Turbolinks in the backend and uses an unsupported browser, Turbolinks will not gracefully fall back anymore.
I can live with that, because we encourage admin users to use latest browsers, but this can cause issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback! I will sort out the rest if we get the #1900 merged in.
On this one, we can copy over the few lines from turbolinks, but I really hate to encourage people to use old browsers, and those unsupported browsers are already ice age by now, let alone by the time somebody actually starts using this feature here..
So, well pointed out; my preference is to keep this behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tvdeyen , sorry to pester .. just whenever you get to it .. if you could rebase your branch on top of master now that that preparation PR has been merged .. as otherwise I think I won't be able to get the tests to green?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtomov sure. Sorry, I forgot the target of this PR, you are totally right!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, but I think that you might have updated tvdeyen/turbolinks
instead of solidusio/turbolinks
: )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtomov updated solidusio/turbolinks
@@ -175,8 +170,6 @@ | |||
end | |||
|
|||
it "transitions to delivery not to complete" do | |||
click_on 'Cart' | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have these changes to the new order and customer details feature specs as separate PRs to master? I want to be sure they still pass on non-Turbolinks based backend.
@mtomov rebased |
Super, thanks, updated from my side as well! Let me know! Thanks! |
@mtomov just rebased again with master, could you please rebase again and while your at it fix the typo in the commit message ("Turobolinks" vs. "Turbolinks")? Thanks! |
That's that done! All easy with small PRs : ) Thanks! |
@mtomov Thanks, but I still see the typo in the commit message. |
- Enabled for new applications - Disabled for existing applications. Enable in an initializer with: # config/initializers/spree.rb Spree::Backend::Config.configure do |config| config.use_turbolinks = true end - Handles gracefully existing javascript code, which still uses jQuery.ready and gives a warning of the location of those functions.
Correct, my bad, thanks for noticing! Should be good now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
Enabled for new applications
Disabled for existing applications. Enable in an initializer with:
Handles gracefully existing javascript code, which still uses
jQuery.ready and gives a warning of the location of those functions
Towards #1863
edit: I will see to fix the 18 test failures .. tests fixed!