refactors recaptchable helper [#45]

This commit is contained in:
rgarcia
2015-07-28 18:32:45 +02:00
parent c5bfc9420f
commit 81a5ddb580
3 changed files with 4 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
module RecaptchaHelper module RecaptchaHelper
def recaptchable? def recaptchable?(resource)
@debate.new_record? resource.new_record?
end end
def recaptcha_keys? def recaptcha_keys?

View File

@@ -30,7 +30,7 @@
<%= t("debates.form.accept_terms") %> <%= t("debates.form.accept_terms") %>
<% end %> <% end %>
<%= render 'shared/captcha' %> <%= render 'shared/captcha', resource: @debate %>
<div class="actions"> <div class="actions">
<%= f.submit %> <%= f.submit %>

View File

@@ -1,3 +1,3 @@
<% if recaptchable? and recaptcha_keys? %> <% if recaptchable?(resource) and recaptcha_keys? %>
<%= recaptcha_tags ajax: true, hl: I18n.locale %> <%= recaptcha_tags ajax: true, hl: I18n.locale %>
<% end %> <% end %>