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

Improve JavaScript #6

Merged
merged 6 commits into from Jul 31, 2017
Merged

Improve JavaScript #6

merged 6 commits into from Jul 31, 2017

Conversation

@javan
Copy link
Member

@javan javan commented Jul 31, 2017

  • Fixes #4 by forcing full page loads when using Turbolinks
  • Fixes that submitting the hidden form would do a full POST request instead of a remote XHR
  • Hides the google_sign_in container until it's ready to be clicked
  • Freshens up the JavaScript and Google API client usage
google_sign_in_hidden_form_tag(url: url) +
google_sign_in_click_handler(&block)
end

private
HIDDEN_INPUT_ID = "google_sign_in_token"
SUBMIT_BUTTON_ID = "google_sign_in_submit"
CONTAINER_ID = "google_sign_in_container"

This comment has been minimized.

@dhh

dhh Jul 31, 2017
Member

Not sure that these constantized IDs carry their own weight. They're not really any more explanatory, shorter, or likely to be values of independent change. I think I'd vote to just inline them.

This comment has been minimized.

@javan

javan Jul 31, 2017
Author Member

👌 65d0906

@dhh dhh merged commit b971968 into master Jul 31, 2017
@dhh dhh deleted the improve-js branch Jul 31, 2017
@morgoth
Copy link
Contributor

@morgoth morgoth commented Aug 4, 2017

@javan @dhh This breaks my integration.
When I sign in now, request is done with format: :js - previously it was :html which worked fine with simple redirect_to in the controller - now the page is not refreshed (not reloaded).

Changing

document.getElementById("google_sign_in_submit").click()

to document.getElementById("google_sign_in_submit").form.submit(); fixes it, which means it won't be a "remote" call anymore

I checked with app that uses turbolinks and with app that doesn't use it - the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.