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 Aug 18, 2018
1 parent e0d1301 commit 27c941e
Show file tree
Hide file tree
Showing 39 changed files with 997 additions and 63 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
7 changes: 7 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ GIT
activemodel (>= 3.0)
railties (>= 3.0)

PATH
remote: engines/web
specs:
web (0.0.1)
rails (~> 3.2.22.5)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -804,6 +810,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
28 changes: 0 additions & 28 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 @@ -97,10 +97,6 @@
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'
Expand All @@ -114,6 +110,9 @@

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/
11 changes: 11 additions & 0 deletions engines/web/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
source "https://rubygems.org"

# Declare your gem's dependencies in web.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec

# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.
102 changes: 102 additions & 0 deletions engines/web/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
PATH
remote: .
specs:
web (0.0.1)
rails (~> 3.2.22.5)

GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.22.5)
actionpack (= 3.2.22.5)
mail (~> 2.5.4)
actionpack (3.2.22.5)
activemodel (= 3.2.22.5)
activesupport (= 3.2.22.5)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.22.5)
activesupport (= 3.2.22.5)
builder (~> 3.0.0)
activerecord (3.2.22.5)
activemodel (= 3.2.22.5)
activesupport (= 3.2.22.5)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.22.5)
activemodel (= 3.2.22.5)
activesupport (= 3.2.22.5)
activesupport (3.2.22.5)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
arel (3.0.3)
builder (3.0.4)
concurrent-ruby (1.0.5)
erubis (2.7.0)
hike (1.2.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
journey (1.0.4)
jquery-rails (3.1.5)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.6)
mail (2.5.5)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25.1)
multi_json (1.13.1)
polyglot (0.3.5)
rack (1.4.7)
rack-cache (1.8.0)
rack (>= 0.4)
rack-ssl (1.3.4)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (3.2.22.5)
actionmailer (= 3.2.22.5)
actionpack (= 3.2.22.5)
activerecord (= 3.2.22.5)
activeresource (= 3.2.22.5)
activesupport (= 3.2.22.5)
bundler (~> 1.0)
railties (= 3.2.22.5)
railties (3.2.22.5)
actionpack (= 3.2.22.5)
activesupport (= 3.2.22.5)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (12.3.1)
rdoc (3.12.2)
json (~> 1.4)
sprockets (2.2.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.13)
thor (0.20.0)
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.54)

PLATFORMS
ruby

DEPENDENCIES
jquery-rails
sqlite3
web!

BUNDLED WITH
1.16.2
Loading

0 comments on commit 27c941e

Please sign in to comment.