rails_cloudflare_turnstile 0.2.0 → 0.2.1

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
2
  SHA256:
3
- metadata.gz: 72dc292372557cd074ad5849a4bd3de12b55d56d53b14a57ca248f9e406bf17a
4
- data.tar.gz: 2b6b02151805b3e04a0970e8cfc0ed8d6231fb006547c17e8353c21a66b87f23
3
+ metadata.gz: 756316e7b956c4e4e61943b295fb036a496b6b198233a127b40f4de8db5f16ca
4
+ data.tar.gz: b2adce2585dee4b6d06d4450b254b35dfdf0098623f674fff9eb0377afa20d1d
5
5
  SHA512:
6
- metadata.gz: d6f8af28dd1ae7581d2a47124e81fd9a34e2a168d3b6cd8dfaf1f19bce732b57e8e0b86b637cc39023ba66a81c16757076842f3989f5bfe05f1a4f228f2e27f7
7
- data.tar.gz: c4d387d37d0c0a2c01a30da6c5e85566517b7c14f12eb753513b32fa97d3dfd3f80408e3b1749f5cd82629e4d524ee5a07985ff0436dbce98467ffa4d5239b7d
6
+ metadata.gz: 39d83f63d49afc9e6b355a4a661cc59fd03615dff420fc4b4559ce02befd932f0ef1a8e8813d5c0aeffa37df0330d54e6fceab54b7b9c2c6c5aee3f459cc2c63
7
+ data.tar.gz: e6183c1964960b206d38d5a5f7530d40da406746e2b8f678e579c98c4a6354c168f6cda21a2aa09d91d0c0f2959ec31e409a7f3a9cf89ad8835665f74809293a
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  ChangeLog
2
2
  =========
3
3
 
4
+ 0.2.1
5
+ -----
6
+ - Add support for passing arbitary keyword arguments to the underlying `content_tag` from the `cloudflare_turnstile` helper
7
+
4
8
  0.2.0
5
9
  -----
6
10
  - drop support for Ruby 2.7
data/README.md CHANGED
@@ -38,7 +38,7 @@ To totally disable Turnstile, you can set `c.enabled = false` and all other conf
38
38
  To use Turnstile for a view:
39
39
 
40
40
  1. Call `cloudflare_turnstile_script_tag` in your layout
41
- 2. Call `cloudflare_turnstile` in your form View
41
+ 2. Call `cloudflare_turnstile` in your form View. Keyword arguments are passed to the tag helper (for example, to set the `tabindex` option, you could use `cloudflare_turnstile(data: {tabindex: 0})`)
42
42
  3. Call `validate_cloudflare_turnstile` as a `before_action` in your controller.
43
43
 
44
44
  If the challenge fails, the exception `RailsCloudflareTurnstile::Forbidden` will be raised; you should handle this with
@@ -1,3 +1,3 @@
1
1
  module RailsCloudflareTurnstile
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -2,14 +2,14 @@
2
2
 
3
3
  module RailsCloudflareTurnstile
4
4
  module ViewHelpers
5
- def cloudflare_turnstile(action: "other", data_callback: nil)
5
+ def cloudflare_turnstile(action: "other", data_callback: nil, **html_options)
6
6
  if RailsCloudflareTurnstile.enabled?
7
7
  content_tag(:div, class: "cloudflare-turnstile") do
8
- concat turnstile_div(action, data_callback: data_callback)
8
+ concat turnstile_div(action, data_callback: data_callback, **html_options)
9
9
  end
10
10
  elsif RailsCloudflareTurnstile.mock_enabled?
11
11
  content_tag(:div, class: "cloudflare-turnstile") do
12
- concat mock_turnstile_div(action, data_callback: data_callback)
12
+ concat mock_turnstile_div(action, data_callback: data_callback, **html_options)
13
13
  end
14
14
  end
15
15
  end
@@ -28,15 +28,15 @@ module RailsCloudflareTurnstile
28
28
 
29
29
  private
30
30
 
31
- def turnstile_div(action, data_callback: nil)
31
+ def turnstile_div(action, data_callback: nil, **html_options)
32
32
  config = RailsCloudflareTurnstile.configuration
33
- content_tag(:div, :class => "cf-turnstile", "data-sitekey" => site_key, "data-size" => config.size, "data-action" => action, "data-callback" => data_callback, "data-theme" => config.theme) do
33
+ content_tag(:div, :class => "cf-turnstile", "data-sitekey" => site_key, "data-size" => config.size, "data-action" => action, "data-callback" => data_callback, "data-theme" => config.theme, **html_options) do
34
34
  ""
35
35
  end
36
36
  end
37
37
 
38
- def mock_turnstile_div(action, data_callback: nil)
39
- content_tag(:div, :class => "cf-turnstile", :style => "width: 300px; height: 65px; border: 1px solid gray; display: flex; flex-direction: row; justify-content: center; align-items: center; margin: 10px;", "data-callback" => data_callback) do
38
+ def mock_turnstile_div(action, data_callback: nil, **html_options)
39
+ content_tag(:div, :class => "cf-turnstile", :style => "width: 300px; height: 65px; border: 1px solid gray; display: flex; flex-direction: row; justify-content: center; align-items: center; margin: 10px;", "data-callback" => data_callback, **html_options) do
40
40
  [
41
41
  tag.input(type: "hidden", name: "cf-turnstile-response", value: "mocked"),
42
42
  image_tag("turnstile-logo.svg"),
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_cloudflare_turnstile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Brown
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-08 00:00:00.000000000 Z
11
+ date: 2024-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
96
  requirements: []
97
- rubygems_version: 3.5.3
97
+ rubygems_version: 3.5.9
98
98
  signing_key:
99
99
  specification_version: 4
100
100
  summary: Rails extension for Cloudflare's Turnstile CAPTCHA alternative