diff --git a/app/assets/javascripts/darkswarm/cookies_banner/cookies_banner_directive.js.coffee b/app/assets/javascripts/darkswarm/cookies_banner/cookies_banner_directive.js.coffee index f3553018a2..ede3b1c9bf 100644 --- a/app/assets/javascripts/darkswarm/cookies_banner/cookies_banner_directive.js.coffee +++ b/app/assets/javascripts/darkswarm/cookies_banner/cookies_banner_directive.js.coffee @@ -1,5 +1,6 @@ Darkswarm.directive 'cookiesBanner', (CookiesBannerService) -> restrict: 'A' link: (scope, elm, attr)-> + return if not attr.cookiesBanner? || attr.cookiesBanner == 'false' CookiesBannerService.setActive() CookiesBannerService.open() diff --git a/app/models/spree/app_configuration_decorator.rb b/app/models/spree/app_configuration_decorator.rb index b083edebc5..7eaedb1cce 100644 --- a/app/models/spree/app_configuration_decorator.rb +++ b/app/models/spree/app_configuration_decorator.rb @@ -8,8 +8,10 @@ Spree::AppConfiguration.class_eval do preference :enable_embedded_shopfronts, :boolean, default: false preference :embedded_shopfronts_whitelist, :text, default: nil - # Terms of Service Preferences + # Legal Preferences preference :enterprises_require_tos, :boolean, default: false + preference :privacy_policy_url, :string, default: nil + preference :cookies_consent_banner_toggle, :boolean, default: false # Tax Preferences preference :products_require_tax_category, :boolean, default: false diff --git a/app/overrides/spree/admin/general_settings/edit/legal_settings.html.haml.deface b/app/overrides/spree/admin/general_settings/edit/legal_settings.html.haml.deface new file mode 100644 index 0000000000..caa8ca6c5e --- /dev/null +++ b/app/overrides/spree/admin/general_settings/edit/legal_settings.html.haml.deface @@ -0,0 +1,13 @@ +/ insert_after "fieldset.security" + +%fieldset.legal.no-border-bottom + %legend{:align => "center"}= t('.legal_settings') + .field + = preference_field_tag(:enterprises_require_tos, Spree::Config[:enterprises_require_tos], :type => Spree::Config.preference_type(:enterprises_require_tos)) + = label_tag(:enterprises_require_tos, t('.enterprises_require_tos')) + tag(:br) + .field + = preference_field_tag(:cookies_consent_banner_toggle, Spree::Config[:cookies_consent_banner_toggle], :type => Spree::Config.preference_type(:cookies_consent_banner_toggle)) + = label_tag(:cookies_consent_banner_toggle, t('.cookies_consent_banner_toggle')) + tag(:br) + .field + = label_tag(:privacy_policy_url, t('.privacy_policy_url')) + tag(:br) + = preference_field_tag(:privacy_policy_url, Spree::Config[:privacy_policy_url], type: Spree::Config.preference_type(:privacy_policy_url)) diff --git a/app/overrides/spree/admin/general_settings/edit/tos_settings.html.haml.deface b/app/overrides/spree/admin/general_settings/edit/tos_settings.html.haml.deface deleted file mode 100644 index e0a588d740..0000000000 --- a/app/overrides/spree/admin/general_settings/edit/tos_settings.html.haml.deface +++ /dev/null @@ -1,7 +0,0 @@ -/ insert_after "fieldset.security" - -%fieldset.enterprise_toc.no-border-bottom - %legend{:align => "center"}= t(:enterprise_terms_of_service) - .field - = preference_field_tag(:enterprises_require_tos, Spree::Config[:enterprises_require_tos], :type => Spree::Config.preference_type(:enterprises_require_tos)) - = label_tag(:enterprises_require_tos, t(:enterprises_require_tos)) + tag(:br) diff --git a/app/views/shared/_footer.html.haml b/app/views/shared/_footer.html.haml index 22eaff9bfa..d8a48902dc 100644 --- a/app/views/shared/_footer.html.haml +++ b/app/views/shared/_footer.html.haml @@ -11,33 +11,32 @@ .row .small-12.medium-4.medium-offset-2.columns.text-center %h6 - = t :footer_global_headline + = t '.footer_global_headline' %p %a{href: "http://www.openfoodnetwork.org", target: "_blank"} - = t :footer_global_home + = t '.footer_global_home' %span | %a{href: "http://www.openfoodnetwork.org/news/", target: "_blank"} - = t :footer_global_news + = t '.footer_global_news' %span | %a{href: "http://www.openfoodnetwork.org/about/history-team/", target: "_blank"} - = t :footer_global_about + = t '.footer_global_about' %span | %a{href: "http://www.openfoodnetwork.org/contact/", target: "_blank"} - = t :footer_global_contact - + = t '.footer_global_contact' .small-12.medium-4.columns.text-center %h6 - = t :footer_sites_headline + = t '.footer_sites_headline' %p %a{href: "http://dev.openfoodnetwork.org", target: "_blank"} - = t :footer_sites_developer + = t '.footer_sites_developer' %span | %a{href: "http://community.openfoodnetwork.org", target: "_blank"} - = t :footer_sites_community + = t '.footer_sites_community' %span | %a{href: "http://www.openfoodnetwork.org/platform/user-guide/", target: "_blank"} - = t :footer_sites_userguide + = t '.footer_sites_userguide' .medium-2.columns.text-center / Placeholder @@ -49,9 +48,9 @@ %i.ofn-i_017-locked .small-12.medium-6.columns.text-center %p.text-big.secure-text - = t :footer_secure + = t '.footer_secure' %p.secure-text - = t :footer_secure_text + = t '.footer_secure_text' .small-12.medium-2.columns .row @@ -63,7 +62,7 @@ .small-6.medium-3.medium-offset-2.columns.text-left // This is the instance-managed set of links: %h4 - = t :footer_contact_headline + = t '.footer_contact_headline' %p.social-icons - if ContentConfig.footer_facebook_url.present? %a{href: ContentConfig.footer_facebook_url} @@ -86,13 +85,13 @@ - if ContentConfig.footer_email.present? %p %a{href: ContentConfig.footer_email.reverse, mailto: true, target: '_blank'} - = t :footer_contact_email + = t '.footer_contact_email' = render_markdown(ContentConfig.footer_links_md).html_safe .small-6.medium-3.columns.text-left %h4 - = t :footer_nav_headline + = t '.footer_nav_headline' %p %a{href: "/shops"} = t :label_shops @@ -111,11 +110,11 @@ .small-12.medium-2.columns.text-left %h4 - = t :footer_join_headline + = t '.footer_join_headline' %p - = t :footer_join_body + = t '.footer_join_body' %a{href: "/sell"} - = t :footer_join_cta + = t '.footer_join_cta' .medium-2.columns.text-center / Placeholder @@ -131,21 +130,22 @@ %img{src: ContentConfig.footer_logo.url, width: "220"} .small-12.medium-5.columns.text-left %p.text-small - = t :footer_legal_call + = t '.footer_legal_call' %a{href: ContentConfig.footer_tos_url} - = t :footer_legal_tos + = t '.footer_legal_tos' | - = t :footer_legal_visit + = t '.footer_legal_visit' %a{href:"https://github.com/openfoodfoundation/openfoodnetwork", target: "_blank"} GitHub %p.text-small - = t :footer_legal_text_html, {content_license: link_to('CC BY-SA 3.0', 'https://creativecommons.org/licenses/by-sa/3.0/'), code_license: link_to('AGPL 3', 'https://tldrlegal.com/license/gnu-affero-general-public-license-v3-(agpl-3.0)')} + = t '.footer_legal_text_html', {content_license: link_to('CC BY-SA 3.0', 'https://creativecommons.org/licenses/by-sa/3.0/'), code_license: link_to('AGPL 3', 'https://tldrlegal.com/license/gnu-affero-general-public-license-v3-(agpl-3.0)' )} %p.text-small %div - = t :footer_legal_data_text - = t :footer_legal_data_call - %a{'cookies-policy-modal'=> true, 'cookies-banner'=> !CookiesConsent.new(cookies, request.host).exists? } - = t :footer_legal_data_cookies_policy - + - cookies_policy_link = link_to( t( '.footer_data_cookies_policy' ), '', 'cookies-policy-modal' => true, 'cookies-banner' => !CookiesConsent.new(cookies, request.host).exists? && Spree::Config.cookies_consent_banner_toggle) + - privacy_policy_link = link_to( t( '.footer_data_privacy_policy' ), Spree::Config.privacy_policy_url, :target => '_blank' ) + - if Spree::Config.privacy_policy_url.present? + = t '.footer_data_text_with_privacy_policy_html', {cookies_policy: cookies_policy_link.html_safe, privacy_policy: privacy_policy_link.html_safe } + - else + = t '.footer_data_text_without_privacy_policy_html', {cookies_policy: cookies_policy_link.html_safe } .medium-2.columns.text-center / Placeholder -if ENV['SKYLIGHT_PUBLIC_DASHBOARD_URL'].present? @@ -157,4 +157,4 @@ .row .small-12.medium-8.medium-offset-2.columns.text-center .text.small - = t :footer_skylight_dashboard_html, {dashboard: link_to('Skylight', ENV['SKYLIGHT_PUBLIC_DASHBOARD_URL'], target: "_blank")} + = t '.footer_skylight_dashboard_html', {dashboard: link_to('Skylight', ENV['SKYLIGHT_PUBLIC_DASHBOARD_URL'], target: "_blank")} diff --git a/config/locales/en.yml b/config/locales/en.yml index 1397a77056..f9a6fa032a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1099,6 +1099,33 @@ en: register_call: selling_on_ofn: "Interested in getting on the Open Food Network?" register: "Register here" + footer: + footer_global_headline: "OFN Global" + footer_global_home: "Home" + footer_global_news: "News" + footer_global_about: "About" + footer_global_contact: "Contact" + footer_sites_headline: "OFN Sites" + footer_sites_developer: "Developer" + footer_sites_community: "Community" + footer_sites_userguide: "User Guide" + footer_secure: "Secure and trusted." + footer_secure_text: "Open Food Network uses SSL encryption (2048 bit RSA) everywhere to keep your shopping and payment information private. Our servers do not store your credit card details and payments are processed by PCI-compliant services." + footer_contact_headline: "Keep in touch" + footer_contact_email: "Email us" + footer_nav_headline: "Navigate" + footer_join_headline: "Join us" + footer_join_body: "Create a listing, shop or group directory on the Open Food Network." + footer_join_cta: "Tell me more!" + footer_legal_call: "Read our" + footer_legal_tos: "Terms and conditions" + footer_legal_visit: "Find us on" + footer_legal_text_html: "Open Food Network is a free and open source software platform. Our content is licensed with %{content_license} and our code with %{code_license}." + footer_data_text_with_privacy_policy_html: "We take good care of your data. See our %{privacy_policy} and %{cookies_policy}" + footer_data_text_without_privacy_policy_html: "We take good care of your data. See our %{cookies_policy}" + footer_data_privacy_policy: "privacy policy" + footer_data_cookies_policy: "cookies policy" + footer_skylight_dashboard_html: Performance data is available on %{dashboard}. shop: messages: login: "login" @@ -1238,36 +1265,6 @@ en: ie_warning_ie: Upgrade Internet Explorer ie_warning_other: "Can't upgrade your browser? Try Open Food Network on your smartphone :-)" - footer_global_headline: "OFN Global" - footer_global_home: "Home" - footer_global_news: "News" - footer_global_about: "About" - footer_global_contact: "Contact" - - footer_sites_headline: "OFN Sites" - footer_sites_developer: "Developer" - footer_sites_community: "Community" - footer_sites_userguide: "User Guide" - - footer_secure: "Secure and trusted." - footer_secure_text: "Open Food Network uses SSL encryption (2048 bit RSA) everywhere to keep your shopping and payment information private. Our servers do not store your credit card details and payments are processed by PCI-compliant services." - - footer_contact_headline: "Keep in touch" - footer_contact_email: "Email us" - - footer_nav_headline: "Navigate" - footer_join_headline: "Join us" - footer_join_body: "Create a listing, shop or group directory on the Open Food Network." - footer_join_cta: "Tell me more!" - - footer_legal_call: "Read our" - footer_legal_tos: "Terms and conditions" - footer_legal_visit: "Find us on" - footer_legal_text_html: "Open Food Network is a free and open source software platform. Our content is licensed with %{content_license} and our code with %{code_license}." - footer_legal_data_text: "We take good care of your data." - footer_legal_data_call: "See our" - footer_legal_data_cookies_policy: "cookies policy" - footer_skylight_dashboard_html: Performance data is available on %{dashboard}. legal: cookies_policy: header: "How We Use Cookies" @@ -2095,12 +2092,12 @@ See the %{link} to find out more about %{sitename}'s features and to start using order_cycles: "Order Cycles" enterprise_relationships: "Enterprise permissions" remove_tax: "Remove tax" - enterprise_terms_of_service: "Enterprise Terms of Service" - enterprises_require_tos: "Enterprises must accept Terms of Service" + enterprise_tos_link: "Enterprise Terms of Service link" enterprise_tos_message: "We want to work with people that share our aims and values. As such we ask new enterprises to agree to our " enterprise_tos_link_text: "Terms of Service." enterprise_tos_agree: "I agree to the above Terms of Service" + tax_settings: "Tax Settings" products_require_tax_category: "products require tax category" admin_shared_address_1: "Address" @@ -2650,6 +2647,12 @@ See the %{link} to find out more about %{sitename}'s features and to start using variants: autocomplete: producer_name: Producer + general_settings: + edit: + legal_settings: "Legal Settings" + cookies_consent_banner_toggle: "Display cookies consent banner" + privacy_policy_url: "Privacy Policy URL" + enterprises_require_tos: "Enterprises must accept Terms of Service" checkout: payment: stripe: