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 8, 2018
1 parent e5fe62f commit 438174b
Show file tree
Hide file tree
Showing 39 changed files with 997 additions and 63 deletions.
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: '86bf87f1b1e1b299edc8cd10a2486e44ba0a3987'
gem 'spree_i18n', github: 'spree/spree_i18n', branch: '1-3-stable'
Expand Down
9 changes: 8 additions & 1 deletion 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 @@ -806,6 +812,7 @@ DEPENDENCIES
uglifier (>= 1.0.3)
unicorn
unicorn-rails
web!
webmock
whenever
wicked_pdf
Expand All @@ -815,4 +822,4 @@ RUBY VERSION
ruby 2.1.5p273

BUNDLED WITH
1.16.1
1.16.2
26 changes: 0 additions & 26 deletions app/controllers/api/cookies_consent_controller.rb

This file was deleted.

1 change: 1 addition & 0 deletions app/controllers/base_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'spree/core/controller_helpers/respond_with_decorator'
require 'open_food_network/tag_rule_applicator'
require 'web/cookies_consent'

class BaseController < ApplicationController
include Spree::Core::ControllerHelpers
Expand Down
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: 1 addition & 1 deletion app/views/shared/_footer.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
= 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)
- 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)
- 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 }
Expand Down
8 changes: 3 additions & 5 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,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 @@ -229,6 +225,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
Expand Down Expand Up @@ -319,5 +318,4 @@
get :order_cycle_expired, :on => :collection
put :cancel, on: :member
end

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 438174b

Please sign in to comment.