workarea-filter_dropdowns 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +20 -0
  3. data/.eslintignore +4 -0
  4. data/.eslintrc +20 -0
  5. data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
  6. data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
  7. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  8. data/.github/workflows/ci.yml +57 -0
  9. data/.gitignore +12 -0
  10. data/.rubocop.yml +2 -0
  11. data/CODE_OF_CONDUCT.md +3 -0
  12. data/CONTRIBUTING.md +3 -0
  13. data/Gemfile +19 -0
  14. data/LICENSE.md +3 -0
  15. data/README.md +26 -0
  16. data/Rakefile +36 -0
  17. data/app/assets/javascripts/workarea/storefront/filter_dropdowns/config.js +27 -0
  18. data/app/helpers/workarea/storefront/filter_dropdowns_helper.rb +10 -0
  19. data/bin/rails +18 -0
  20. data/config/routes.rb +2 -0
  21. data/lib/tasks/filter_dropdowns_tasks.rake +4 -0
  22. data/lib/workarea/filter_dropdowns.rb +11 -0
  23. data/lib/workarea/filter_dropdowns/engine.rb +19 -0
  24. data/lib/workarea/filter_dropdowns/version.rb +5 -0
  25. data/test/dummy/Rakefile +6 -0
  26. data/test/dummy/app/assets/config/manifest.js +4 -0
  27. data/test/dummy/app/assets/images/.keep +0 -0
  28. data/test/dummy/app/assets/javascripts/application.js +13 -0
  29. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  30. data/test/dummy/app/controllers/application_controller.rb +3 -0
  31. data/test/dummy/app/controllers/concerns/.keep +0 -0
  32. data/test/dummy/app/helpers/application_helper.rb +2 -0
  33. data/test/dummy/app/jobs/application_job.rb +2 -0
  34. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  35. data/test/dummy/app/models/concerns/.keep +0 -0
  36. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  37. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  38. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  39. data/test/dummy/bin/bundle +3 -0
  40. data/test/dummy/bin/rails +4 -0
  41. data/test/dummy/bin/rake +4 -0
  42. data/test/dummy/bin/setup +34 -0
  43. data/test/dummy/bin/update +29 -0
  44. data/test/dummy/config.ru +5 -0
  45. data/test/dummy/config/application.rb +26 -0
  46. data/test/dummy/config/boot.rb +5 -0
  47. data/test/dummy/config/cable.yml +9 -0
  48. data/test/dummy/config/environment.rb +5 -0
  49. data/test/dummy/config/environments/development.rb +56 -0
  50. data/test/dummy/config/environments/production.rb +86 -0
  51. data/test/dummy/config/environments/test.rb +43 -0
  52. data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
  53. data/test/dummy/config/initializers/assets.rb +11 -0
  54. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  55. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  56. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  57. data/test/dummy/config/initializers/inflections.rb +16 -0
  58. data/test/dummy/config/initializers/mime_types.rb +4 -0
  59. data/test/dummy/config/initializers/new_framework_defaults.rb +18 -0
  60. data/test/dummy/config/initializers/workarea.rb +5 -0
  61. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  62. data/test/dummy/config/locales/en.yml +23 -0
  63. data/test/dummy/config/puma.rb +47 -0
  64. data/test/dummy/config/routes.rb +5 -0
  65. data/test/dummy/config/secrets.yml +22 -0
  66. data/test/dummy/config/spring.rb +6 -0
  67. data/test/dummy/db/seeds.rb +2 -0
  68. data/test/dummy/lib/assets/.keep +0 -0
  69. data/test/dummy/log/.keep +0 -0
  70. data/test/dummy/public/404.html +67 -0
  71. data/test/dummy/public/422.html +67 -0
  72. data/test/dummy/public/500.html +66 -0
  73. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  74. data/test/dummy/public/apple-touch-icon.png +0 -0
  75. data/test/dummy/public/favicon.ico +1 -0
  76. data/test/system/workarea/filter_dropdowns/storefront_system_test.rb +13 -0
  77. data/test/test_helper.rb +8 -0
  78. data/workarea-filter_dropdowns.gemspec +23 -0
  79. metadata +195 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3b9cb6fd0320ad1d130e73945e8aaac1e4402902166d688cba8074a628a91096
4
+ data.tar.gz: ac5c89e4bb6a84c0d34c5ac2f60846da5362fab25964835e0f26212b6ff91157
5
+ SHA512:
6
+ metadata.gz: 0a52a0fdffb3a06017ecf71367f89f8bf20e7f4219c1586e7afc7253b6d9dafe2c73c129b99fe1dc20c90ff6bcd11c434b2f3009bd82879fac31ea17863ee74e
7
+ data.tar.gz: 6de6a6ec4ca6e390d6a17d7f4d88752702be47b5b46e2e8a9256b856cc8f534062444929201aac54795d7aa2a0868c99cf0b5bb94e304daf078dbff5b5b3d8c1
@@ -0,0 +1,20 @@
1
+ # editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ indent_style = space
7
+ end_of_line = lf
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
10
+
11
+ [{*.rb,*.haml,*.decorator,*.yml,*.yaml,*.jbuilder}]
12
+ indent_size = 2
13
+ indent_style = space
14
+
15
+ [{*.js,*.jst,*.ejs,*.scss}]
16
+ indent_size = 4
17
+
18
+ [*.md]
19
+ indent_size = 4
20
+ trim_trailing_whitespace = false
@@ -0,0 +1,4 @@
1
+ admin/spec/javascripts/**/*.js
2
+ storefront/spec/javascripts/**/*.js
3
+ core/spec/javascripts/**/*.js
4
+ *spec_helper.js
@@ -0,0 +1,20 @@
1
+ {
2
+ "extends": "eslint:recommended",
3
+ "globals": {
4
+ "window": true,
5
+ "document": true,
6
+ "WORKAREA": true,
7
+ "$": true,
8
+ "jQuery": true,
9
+ "_": true,
10
+ "feature": true,
11
+ "JST": true,
12
+ "Turbolinks": true,
13
+ "I18n": true,
14
+ "Chart": true,
15
+ "Dropzone": true,
16
+ "strftime": true,
17
+ "Waypoint": true,
18
+ "wysihtml5": true
19
+ }
20
+ }
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve Workarea
4
+ title: ''
5
+ labels: bug
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ ⚠️**Before you create**⚠️
11
+ Please verify the issue you're experiencing is not part of your Workarea project customizations. The best way to do this is with a [vanilla Workarea installation](https://developer.workarea.com/articles/create-a-new-host-application.html). This will help us spend time on fixes/improvements for the whole community. Thank you!
12
+
13
+ **Describe the bug**
14
+ A clear and concise description of what the bug is.
15
+
16
+ **To Reproduce**
17
+ Steps to reproduce the behavior:
18
+ 1. Go to '...'
19
+ 2. Click on '....'
20
+ 3. Scroll down to '....'
21
+ 4. See error
22
+
23
+ **Expected behavior**
24
+ A clear and concise description of what you expected to happen.
25
+
26
+ **Workarea Setup (please complete the following information):**
27
+ - Workarea Version: [e.g. v3.4.6]
28
+ - Plugins [e.g. workarea-blog, workarea-sitemaps]
29
+
30
+ **Attachments**
31
+ If applicable, add any attachments to help explain your problem, things like:
32
+ - screenshots
33
+ - Gemfile.lock
34
+ - test cases
35
+
36
+ **Additional context**
37
+ Add any other context about the problem here.
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: Documentation request
3
+ about: Suggest documentation
4
+ title: ''
5
+ labels: documentation
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your documentation related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm confused by [...]
12
+
13
+ **Describe the article you'd like**
14
+ A clear and concise description of what would be in the documentation article.
15
+
16
+ **Additional context**
17
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for Workarea
4
+ title: ''
5
+ labels: enhancement
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,57 @@
1
+ name: CI
2
+ on: [push]
3
+
4
+ jobs:
5
+ static_analysis:
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - uses: actions/checkout@v1
9
+ - uses: workarea-commerce/ci/bundler-audit@v1
10
+ - uses: workarea-commerce/ci/rubocop@v1
11
+ - uses: workarea-commerce/ci/eslint@v1
12
+ with:
13
+ args: '**/*.js'
14
+
15
+ admin_tests:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v1
19
+ - uses: actions/setup-ruby@v1
20
+ with:
21
+ ruby-version: 2.6.x
22
+ - uses: workarea-commerce/ci/test@v1
23
+ with:
24
+ command: bin/rails app:workarea:test:admin
25
+
26
+ core_tests:
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ - uses: actions/checkout@v1
30
+ - uses: actions/setup-ruby@v1
31
+ with:
32
+ ruby-version: 2.6.x
33
+ - uses: workarea-commerce/ci/test@v1
34
+ with:
35
+ command: bin/rails app:workarea:test:core
36
+
37
+ storefront_tests:
38
+ runs-on: ubuntu-latest
39
+ steps:
40
+ - uses: actions/checkout@v1
41
+ - uses: actions/setup-ruby@v1
42
+ with:
43
+ ruby-version: 2.6.x
44
+ - uses: workarea-commerce/ci/test@v1
45
+ with:
46
+ command: bin/rails app:workarea:test:storefront
47
+
48
+ plugins_tests:
49
+ runs-on: ubuntu-latest
50
+ steps:
51
+ - uses: actions/checkout@v1
52
+ - uses: actions/setup-ruby@v1
53
+ with:
54
+ ruby-version: 2.6.x
55
+ - uses: workarea-commerce/ci/test@v1
56
+ with:
57
+ command: bin/rails app:workarea:test:plugins
@@ -0,0 +1,12 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ test/dummy/db/*.sqlite3
5
+ test/dummy/db/*.sqlite3-journal
6
+ test/dummy/log/*.log
7
+ test/dummy/tmp/
8
+ test/dummy/.sass-cache
9
+ Gemfile.lock
10
+ test/dummy/public/system/*
11
+ .DS_STORE
12
+ .rubocop-http*
@@ -0,0 +1,2 @@
1
+ inherit_from:
2
+ - https://raw.githubusercontent.com/workarea-commerce/workarea/master/.rubocop.yml
@@ -0,0 +1,3 @@
1
+ View this plugin's code of conduct here:
2
+
3
+ <https://github.com/workarea-commerce/workarea/blob/master/CODE_OF_CONDUCT.md>
@@ -0,0 +1,3 @@
1
+ View this plugin's contribution guidelines here:
2
+
3
+ <https://github.com/workarea-commerce/workarea/blob/master/CONTRIBUTING.md>
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ # Declare your gem's dependencies in filter_dropdowns.gemspec.
5
+ # Bundler will treat runtime dependencies like base dependencies, and
6
+ # development dependencies will be added by default to the :development group.
7
+ gemspec
8
+
9
+ # Declare any dependencies that are still in development here instead of in
10
+ # your gemspec. These might include edge Rails or gems from your path or
11
+ # Git. Remember to move these dependencies to your gemspec before releasing
12
+ # your gem to rubygems.org.
13
+
14
+ # To use a debugger
15
+ # gem 'byebug', group: [:development, :test]
16
+
17
+
18
+ gem 'workarea', github: 'workarea-commerce/workarea'
19
+ gem 'workarea-accordions', github: 'workarea-commerce/workarea-accordions'
@@ -0,0 +1,3 @@
1
+ View this plugin's license here:
2
+
3
+ <https://github.com/workarea-commerce/workarea/blob/master/LICENSE.md>
@@ -0,0 +1,26 @@
1
+ Workarea Filter Dropdowns
2
+ ================================================================================
3
+
4
+ Filter Dropdowns plugin for the Workarea Commerce platform.
5
+
6
+ Using Workarea Filter Dropdowns
7
+ --------------------------------------------------------------------------------
8
+
9
+ This gem packages up the [workarea-accordions](https://stash.tools.workarea.com/projects/WP/repos/workarea-accordions/browse) gem and includes a JS config preset to utilize jQuery UI's accordion functionality to the browse filters into dropdown menus. Other elements may be converted into dropdowns by applying the same accordion preset data attribute value, but they will have to match the relavent markup from the browse filters. Or the config will need to be customized. See [https://jqueryui.com/accordion/](https://jqueryui.com/accordion/) for jQuery UI Accordion documentation.
10
+
11
+ Simply add a data attribute to `.result-filters` element like this:
12
+
13
+ `.result-filters{ data: { accordion: { presetConfig: 'filtersAccordionOptions' }.to_json } }`
14
+
15
+ Along with the `filtersAccordionOptions` preset configuration, there is a `filtersAccordionOptionsActive` config that will default the dropdown to open. This version of the gem also includes a helper method, `contains_selected_filter?` to help you conditionally apply the appropriate preset configuration based on the presence of any selected filters.
16
+
17
+ `.result-filters{ data: { accordion: { presetConfig: contains_selected_filter?(name) ? 'filtersAccordionOptionsActive' : 'filtersAccordionOptions' }.to_json } }`
18
+
19
+ Workarea Platform Documentation
20
+ --------------------------------------------------------------------------------
21
+
22
+ See [https://developer.workarea.com](https://developer.workarea.com) for Workarea platform documentation.
23
+
24
+ Copyright & Licensing
25
+ --------------------------------------------------------------------------------
26
+ Workarea Commerce Platform is released under the [Business Software License](https://github.com/workarea-commerce/workarea/blob/master/LICENSE)
@@ -0,0 +1,36 @@
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
+ require 'rake/testtask'
12
+
13
+ Rake::TestTask.new(:test) do |t|
14
+ t.libs << 'lib'
15
+ t.libs << 'test'
16
+ t.pattern = 'test/**/*_test.rb'
17
+ t.verbose = false
18
+ end
19
+
20
+ task default: :test
21
+
22
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
23
+ require 'workarea/filter_dropdowns/version'
24
+
25
+
26
+ desc "Release version #{Workarea::FilterDropdowns::VERSION} of the gem"
27
+ task :release do
28
+ host = "https://#{ENV['BUNDLE_GEMS__WEBLINC__COM']}@gems.weblinc.com"
29
+
30
+ system "git tag -a v#{Workarea::FilterDropdowns::VERSION} -m 'Tagging #{Workarea::FilterDropdowns::VERSION}'"
31
+ system 'git push --tags'
32
+
33
+ system 'gem build workarea-filter_dropdowns.gemspec'
34
+ system "gem push workarea-filter_dropdowns-#{Workarea::FilterDropdowns::VERSION}.gem --host #{host}"
35
+ system "rm workarea-filter_dropdowns-#{Workarea::FilterDropdowns::VERSION}.gem"
36
+ end
@@ -0,0 +1,27 @@
1
+ (function () {
2
+ 'use strict';
3
+
4
+ /**
5
+ * Config Variables
6
+ */
7
+
8
+ WORKAREA.config.filtersAccordionOptions = {
9
+ uiAccordionOptions: {
10
+ heightStyle: 'content',
11
+ active: false,
12
+ collapsible: true,
13
+ header: 'h2'
14
+ }
15
+ };
16
+
17
+ WORKAREA.config.filtersAccordionOptionsActive = _.merge(
18
+ {},
19
+ WORKAREA.config.filtersAccordionOptions,
20
+ {
21
+ uiAccordionOptions: {
22
+ active: 0
23
+ }
24
+ }
25
+ );
26
+
27
+ })();
@@ -0,0 +1,10 @@
1
+ module Workarea
2
+ module Storefront
3
+ module FilterDropdownsHelper
4
+ def contains_selected_filter?(name)
5
+ return true if name == :theme
6
+ params.keys.grep(/#{name}/i).any?
7
+ end
8
+ end
9
+ end
10
+ end
@@ -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/filter_dropdowns/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,2 @@
1
+ Rails.application.routes.draw do
2
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :filter_dropdowns do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,11 @@
1
+ require 'workarea'
2
+ require 'workarea/storefront'
3
+ require 'workarea/admin'
4
+ require 'workarea/accordions'
5
+
6
+ require 'workarea/filter_dropdowns/engine'
7
+
8
+ module Workarea
9
+ module FilterDropdowns
10
+ end
11
+ end
@@ -0,0 +1,19 @@
1
+ module Workarea
2
+ module FilterDropdowns
3
+ class Engine < ::Rails::Engine
4
+ include Workarea::Plugin
5
+ isolate_namespace Workarea::FilterDropdowns
6
+
7
+ initializer 'workarea.filter_dropdowns' do
8
+ Plugin.append_javascripts(
9
+ 'storefront.config',
10
+ 'workarea/storefront/filter_dropdowns/config'
11
+ )
12
+ end
13
+
14
+ config.to_prepare do
15
+ Storefront::ApplicationController.helper(Storefront::FilterDropdownsHelper)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ module Workarea
2
+ module FilterDropdowns
3
+ VERSION = '3.0.2'.freeze
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative 'config/application'
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,4 @@
1
+
2
+ //= link_tree ../images
3
+ //= link_directory ../javascripts .js
4
+ //= link_directory ../stylesheets .css
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 .