Skip to content
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

Merged
merged 1 commit into from
Jun 9, 2017
Merged

Configure admin turbolinks #1882

merged 1 commit into from
Jun 9, 2017

Conversation

mtomov
Copy link
Contributor

@mtomov mtomov commented May 4, 2017

  • 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

Towards #1863

edit: I will see to fix the 18 test failures .. tests fixed!

# @!attribute [rw] use_turbolinks
preference :use_turbolinks, :boolean, default: false


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra blank line detected.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please satisfy Hound here.

@tvdeyen tvdeyen self-assigned this May 9, 2017
Copy link
Member

@tvdeyen tvdeyen left a 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(){
Copy link
Member

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
Copy link
Member

@tvdeyen tvdeyen May 9, 2017

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


Copy link
Member

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 %>;
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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?

Copy link
Member

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!

Copy link
Contributor Author

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 : )

Copy link
Member

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'

Copy link
Member

@tvdeyen tvdeyen May 9, 2017

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.

@tvdeyen tvdeyen removed their assignment May 9, 2017
@mtomov mtomov mentioned this pull request May 9, 2017
@tvdeyen
Copy link
Member

tvdeyen commented May 18, 2017

@mtomov rebased turbolinks branch on master, now could you please rebase your branch on top of turbolinks?

@mtomov
Copy link
Contributor Author

mtomov commented May 22, 2017

Super, thanks, updated from my side as well!

Let me know! Thanks!

@tvdeyen
Copy link
Member

tvdeyen commented Jun 8, 2017

@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!

@mtomov
Copy link
Contributor Author

mtomov commented Jun 8, 2017

That's that done! All easy with small PRs : ) Thanks!

@tvdeyen
Copy link
Member

tvdeyen commented Jun 9, 2017

@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.
@mtomov
Copy link
Contributor Author

mtomov commented Jun 9, 2017

Correct, my bad, thanks for noticing! Should be good now.

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@tvdeyen tvdeyen merged commit d524abb into solidusio:turbolinks Jun 9, 2017
@mtomov mtomov deleted the configure-turbolinks branch June 9, 2017 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants