mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-05 14:41:53 +08:00
put recaptcha in helper method
This commit is contained in:
parent
88890ab65b
commit
48ac289b6e
2 changed files with 18 additions and 6 deletions
17
app/helpers/form_tag_helper.rb
Normal file
17
app/helpers/form_tag_helper.rb
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
module FormTagHelper
|
||||||
|
def recaptcha_input_tag
|
||||||
|
if Rails.configuration.x.enable_recaptcha
|
||||||
|
res = "<div class='form-group "
|
||||||
|
res << 'has-error' if flash[:recaptcha_error]
|
||||||
|
res << "'>"
|
||||||
|
res << recaptcha_tags
|
||||||
|
if flash[:recaptcha_error]
|
||||||
|
res << "<span class='help-block'>"
|
||||||
|
res << flash[:recaptcha_error]
|
||||||
|
res << '</span>'
|
||||||
|
end
|
||||||
|
res << '</div>'
|
||||||
|
res.html_safe
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -38,12 +38,7 @@
|
||||||
<span><small><%= t 'users.registrations.new.team_name_help' %></small></span>
|
<span><small><%= t 'users.registrations.new.team_name_help' %></small></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if Rails.configuration.x.enable_recaptcha %>
|
<%= recaptcha_input_tag %>
|
||||||
<div class="form-group">
|
|
||||||
<%= recaptcha_tags %>
|
|
||||||
<%= flash[:recaptcha_error] %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= f.submit "Sign up", class: "btn btn-primary" %>
|
<%= f.submit "Sign up", class: "btn btn-primary" %>
|
||||||
|
|
Loading…
Reference in a new issue