workarea-product_quickview 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +20 -0
- data/.eslintrc +24 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.gitignore +15 -0
- data/.scss-lint.yml +192 -0
- data/CHANGELOG.md +153 -0
- data/CODE_OF_CONDUCT.md +3 -0
- data/CONTRIBUTING.md +3 -0
- data/Gemfile +9 -0
- data/LICENSE +52 -0
- data/README.md +68 -0
- data/Rakefile +43 -0
- data/app/assets/javascripts/workarea/storefront/product_quickview/modules/quickview_button_placeholders.js +47 -0
- data/app/assets/javascripts/workarea/storefront/product_quickview/templates/quickview_button.jst.ejs +3 -0
- data/app/assets/stylesheets/workarea/storefront/product_quickview/components/_quickview_button.scss +20 -0
- data/app/controllers/workarea/storefront/products_controller.decorator +10 -0
- data/app/helpers/workarea/storefront/product_quickview_helper.rb +19 -0
- data/app/models/workarea/catalog/product.decorator +13 -0
- data/app/views/workarea/storefront/products/_quickview_button_placeholder.html.haml +2 -0
- data/app/views/workarea/storefront/products/quickview.html.haml +3 -0
- data/bin/rails +18 -0
- data/config/initializers/appends.rb +21 -0
- data/config/initializers/configuration.rb +10 -0
- data/config/locales/en.yml +6 -0
- data/config/routes.rb +2 -0
- data/lib/workarea/product_quickview.rb +11 -0
- data/lib/workarea/product_quickview/engine.rb +12 -0
- data/lib/workarea/product_quickview/version.rb +5 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +4 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +34 -0
- data/test/dummy/bin/update +29 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/config/application.rb +18 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +9 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +54 -0
- data/test/dummy/config/environments/production.rb +83 -0
- data/test/dummy/config/environments/test.rb +43 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/workarea.rb +5 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/puma.rb +47 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/helpers/workarea/storefront/product_quickview_helper_test.rb +33 -0
- data/test/models/workarea/product_quickview_test.rb +20 -0
- data/test/system/workarea/storefront/analytics_system_test.decorator +31 -0
- data/test/system/workarea/storefront/products_quickview_system_test.rb +65 -0
- data/test/test_helper.rb +10 -0
- data/workarea-product_quickview.gemspec +24 -0
- metadata +136 -0
data/CODE_OF_CONDUCT.md
ADDED
data/CONTRIBUTING.md
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
WebLinc
|
2
|
+
Business Source License
|
3
|
+
|
4
|
+
Licensor: WebLinc Corporation, 22 S. 3rd Street, 2nd Floor, Philadelphia PA 19106
|
5
|
+
|
6
|
+
Licensed Work: Workarea Commerce Platform
|
7
|
+
The Licensed Work is (c) 2019 WebLinc Corporation
|
8
|
+
|
9
|
+
Additional Use Grant:
|
10
|
+
You may make production use of the Licensed Work without an additional license agreement with WebLinc so long as you do not use the Licensed Work for a Commerce Service.
|
11
|
+
|
12
|
+
A "Commerce Service" is a commercial offering that allows third parties (other than your employees and contractors) to access the functionality of the Licensed Work by creating or managing commerce functionality, the products, taxonomy, assets and/or content of which are controlled by such third parties.
|
13
|
+
|
14
|
+
For information about obtaining an additional license agreement with WebLinc, contact licensing@workarea.com.
|
15
|
+
|
16
|
+
Change Date: 2019-08-20
|
17
|
+
|
18
|
+
Change License: Version 2.0 or later of the GNU General Public License as published by the Free Software Foundation
|
19
|
+
|
20
|
+
Terms
|
21
|
+
|
22
|
+
The Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-production use of the Licensed Work. The Licensor may make an Additional Use Grant, above, permitting limited production use.
|
23
|
+
|
24
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly available distribution of a specific version of the Licensed Work under this License, whichever comes first, the Licensor hereby grants you rights under the terms of the Change License, and the rights granted in the paragraph above terminate.
|
25
|
+
|
26
|
+
If your use of the Licensed Work does not comply with the requirements currently in effect as described in this License, you must purchase a commercial license from the Licensor, its affiliated entities, or authorized resellers, or you must refrain from using the Licensed Work.
|
27
|
+
|
28
|
+
All copies of the original and modified Licensed Work, and derivative works of the Licensed Work, are subject to this License. This License applies separately for each version of the Licensed Work and the Change Date may vary for each version of the Licensed Work released by Licensor.
|
29
|
+
|
30
|
+
You must conspicuously display this License on each original or modified copy of the Licensed Work. If you receive the Licensed Work in original or modified form from a third party, the terms and conditions set forth in this License apply to your use of that work.
|
31
|
+
|
32
|
+
Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License for the current and all other versions of the Licensed Work.
|
33
|
+
|
34
|
+
This License does not grant you any right in any trademark or logo of Licensor or its affiliates (provided that you may use a trademark or logo of Licensor as expressly required by this License). TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE. MariaDB hereby grants you permission to use this License’s text to license your works and to refer to it using the trademark "Business Source License" as long as you comply with the Covenants of Licensor below.
|
35
|
+
|
36
|
+
Covenants of Licensor
|
37
|
+
In consideration of the right to use this License’s text and the "Business Source License" name and trademark, Licensor covenants to MariaDB, and to all other recipients of the licensed work to be provided by Licensor:
|
38
|
+
|
39
|
+
To specify as the Change License the GPL Version 2.0 or any later version, or a license that is compatible with GPL Version 2.0 or a later version, where "compatible" means that software provided under the Change License can be included in a program with software provided under GPL Version 2.0 or a later version. Licensor may specify additional Change Licenses without limitation.
|
40
|
+
|
41
|
+
To either: (a) specify an additional grant of rights to use that does not impose any additional restriction on the right granted in this License, as the Additional Use Grant; or (b) insert the text "None."
|
42
|
+
|
43
|
+
To specify a Change Date.
|
44
|
+
|
45
|
+
Not to modify this License in any other way.
|
46
|
+
|
47
|
+
Notice
|
48
|
+
The Business Source License (this document, or the "License") is not an Open Source license. However, the Licensed Work will eventually be made available under an Open Source License, as stated in this License.
|
49
|
+
|
50
|
+
For more information on the use of the Business Source License generally, please visit the Adopting and Developing Business Source License FAQ.
|
51
|
+
|
52
|
+
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved. "Business Source License" is a trademark of MariaDB Corporation Ab.
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
Workarea Product Quickview
|
2
|
+
================================================================================
|
3
|
+
|
4
|
+
Product Quickview plugin for the Workarea platform.
|
5
|
+
|
6
|
+
This adds a quickview button to product summaries to allows user to open up a modal of the product (on desktop).
|
7
|
+
|
8
|
+
Before Installing!!
|
9
|
+
-------------------
|
10
|
+
|
11
|
+
Require this plugin before all other plugins that provide product
|
12
|
+
templates in your Gemfile, otherwise the quick-viewable template configuration
|
13
|
+
will not be initialized properly.
|
14
|
+
|
15
|
+
For example:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
source 'https://gems.workarea.com' do
|
19
|
+
gem 'workarea', '~> 3'
|
20
|
+
gem 'workarea-product_quickview'
|
21
|
+
gem 'workarea-clothing'
|
22
|
+
gem 'workarea-package_products'
|
23
|
+
end
|
24
|
+
```
|
25
|
+
|
26
|
+
Getting Started
|
27
|
+
--------------------------------------------------------------------------------
|
28
|
+
|
29
|
+
This gem contains a rails engine that must be mounted onto a host Rails application.
|
30
|
+
|
31
|
+
You must have access to a Workarea gems server to use this gem. Add your gems server credentials to Bundler:
|
32
|
+
|
33
|
+
bundle config gems.weblinc.com my_username:my_password
|
34
|
+
|
35
|
+
Or set the appropriate environment variable in a shell startup file:
|
36
|
+
|
37
|
+
export BUNDLE_GEMS__WEBLINC__COM='my_username:my_password'
|
38
|
+
|
39
|
+
Then add the gem to your application's Gemfile specifying the source:
|
40
|
+
|
41
|
+
# ...
|
42
|
+
gem 'workarea-product_quickview', source: 'https://gems.weblinc.com'
|
43
|
+
# ...
|
44
|
+
|
45
|
+
Or use a source block:
|
46
|
+
|
47
|
+
# ...
|
48
|
+
source 'https://gems.weblinc.com' do
|
49
|
+
gem 'workarea-product_quickview'
|
50
|
+
end
|
51
|
+
# ...
|
52
|
+
|
53
|
+
Update your application's bundle.
|
54
|
+
|
55
|
+
cd path/to/application
|
56
|
+
bundle
|
57
|
+
|
58
|
+
Workarea Platform Documentation
|
59
|
+
--------------------------------------------------------------------------------
|
60
|
+
|
61
|
+
See [http://developer.weblinc.com](http://developer.weblinc.com) for Workarea platform documentation.
|
62
|
+
|
63
|
+
Copyright & Licensing
|
64
|
+
--------------------------------------------------------------------------------
|
65
|
+
|
66
|
+
Copyright WebLinc 2017. All rights reserved.
|
67
|
+
|
68
|
+
For licensing, contact sales@workarea.com.
|
data/Rakefile
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
|
8
|
+
APP_RAKEFILE = File.expand_path('../test/dummy/Rakefile', __FILE__)
|
9
|
+
load 'rails/tasks/engine.rake'
|
10
|
+
load 'rails/tasks/statistics.rake'
|
11
|
+
load 'workarea/changelog.rake'
|
12
|
+
|
13
|
+
require 'rake/testtask'
|
14
|
+
|
15
|
+
Rake::TestTask.new(:test) do |t|
|
16
|
+
t.libs << 'lib'
|
17
|
+
t.libs << 'test'
|
18
|
+
t.pattern = 'test/**/*_test.rb'
|
19
|
+
t.verbose = false
|
20
|
+
end
|
21
|
+
|
22
|
+
task default: :test
|
23
|
+
|
24
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
25
|
+
require 'workarea/product_quickview/version'
|
26
|
+
|
27
|
+
desc "Release version #{Workarea::ProductQuickview::VERSION} of the gem"
|
28
|
+
task :release do
|
29
|
+
host = "https://#{ENV['BUNDLE_GEMS__WEBLINC__COM']}@gems.weblinc.com"
|
30
|
+
|
31
|
+
#Rake::Task['workarea:changelog'].execute
|
32
|
+
#system 'git add CHANGELOG.md'
|
33
|
+
#system 'git commit -m "Update CHANGELOG"'
|
34
|
+
#system 'git push origin HEAD'
|
35
|
+
|
36
|
+
system "git tag -a v#{Workarea::ProductQuickview::VERSION} -m 'Tagging #{Workarea::ProductQuickview::VERSION}'"
|
37
|
+
system 'git push --tags'
|
38
|
+
|
39
|
+
system 'gem build workarea-product_quickview.gemspec'
|
40
|
+
system "gem push workarea-product_quickview-#{Workarea::ProductQuickview::VERSION}.gem"
|
41
|
+
system "gem push workarea-product_quickview-#{Workarea::ProductQuickview::VERSION}.gem --host #{host}"
|
42
|
+
system "rm workarea-product_quickview-#{Workarea::ProductQuickview::VERSION}.gem"
|
43
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
/**
|
2
|
+
* @namespace WORKAREA.quickviewButtonPlaceholders
|
3
|
+
*/
|
4
|
+
WORKAREA.registerModule('quickviewButtonPlaceholders', (function () {
|
5
|
+
'use strict';
|
6
|
+
|
7
|
+
var quickviewButtonTemplate = JST['workarea/storefront/product_quickview/templates/quickview_button'],
|
8
|
+
|
9
|
+
openQuickview = function (event) {
|
10
|
+
var $quickviewButtonLink = $(event.currentTarget),
|
11
|
+
url = $quickviewButtonLink.attr('href');
|
12
|
+
|
13
|
+
event.preventDefault();
|
14
|
+
|
15
|
+
WORKAREA.dialog.createFromUrl(url);
|
16
|
+
},
|
17
|
+
|
18
|
+
replacePlaceholder = function (index, placeholder) {
|
19
|
+
var $placeholder = $(placeholder),
|
20
|
+
data = $placeholder.data('quickviewButtonPlaceholder'),
|
21
|
+
$quickviewButton = $(quickviewButtonTemplate({
|
22
|
+
analytics_data: data.analytics_data,
|
23
|
+
url: data.url
|
24
|
+
}));
|
25
|
+
|
26
|
+
WORKAREA.initModules($quickviewButton);
|
27
|
+
|
28
|
+
$(placeholder).replaceWith($quickviewButton);
|
29
|
+
|
30
|
+
$quickviewButton
|
31
|
+
.on('click', 'a', openQuickview);
|
32
|
+
},
|
33
|
+
|
34
|
+
/**
|
35
|
+
* @method
|
36
|
+
* @name init
|
37
|
+
* @memberof WORKAREA.quickviewButtonPlaceholders
|
38
|
+
*/
|
39
|
+
init = function ($scope) {
|
40
|
+
$('[data-quickview-button-placeholder]', $scope)
|
41
|
+
.each(replacePlaceholder);
|
42
|
+
};
|
43
|
+
|
44
|
+
return {
|
45
|
+
init: init
|
46
|
+
};
|
47
|
+
}()));
|
data/app/assets/stylesheets/workarea/storefront/product_quickview/components/_quickview_button.scss
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
/*------------------------------------*\
|
2
|
+
#QUICKVIEW-BUTTON
|
3
|
+
\*------------------------------------*/
|
4
|
+
|
5
|
+
.quickview-button {
|
6
|
+
@include center(horizontal);
|
7
|
+
top: $spacing-unit;
|
8
|
+
width: 75%;
|
9
|
+
|
10
|
+
@include respond-to($medium-breakpoint) {
|
11
|
+
display: none;
|
12
|
+
}
|
13
|
+
|
14
|
+
.touch &,
|
15
|
+
.product-summary:hover & {
|
16
|
+
@include respond-to($medium-breakpoint) {
|
17
|
+
display: inline-block;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Workarea
|
2
|
+
module Storefront
|
3
|
+
module ProductQuickviewHelper
|
4
|
+
def quickview_button_data(product)
|
5
|
+
{
|
6
|
+
url: product_path(product, product.browse_link_options),
|
7
|
+
analytics_data: product_click_analytics_data(product).to_json
|
8
|
+
}
|
9
|
+
end
|
10
|
+
|
11
|
+
def product_quickview_analytics_data(product)
|
12
|
+
{
|
13
|
+
event: 'productQuickview',
|
14
|
+
payload: product_analytics_data(product)
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,3 @@
|
|
1
|
+
- cache "#{@product.cache_key}/quickview", expires_in: 1.hour do
|
2
|
+
%div{ class: "product-details--#{@product.template} product-details", itemscope: true, itemtype: 'http://schema.org/Product', data: { analytics: product_quickview_analytics_data(@product).to_json } }
|
3
|
+
= render "workarea/storefront/products/templates/#{@product.template}", product: @product
|
data/bin/rails
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails gems
|
3
|
+
# installed from the root of your application.
|
4
|
+
|
5
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
6
|
+
ENGINE_PATH = File.expand_path('../../lib/product_quickview/engine', __FILE__)
|
7
|
+
|
8
|
+
# Set up gems listed in the Gemfile.
|
9
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
10
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
11
|
+
|
12
|
+
require 'action_controller/railtie'
|
13
|
+
require 'action_view/railtie'
|
14
|
+
require 'action_mailer/railtie'
|
15
|
+
require 'rails/test_unit/railtie'
|
16
|
+
require 'sprockets/railtie'
|
17
|
+
|
18
|
+
require 'rails/engine/commands'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Workarea
|
2
|
+
Plugin.append_partials(
|
3
|
+
'storefront.product_summary',
|
4
|
+
'workarea/storefront/products/quickview_button_placeholder'
|
5
|
+
)
|
6
|
+
|
7
|
+
Plugin.append_stylesheets(
|
8
|
+
'storefront.components',
|
9
|
+
'workarea/storefront/product_quickview/components/quickview_button'
|
10
|
+
)
|
11
|
+
|
12
|
+
Plugin.append_javascripts(
|
13
|
+
'storefront.modules',
|
14
|
+
'workarea/storefront/product_quickview/modules/quickview_button_placeholders'
|
15
|
+
)
|
16
|
+
|
17
|
+
Plugin.append_javascripts(
|
18
|
+
'storefront.templates',
|
19
|
+
'workarea/storefront/product_quickview/templates/quickview_button'
|
20
|
+
)
|
21
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
module Workarea
|
2
|
+
module ProductQuickview
|
3
|
+
class Engine < ::Rails::Engine
|
4
|
+
include Workarea::Plugin
|
5
|
+
isolate_namespace Workarea::ProductQuickview
|
6
|
+
|
7
|
+
config.to_prepare do
|
8
|
+
Storefront::ApplicationController.helper(Storefront::ProductQuickviewHelper)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/test/dummy/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|