mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Move rendering logic of terms to helper
Preparing for a third option to display.
This commit is contained in:
@@ -1,6 +1,16 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module TermsAndConditionsHelper
|
||||
def render_terms_and_conditions
|
||||
if platform_terms_required? && terms_and_conditions_activated?
|
||||
render("checkout/terms_and_conditions") + render("checkout/platform_terms_of_service")
|
||||
elsif platform_terms_required?
|
||||
render "checkout/platform_terms_of_service"
|
||||
elsif terms_and_conditions_activated?
|
||||
render "checkout/terms_and_conditions"
|
||||
end
|
||||
end
|
||||
|
||||
def platform_terms_required?
|
||||
Spree::Config.shoppers_require_tos
|
||||
end
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
= render "checkout/shipping", f: f
|
||||
= render "checkout/payment", f: f
|
||||
= render "checkout/already_ordered", f: f if show_bought_items?
|
||||
= render "checkout/terms_and_conditions"
|
||||
= render "checkout/platform_terms_of_service" if platform_terms_required?
|
||||
= render_terms_and_conditions
|
||||
%p
|
||||
%button.button.primary{ type: :submit, ng: { disabled: "terms_and_conditions_accepted == false || platform_tos_accepted == false" } }
|
||||
= t :checkout_send
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
- if terms_and_conditions_activated?
|
||||
%p
|
||||
%input{ type: 'checkbox', id: 'accept_terms', ng: { model: "terms_and_conditions_accepted", init: "terms_and_conditions_accepted=#{terms_and_conditions_already_accepted?}" } }
|
||||
%label.small{for: "accept_terms"}= t('.message_html', terms_and_conditions_link: link_to( t( '.link_text' ), current_order.distributor.terms_and_conditions.url, target: '_blank'))
|
||||
%p
|
||||
%input{ type: 'checkbox', id: 'accept_terms', ng: { model: "terms_and_conditions_accepted", init: "terms_and_conditions_accepted=#{terms_and_conditions_already_accepted?}" } }
|
||||
%label.small{for: "accept_terms"}= t('.message_html', terms_and_conditions_link: link_to( t( '.link_text' ), current_order.distributor.terms_and_conditions.url, target: '_blank'))
|
||||
|
||||
Reference in New Issue
Block a user