diff --git a/app/helpers/terms_and_conditions_helper.rb b/app/helpers/terms_and_conditions_helper.rb index 554272dcd8..1b86ce0dbe 100644 --- a/app/helpers/terms_and_conditions_helper.rb +++ b/app/helpers/terms_and_conditions_helper.rb @@ -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 diff --git a/app/views/checkout/_form.html.haml b/app/views/checkout/_form.html.haml index c63ed0f93f..84601fd410 100644 --- a/app/views/checkout/_form.html.haml +++ b/app/views/checkout/_form.html.haml @@ -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 diff --git a/app/views/checkout/_terms_and_conditions.html.haml b/app/views/checkout/_terms_and_conditions.html.haml index 13c0a1986e..e84b4b9c81 100644 --- a/app/views/checkout/_terms_and_conditions.html.haml +++ b/app/views/checkout/_terms_and_conditions.html.haml @@ -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'))