Skip to content

Commit

Permalink
New domain Web (rails engine) with the following features extracted f…
Browse files Browse the repository at this point in the history
…rom the main app:

- cookies banner
- cookies policy page
- cookies policy and privacy policy links in the footer
  • Loading branch information
luisramos0 committed Sep 6, 2018
1 parent 0d2fa3d commit 9baa02d
Show file tree
Hide file tree
Showing 36 changed files with 868 additions and 64 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ AllCops:
- !ruby/regexp /old_and_unused\.rb$/
# The parser gem fails to parse this file with out current Ruby version.
- 'spec/factories.rb'
# Excluding: inadequate Naming/FileName rule rejects GemFile name with camelcase
- 'engines/web/Gemfile'

# OFN SETTINGS
# Cop settings that have been agreed upon by the OFN community
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ gem 'i18n-js', '~> 3.0.0'
# Patched version. See http://rubysec.com/advisories/CVE-2015-5312/.
gem 'nokogiri', '>= 1.6.7.1'

gem 'web', path: './engines/web'

gem 'pg'
gem 'spree', github: 'openfoodfoundation/spree', branch: 'step-6a', ref: '69db1c090f3711088d84b524f1b94d25e6d21616'
gem 'spree_i18n', github: 'spree/spree_i18n', branch: '1-3-stable'
Expand Down
6 changes: 6 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ GIT
activemodel (>= 3.0)
railties (>= 3.0)

PATH
remote: engines/web
specs:
web (0.0.1)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -802,6 +807,7 @@ DEPENDENCIES
uglifier (>= 1.0.3)
unicorn
unicorn-rails
web!
webmock
whenever
wicked_pdf
Expand Down
26 changes: 0 additions & 26 deletions app/controllers/api/cookies_consent_controller.rb

This file was deleted.

11 changes: 11 additions & 0 deletions app/helpers/footer_links_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'web/cookies_consent'

module FooterLinksHelper
def cookies_policy_link
link_to( t( '.footer_data_cookies_policy' ), '', 'cookies-policy-modal' => true, 'cookies-banner' => !Web::CookiesConsent.new(cookies, request.host).exists? && Spree::Config.cookies_consent_banner_toggle)
end

def privacy_policy_link
link_to( t( '.footer_data_privacy_policy' ), Spree::Config.privacy_policy_url, target: '_blank' )
end
end
29 changes: 0 additions & 29 deletions app/services/cookies_consent.rb

This file was deleted.

2 changes: 2 additions & 0 deletions app/views/layouts/darkswarm.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
%script{src: "//maps.googleapis.com/maps/api/js?libraries=places,geometry#{ ENV['GOOGLE_MAPS_API_KEY'] ? '&key=' + ENV['GOOGLE_MAPS_API_KEY'] : ''} "}
= split_stylesheet_link_tag "darkswarm/all"
= javascript_include_tag "darkswarm/all"
= split_stylesheet_link_tag "web/all"
= javascript_include_tag "web/all"

= render "layouts/i18n_script"
= render "layouts/bugherd_script"
Expand Down
2 changes: 0 additions & 2 deletions app/views/shared/_footer.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@
= 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
- 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
Expand Down
7 changes: 3 additions & 4 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,16 @@
get :job_queue
end

scope '/cookies' do
resource :consent, only: [:show, :create, :destroy], :controller => "cookies_consent"
end

resources :customers, only: [:index, :update]

post '/product_images/:product_id', to: 'product_images#update_product_image'
end

get 'sitemap.xml', to: 'sitemap#index', defaults: { format: 'xml' }

# Mount Web engine routes
mount Web::Engine, :at => '/'

# Mount Spree's routes
mount Spree::Core::Engine, :at => '/'
end
3 changes: 3 additions & 0 deletions engines/web/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.bundle/
log/*.log
pkg/
Loading

0 comments on commit 9baa02d

Please sign in to comment.