google_sign_in 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e7270439ab30f7671a23b2284ca7db4d384a5f96
4
- data.tar.gz: 51c1f1f402dbf464def14b68fd181e177b846fdd
2
+ SHA256:
3
+ metadata.gz: 97c5ef43841bbc4901283ef218bd5bafcd321fbca2cbe51b991dce9c3943a656
4
+ data.tar.gz: f644ef5388eda41ae7181c68c53ce10843f8b862946305075023d3c79a91c0cd
5
5
  SHA512:
6
- metadata.gz: e81ae78ed6bd5ef42ff7e81df6b09a9847ca183443a9a2e55688eea31af5d436391f85b18d46f58a4198555c212e6ef5df5469d24c195152e074c88b8948dda3
7
- data.tar.gz: 5c2974784dff4008339b849c4e8f9655ddf76dda8c9ff7025f53240f90069bd29b8f7e2d35d8c5b137ceaf00522889e972717e68ccd0dfe0363fd97ca435ecc4
6
+ metadata.gz: 7a8116d55e09e785113aa8591a2ea3827f45bbe566413b323f3d8712a43dc84a7e21f1c0987c06b4ef5199a5ebf569d9237674ac949011e63aaad527bf725c2a
7
+ data.tar.gz: e4e034189b5e8307d5454a2a59a7e5c50e8ebf33813163f9eb241e9f9e4ede44e3f31364cf912a4e2992f156df4ac99de75a401a7ed8112cfbce4d7b89157215
data/README.md CHANGED
@@ -73,10 +73,12 @@ the decoding of the Google ID Token using the google-id-token library. Interroga
73
73
  for profile details is particularly helpful when you use Google for signup, as you can get the name, email
74
74
  address, avatar url, and locale through it.
75
75
 
76
- ## Outstanding work
76
+ ## Compatibility with Turbolinks
77
77
 
78
- - Proper testing. Need to generate a test client_id/google id token combo that we can use to test with.
79
- - Not much more. I'm seeking to keep this simple, just for signin/signup, not general Google integration.
78
+ Google's JavaScript doesn't play nice with Turbolinks. We've routed around the damage by adding a [Turbolinks
79
+ meta tag](https://github.com/turbolinks/turbolinks/blob/master/README.md#ensuring-specific-pages-trigger-a-full-reload)
80
+ on whatever page `google_sign_in` is called to always do a full reload for that page. Note that this
81
+ auto-compatibility feature requires Turbolinks 5.1+.
80
82
 
81
83
  ## License
82
84
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'google_sign_in'
3
- s.version = '0.1.3'
3
+ s.version = '0.1.4'
4
4
  s.authors = 'David Heinemeier Hansson'
5
5
  s.email = 'david@basecamp.com'
6
6
  s.summary = 'Sign in (or up) with Google for Rails applications'
@@ -5,7 +5,8 @@ module GoogleSignIn
5
5
  def google_sign_in(**form_options, &block)
6
6
  content_for :head,
7
7
  google_sign_in_javacript_include_tag +
8
- google_sign_in_client_id_meta_tag
8
+ google_sign_in_client_id_meta_tag +
9
+ turbolinks_reload_meta_tag
9
10
 
10
11
  google_sign_in_javascript_tag +
11
12
  google_sign_in_hidden_form_tag(**form_options) +
@@ -16,14 +17,17 @@ module GoogleSignIn
16
17
  def google_sign_in_javacript_include_tag
17
18
  javascript_include_tag "https://apis.google.com/js/api.js", async: true, defer: true,
18
19
  onload: "this.onload=function(){};setupGoogleSignIn()",
19
- onreadystatechange: "if (this.readyState === 'complete') this.onload()",
20
- data: { turbolinks_track: :reload, force_turbolinks_reload: Time.now.to_i }
20
+ onreadystatechange: "if (this.readyState === 'complete') this.onload()"
21
21
  end
22
22
 
23
23
  def google_sign_in_client_id_meta_tag
24
24
  tag.meta name: "google-signin-client_id", content: GoogleSignIn::Identity.client_id
25
25
  end
26
26
 
27
+ def turbolinks_reload_meta_tag
28
+ tag.meta name: "turbolinks-visit-control", content: "reload"
29
+ end
30
+
27
31
  def google_sign_in_hidden_form_tag(**options)
28
32
  options.reverse_merge!(html: { style: "display: none" })
29
33
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_sign_in
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-21 00:00:00.000000000 Z
11
+ date: 2018-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  requirements: []
92
92
  rubyforge_project:
93
- rubygems_version: 2.5.1
93
+ rubygems_version: 2.7.3
94
94
  signing_key:
95
95
  specification_version: 4
96
96
  summary: Sign in (or up) with Google for Rails applications