diff --git a/app/components/budgets/investments/form_component.html.erb b/app/components/budgets/investments/form_component.html.erb index 25a886bd8..f5aa72e31 100644 --- a/app/components/budgets/investments/form_component.html.erb +++ b/app/components/budgets/investments/form_component.html.erb @@ -89,10 +89,7 @@
<% unless current_user.manager? || investment.persisted? %>
- <%= f.check_box :terms_of_service, - label: t("form.accept_terms", - policy: link_to(t("form.policy"), "/privacy", target: "_blank"), - conditions: link_to(t("form.conditions"), "/conditions", target: "_blank")) %> + <%= render Shared::AgreeWithTermsOfServiceFieldComponent.new(f) %>
<% end %> diff --git a/app/components/debates/form_component.html.erb b/app/components/debates/form_component.html.erb index 5df529206..1816d437c 100644 --- a/app/components/debates/form_component.html.erb +++ b/app/components/debates/form_component.html.erb @@ -41,10 +41,7 @@
<% if debate.new_record? %>
- <%= f.check_box :terms_of_service, - label: t("form.accept_terms", - policy: link_to(t("form.policy"), "/privacy", target: "_blank"), - conditions: link_to(t("form.conditions"), "/conditions", target: "_blank")) %> + <%= render Shared::AgreeWithTermsOfServiceFieldComponent.new(f) %>
<% end %> diff --git a/app/components/proposals/form_component.html.erb b/app/components/proposals/form_component.html.erb index b77eba8a7..c4467fe7d 100644 --- a/app/components/proposals/form_component.html.erb +++ b/app/components/proposals/form_component.html.erb @@ -96,10 +96,7 @@
<% if proposal.new_record? %>
- <%= f.check_box :terms_of_service, - label: t("form.accept_terms", - policy: link_to(t("form.policy"), "/privacy", target: "_blank"), - conditions: link_to(t("form.conditions"), "/conditions", target: "_blank")) %> + <%= render Shared::AgreeWithTermsOfServiceFieldComponent.new(f) %>
<% end %> diff --git a/app/components/shared/agree_with_terms_of_service_field_component.html.erb b/app/components/shared/agree_with_terms_of_service_field_component.html.erb new file mode 100644 index 000000000..dcfcb0e32 --- /dev/null +++ b/app/components/shared/agree_with_terms_of_service_field_component.html.erb @@ -0,0 +1 @@ +<%= form.check_box :terms_of_service, label: label %> diff --git a/app/components/shared/agree_with_terms_of_service_field_component.rb b/app/components/shared/agree_with_terms_of_service_field_component.rb new file mode 100644 index 000000000..808dbe812 --- /dev/null +++ b/app/components/shared/agree_with_terms_of_service_field_component.rb @@ -0,0 +1,15 @@ +class Shared::AgreeWithTermsOfServiceFieldComponent < ApplicationComponent + attr_reader :form + + def initialize(form) + @form = form + end + + private + + def label + t("form.accept_terms", + policy: link_to(t("form.policy"), "/privacy", target: "_blank"), + conditions: link_to(t("form.conditions"), "/conditions", target: "_blank")) + end +end diff --git a/app/views/legislation/proposals/_form.html.erb b/app/views/legislation/proposals/_form.html.erb index 179d1bb4b..0bea7d205 100644 --- a/app/views/legislation/proposals/_form.html.erb +++ b/app/views/legislation/proposals/_form.html.erb @@ -62,10 +62,7 @@
<% if @proposal.new_record? %> - <%= f.check_box :terms_of_service, - label: t("form.accept_terms", - policy: link_to(t("form.policy"), "/privacy", target: "_blank"), - conditions: link_to(t("form.conditions"), "/conditions", target: "_blank")) %> + <%= render Shared::AgreeWithTermsOfServiceFieldComponent.new(f) %> <% end %>