From 63b40be6f280373c26eb043a186f87536ad4d285 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 7 Mar 2019 10:29:08 +0800 Subject: [PATCH 1/2] Use tag helper generate captcha img for avoid CDN prefix on image_tag. #73 Add onclick event for captcha img, to click refresh #61 --- lib/rucaptcha/view_helpers.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/rucaptcha/view_helpers.rb b/lib/rucaptcha/view_helpers.rb index 2ecbe36..304ac71 100644 --- a/lib/rucaptcha/view_helpers.rb +++ b/lib/rucaptcha/view_helpers.rb @@ -13,7 +13,9 @@ module RuCaptcha def rucaptcha_image_tag(opts = {}) opts[:class] = opts[:class] || 'rucaptcha-image' - image_tag(ru_captcha.root_path, opts) + opts[:src] = ru_captcha.root_path + opts[:onclick] = "this.src = '#{ru_captcha.root_path}?t=' + Date.now();" + tag(:img, opts) end end end From bf517202c03acb7229d2d827f4d0548274281ef3 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 7 Mar 2019 10:30:51 +0800 Subject: [PATCH 2/2] version 2.5.0 --- CHANGELOG.md | 6 ++++++ Gemfile.lock | 2 +- lib/rucaptcha/version.rb | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e417024..491c8b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +2.5.0 +------- + +- Support click captcha image to refresh new one by default. +- Use simple tag helper generate captcha img html, for avoid asset_host (#73). + 2.4.0 ------- diff --git a/Gemfile.lock b/Gemfile.lock index 3e41920..bc97720 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - rucaptcha (2.4.0) + rucaptcha (2.5.0) railties (>= 3.2) GEM diff --git a/lib/rucaptcha/version.rb b/lib/rucaptcha/version.rb index 105d477..eeb2542 100644 --- a/lib/rucaptcha/version.rb +++ b/lib/rucaptcha/version.rb @@ -1,3 +1,3 @@ module RuCaptcha - VERSION = '2.4.0' + VERSION = '2.5.0' end