Files
openfoodnetwork/app/helpers/terms_and_conditions_helper.rb
David Rodríguez 4c6d894bc0 Bump RuboCop to 1.86.6
There were a few changes needed:

* Plugins are now specified through `plugin:` config keyword.
* All plugin gems need to be specified explicitly in Gemfile since they
  are no longer dependencies of plugins already specified explicitly.
* All plugin gems need to be updated in other to use the new APIs.
* One cop was renamed.
* New offenses safe to correct were corrected directly with `bundle exec
  rubocop -a`.
* New offenses unsafe to correct were added to the TODO configuration
  with `bundle exec rubocop --auto-gen-config --auto-gen-only-exclude
  --exclude-limit 1400 --no-auto-gen-timestamp`.
2025-10-27 11:30:33 +01:00

34 lines
983 B
Ruby

# frozen_string_literal: true
module TermsAndConditionsHelper
def link_to_platform_terms
content_tag(:a, t("terms_of_service"), href: TermsOfServiceFile.current_url, target: "_blank",
rel: "noopener")
end
def any_terms_required?(distributor)
TermsOfService.required?(distributor)
end
delegate :platform_terms_required?, to: :TermsOfService
def distributor_terms_required?
TermsOfService.distributor_terms_required?(current_order.distributor)
end
def all_terms_and_conditions_already_accepted?
platform_tos_already_accepted? && terms_and_conditions_already_accepted?
end
def platform_tos_already_accepted?
TermsOfService.tos_accepted?(spree_current_user&.customer_of(current_order.distributor))
end
def terms_and_conditions_already_accepted?
TermsOfService.tos_accepted?(
spree_current_user&.customer_of(current_order.distributor),
current_order.distributor
)
end
end