From 48ac289b6e7899659488ad8b8b31763c86b1f994 Mon Sep 17 00:00:00 2001 From: Mojca Lorber Date: Tue, 22 Nov 2016 17:57:42 +0100 Subject: [PATCH] put recaptcha in helper method --- app/helpers/form_tag_helper.rb | 17 +++++++++++++++++ app/views/users/registrations/new.html.erb | 7 +------ 2 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 app/helpers/form_tag_helper.rb diff --git a/app/helpers/form_tag_helper.rb b/app/helpers/form_tag_helper.rb new file mode 100644 index 000000000..0d16834cf --- /dev/null +++ b/app/helpers/form_tag_helper.rb @@ -0,0 +1,17 @@ +module FormTagHelper + def recaptcha_input_tag + if Rails.configuration.x.enable_recaptcha + res = "
" + res << recaptcha_tags + if flash[:recaptcha_error] + res << "" + res << flash[:recaptcha_error] + res << '' + end + res << '
' + res.html_safe + end + end +end diff --git a/app/views/users/registrations/new.html.erb b/app/views/users/registrations/new.html.erb index cdc6117b9..19685cd9d 100644 --- a/app/views/users/registrations/new.html.erb +++ b/app/views/users/registrations/new.html.erb @@ -38,12 +38,7 @@ <%= t 'users.registrations.new.team_name_help' %> - <% if Rails.configuration.x.enable_recaptcha %> -
- <%= recaptcha_tags %> - <%= flash[:recaptcha_error] %> -
- <% end %> + <%= recaptcha_input_tag %>
<%= f.submit "Sign up", class: "btn btn-primary" %>