spree_analytics_trackers 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73068544992b2ab73b42d2d9973c61217f2e9006b1eeaf82bb487d0c06694253
4
- data.tar.gz: b5487f54f759141810e350a7aabe3c89870a2586d0f79c234c02a9a2f962c96d
3
+ metadata.gz: c6f1b28e6012acef941df826e5815966db364756eee0ed406993e7ffcfd2f3c8
4
+ data.tar.gz: a068b460859953446838873b5d89b09099e5567ab06cf65b3a2e7ebfaae4fd6e
5
5
  SHA512:
6
- metadata.gz: 961549e600a21cb31dad51459269e95f304c2540ad6e4603780a74548e77331507f0ffa9b7e64663915f9ade40107422e105ec4ab3e735b22c269176b7cb0ba6
7
- data.tar.gz: bb01db4431806581753611af24c40f6bfe60b9454c063a3907676bbecce138a2c5260a4e52290cecb9c05cb65e448c32056d6d91da7714b7250d7fd3987a4d22
6
+ metadata.gz: 8179531fa524a7e17aed73f743eeafd961be9d583c54a521b7a9bf1b5a344527e1bb2a447d763ef274bea91cedc6219e5305bc4b987c837d50d3b5ca2e9e1594
7
+ data.tar.gz: fc3849ab2602836c69f914e2a502650ff67ba842a95e2a6e3f9e0c4622b47cb4b77b1e8a70c03958967954a3fa77969f7bdb0bcbf8f83e3ecdc8c723bd9e3545
data/.travis.yml CHANGED
@@ -7,9 +7,14 @@ env:
7
7
  - DB=postgres
8
8
  - DB=mysql
9
9
 
10
+ addons:
11
+ chrome: stable
12
+ postgresql: 9.4
13
+
10
14
  gemfile:
11
15
  - gemfiles/spree_3_5.gemfile
12
16
  - gemfiles/spree_3_7.gemfile
17
+ - gemfiles/spree_4_0.gemfile
13
18
  - gemfiles/spree_master.gemfile
14
19
 
15
20
  script:
@@ -17,13 +22,29 @@ script:
17
22
  - bundle exec rake spec
18
23
 
19
24
  rvm:
20
- - 2.3.3
21
- - 2.4.2
22
- - 2.5.2
25
+ - 2.5.1
26
+ - 2.4.4
27
+ - 2.3.8
23
28
 
24
29
  matrix:
25
30
  allow_failures:
26
31
  - gemfile: gemfiles/spree_master.gemfile
32
+ exclude:
33
+ - rvm: 2.3.8
34
+ gemfile: gemfiles/spree_4_0.gemfile
35
+ - rvm: 2.4.4
36
+ gemfile: gemfiles/spree_4_0.gemfile
37
+ - rvm: 2.3.8
38
+ gemfile: gemfiles/spree_master.gemfile
39
+ - rvm: 2.4.4
40
+ gemfile: gemfiles/spree_master.gemfile
41
+ - rvm: 2.5.1
42
+ gemfile: gemfiles/spree_3_5.gemfile
27
43
 
28
44
  before_install:
29
45
  - mysql -u root -e "GRANT ALL ON *.* TO 'travis'@'%';"
46
+ - wget -N https://chromedriver.storage.googleapis.com/2.35/chromedriver_linux64.zip -P ~/
47
+ - unzip ~/chromedriver_linux64.zip -d ~/
48
+ - rm ~/chromedriver_linux64.zip
49
+ - sudo mv -f ~/chromedriver /usr/local/share/
50
+ - sudo chmod +x /usr/local/share/chromedriver
data/Appraisals CHANGED
@@ -8,6 +8,13 @@ appraise 'spree-3-7' do
8
8
  gem 'spree', '~> 3.7.0'
9
9
  gem 'spree_auth_devise', '~> 3.5.0'
10
10
  gem 'rails-controller-testing'
11
+ gem 'sass-rails'
12
+ end
13
+
14
+ appraise 'spree-4-0' do
15
+ gem 'spree', '~> 4.0.0.beta'
16
+ gem 'spree_auth_devise', '~> 4.0.0.rc2'
17
+ gem 'rails-controller-testing'
11
18
  end
12
19
 
13
20
  appraise 'spree-master' do
@@ -0,0 +1,11 @@
1
+ module SpreeAnalyticsTrackers
2
+ module StoreControllerDecorator
3
+ def self.prepended(base)
4
+ base.helper Spree::TrackersHelper
5
+ end
6
+ end
7
+ end
8
+
9
+ if defined?(Spree::StoreController)
10
+ ::Spree::StoreController.prepend(::SpreeAnalyticsTrackers::StoreControllerDecorator)
11
+ end
@@ -9,15 +9,24 @@ module Spree
9
9
  brand: product.brand.try(:name),
10
10
  price: product.price.to_f,
11
11
  currency: product.currency,
12
- url: product_url(product),
12
+ url: product_url(product)
13
13
  }.tap do |hash|
14
- # This method returns either asset_url (Paperclip) or rails_blob_path (ActiveStorage) to return the specified image(s)
15
- if defined?(ActiveStorage) && !Rails.application.config.use_paperclip
16
- hash[:image_url] = request.base_url + Rails.application.routes.url_helpers.rails_blob_path(optional.delete(:image).attachment, only_path: true) if optional[:image]
17
- else
18
- hash[:image_url] = request.base_url + asset_url(optional.delete(:image).attachment) if optional[:image]
19
- end
14
+ hash[:image_url] = product_for_segment_image_url(hash, optional)
20
15
  end.merge(optional).to_json.html_safe
21
16
  end
17
+
18
+ private
19
+
20
+ # This method returns either asset_url (Paperclip) or rails_blob_path (ActiveStorage) to return the specified image(s)
21
+ def product_for_segment_image_url(hash, optional)
22
+ return unless optional[:image]
23
+
24
+ # Spree 4.0 dropped Paperclip support
25
+ if Gem.loaded_specs['spree_core'].version >= Gem::Version.create('4.0.0.alpha') || (defined?(ActiveStorage) && !Rails.application.config.use_paperclip)
26
+ request.base_url + Rails.application.routes.url_helpers.rails_blob_path(optional.delete(:image).attachment, only_path: true)
27
+ else
28
+ request.base_url + asset_url(optional.delete(:image).attachment)
29
+ end
30
+ end
22
31
  end
23
32
  end
@@ -0,0 +1,9 @@
1
+ module SpreeAnalyticsTrackers
2
+ module UserDecorator
3
+ def analytics_id
4
+ id
5
+ end
6
+ end
7
+ end
8
+
9
+ ::Spree.user_class.prepend(::SpreeAnalyticsTrackers::UserDecorator)
@@ -1,9 +1,8 @@
1
1
  if Gem.loaded_specs['spree_core'].version >= Gem::Version.create('3.5.0')
2
2
  Deface::Override.new(
3
3
  virtual_path: 'spree/admin/shared/sub_menu/_configuration',
4
- name: 'add_analytics_to_admin_configurations_sidebar_menu',
4
+ name: 'add_analytics_to_admin_sidebar',
5
5
  insert_bottom: '[data-hook="admin_configurations_sidebar_menu"]',
6
- original: '72f6a33afb2627a467ae458d42991ab0ce4cc6df',
7
- text: '<%= configurations_sidebar_menu_item(Spree.t(:analytics_trackers), spree.admin_trackers_path) if can? :manage, Spree::Tracker %>'
6
+ partial: 'spree/admin/shared/analytics_sidebar_menu'
8
7
  )
9
8
  end
@@ -1,5 +1,3 @@
1
- <% if can? :admin, Spree::Tracker %>
2
- <ul class="nav nav-sidebar">
3
- <%= tab :analytic_trackers, url: spree.admin_trackers_path, icon: 'tasks' %>
4
- </ul>
5
- <% end %>
1
+ <%= configurations_sidebar_menu_item(
2
+ Spree.t(:analytics), spree.admin_trackers_path
3
+ ) if can? :manage, Spree::Config %>
@@ -1,12 +1,12 @@
1
1
  <div data-hook="admin_tracker_form_fields" class="row">
2
- <div class="col-xs-12 col-md-4" data-hook="analytics_engine">
2
+ <div class="col-12 col-lg-6" data-hook="analytics_engine">
3
3
  <%= f.field_container :engine, class: ["form-group"], "data-hook" => "analytics_engine" do %>
4
4
  <%= f.label :engine, Spree.t(:analytics_engine) %>
5
5
  <%= f.select :engine, Spree::Tracker.engines.keys.sort.map { |k| [k.humanize, k] }, {}, { class: 'select2' } %>
6
6
  <%= f.error_message_on :engine %>
7
7
  <% end %>
8
8
  </div>
9
- <div class="col-xs-12 col-md-8">
9
+ <div class="col-12 col-lg-6">
10
10
  <div data-hook="active" class="form-group">
11
11
  <%= label_tag nil, Spree.t(:active) %>
12
12
  <div class="radio">
@@ -23,14 +23,14 @@
23
23
  </div>
24
24
  </div>
25
25
  </div>
26
- <div class="col-xs-12 col-md-4" data-hook="analytics_id">
26
+ <div class="col-12 col-lg-6" data-hook="analytics_id">
27
27
  <%= f.field_container :analytics_id, class: ["form-group"], "data-hook" => "analytics_id" do %>
28
28
  <%= f.label :analytics_id, Spree.t(:google_analytics_id) %>
29
29
  <%= f.text_field :analytics_id, class: 'form-control' %>
30
30
  <%= f.error_message_on :analytics_id %>
31
31
  <% end %>
32
32
  </div>
33
- <div data-hook="additional_tracker_fields"></div>
34
- </div>
35
- <div data-hook="admin_tracker_form_fields" class="row">
33
+ <div class="col-12 col-lg-6" data-hook="additional_tracker_fields"></div>
36
34
  </div>
35
+
36
+ <div data-hook="admin_tracker_form_fields" class="row"></div>
@@ -8,12 +8,6 @@
8
8
 
9
9
  <% if @trackers.any? %>
10
10
  <table class="table">
11
- <colgroup>
12
- <col style="width: 30%">
13
- <col style="width: 40%">
14
- <col style="width: 15%">
15
- <col style="width: 15%">
16
- </colgroup>
17
11
  <thead>
18
12
  <tr data-hook="admin_trackers_index_headers">
19
13
  <th><%= Spree.t(:google_analytics_id) %></th>
@@ -27,7 +21,9 @@
27
21
  <tr id="<%= spree_dom_id tracker %>" data-hook="admin_trackers_index_rows">
28
22
  <td><%= tracker.analytics_id %></td>
29
23
  <td><%= tracker.engine.humanize %></td>
30
- <td class="text-center"><%= tracker.active ? Spree.t(:say_yes) : Spree.t(:say_no) %></td>
24
+ <td class="text-center">
25
+ <%= tracker.active ? Spree.t(:say_yes) : Spree.t(:say_no) %>
26
+ </td>
31
27
  <td class="actions text-right">
32
28
  <%= link_to_edit(tracker, no_text: true) if can? :edit, tracker %>
33
29
  <%= link_to_delete(tracker, no_text: true) if can? :delete, tracker %>
@@ -37,7 +33,7 @@
37
33
  </tbody>
38
34
  </table>
39
35
  <% else %>
40
- <div class="alert alert-warning">
36
+ <div class="alert alert-info">
41
37
  <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Tracker)) %>,
42
38
  <%= link_to(Spree.t(:add_one), new_object_url) if can? :create, Spree::Tracker %>!
43
39
  </div>
@@ -5,5 +5,6 @@ source "https://rubygems.org"
5
5
  gem "spree", "~> 3.7.0"
6
6
  gem "spree_auth_devise", "~> 3.5.0"
7
7
  gem "rails-controller-testing"
8
+ gem "sass-rails"
8
9
 
9
10
  gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "spree", "~> 4.0.0.beta"
6
+ gem "spree_auth_devise", "~> 4.0.0.rc2"
7
+ gem "rails-controller-testing"
8
+
9
+ gemspec path: "../"
@@ -9,8 +9,8 @@ module SpreeAnalyticsTrackers
9
9
 
10
10
  module VERSION
11
11
  MAJOR = 1
12
- MINOR = 0
13
- TINY = 1
12
+ MINOR = 1
13
+ TINY = 0
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
16
16
  end
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
25
25
  s.add_dependency 'spree_core', spree_version
26
26
  s.add_dependency 'spree_backend', spree_version
27
27
  s.add_dependency 'spree_extension'
28
+ s.add_dependency 'deface', '~> 1.0'
28
29
 
29
30
  s.add_development_dependency 'appraisal'
30
31
  s.add_development_dependency 'capybara'
@@ -40,5 +41,5 @@ Gem::Specification.new do |s|
40
41
  s.add_development_dependency 'sass-rails'
41
42
  s.add_development_dependency 'selenium-webdriver'
42
43
  s.add_development_dependency 'simplecov'
43
- s.add_development_dependency 'sqlite3', '~> 1.3.6'
44
+ s.add_development_dependency 'sqlite3'
44
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_analytics_trackers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Spark Solutions
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-02 00:00:00.000000000 Z
11
+ date: 2019-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_core
@@ -64,6 +64,20 @@ dependencies:
64
64
  - - ">="
65
65
  - !ruby/object:Gem::Version
66
66
  version: '0'
67
+ - !ruby/object:Gem::Dependency
68
+ name: deface
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '1.0'
74
+ type: :runtime
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '1.0'
67
81
  - !ruby/object:Gem::Dependency
68
82
  name: appraisal
69
83
  requirement: !ruby/object:Gem::Requirement
@@ -264,16 +278,16 @@ dependencies:
264
278
  name: sqlite3
265
279
  requirement: !ruby/object:Gem::Requirement
266
280
  requirements:
267
- - - "~>"
281
+ - - ">="
268
282
  - !ruby/object:Gem::Version
269
- version: 1.3.6
283
+ version: '0'
270
284
  type: :development
271
285
  prerelease: false
272
286
  version_requirements: !ruby/object:Gem::Requirement
273
287
  requirements:
274
- - - "~>"
288
+ - - ">="
275
289
  - !ruby/object:Gem::Version
276
- version: 1.3.6
290
+ version: '0'
277
291
  description: 'Supports Google Analytics '
278
292
  email: we@sparksolutions.co
279
293
  executables: []
@@ -289,13 +303,10 @@ files:
289
303
  - README.md
290
304
  - Rakefile
291
305
  - app/controllers/spree/admin/trackers_controller.rb
292
- - app/controllers/spree/store_controller_decorator.rb
306
+ - app/controllers/spree_analytics_trackers/store_controller_decorator.rb
293
307
  - app/helpers/spree/trackers_helper.rb
294
- - app/models/spree/line_item_decorator.rb
295
- - app/models/spree/order_decorator.rb
296
- - app/models/spree/product_decorator.rb
297
308
  - app/models/spree/tracker.rb
298
- - app/models/spree/user_decorator.rb
309
+ - app/models/spree_analytics_trackers/user_decorator.rb
299
310
  - app/overrides/add_analytics_to_admin_sidebar.rb
300
311
  - app/overrides/add_cart_viewed_to_orders_edit.rb
301
312
  - app/overrides/add_checkout_step_viewed_to_checkout_edit.rb
@@ -334,6 +345,7 @@ files:
334
345
  - gemfiles/.bundle/config
335
346
  - gemfiles/spree_3_5.gemfile
336
347
  - gemfiles/spree_3_7.gemfile
348
+ - gemfiles/spree_4_0.gemfile
337
349
  - gemfiles/spree_master.gemfile
338
350
  - lib/generators/spree_analytics_trackers/install/install_generator.rb
339
351
  - lib/spree_analytics_trackers.rb
@@ -1,5 +0,0 @@
1
- if defined?(Spree::StoreController)
2
- Spree::StoreController.class_eval do
3
- helper Spree::TrackersHelper
4
- end
5
- end
@@ -1,6 +0,0 @@
1
- if Gem.loaded_specs['spree_core'].version < Gem::Version.create('3.2.0')
2
- Spree::LineItem.class_eval do
3
- delegate :brand, :category, to: :product
4
- delegate :options_text, to: :variant
5
- end
6
- end
@@ -1,7 +0,0 @@
1
- if Gem.loaded_specs['spree_core'].version < Gem::Version.create('3.3.0')
2
- Spree::Order.class_eval do
3
- def promo_code
4
- promotions.pluck(:code).compact.first
5
- end
6
- end
7
- end
@@ -1,11 +0,0 @@
1
- if Gem.loaded_specs['spree_core'].version < Gem::Version.create('3.2.0')
2
- Spree::Product.class_eval do
3
- def category
4
- taxons.joins(:taxonomy).find_by(spree_taxonomies: { name: Spree.t(:taxonomy_categories_name) })
5
- end
6
-
7
- def brand
8
- taxons.joins(:taxonomy).find_by(spree_taxonomies: { name: Spree.t(:taxonomy_brands_name) })
9
- end
10
- end
11
- end
@@ -1,5 +0,0 @@
1
- Spree.user_class.class_eval do
2
- def analytics_id
3
- id
4
- end
5
- end