Created
June 9, 2015 05:21
-
-
Save amolpujari/dc92e31388b5c8207206 to your computer and use it in GitHub Desktop.
show_simple_captcha in a liquid template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Liquid | |
| module Tags | |
| module SimpleCaptcha | |
| class HumanTest < ::Liquid::Tag | |
| include ::ActionView::Helpers::FormTagHelper | |
| include ::SimpleCaptcha::ViewHelper | |
| attr_accessor :request, :session | |
| def render(context) | |
| controller = context.registers[:controller] | |
| self.request = controller.request | |
| self.session = controller.session | |
| context.registers[:controller].send(:render_to_string, :partial => ::SimpleCaptcha.partial_path, :locals => { :registers => context.registers, :simple_captcha_options => simple_captcha_options({}) }) | |
| end | |
| end | |
| end | |
| ::Liquid::Template.register_tag('show_simple_captcha_tag', SimpleCaptcha::HumanTest) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment