workarea-accordions 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +28 -0
  3. data/.editorconfig +20 -0
  4. data/.eslintignore +4 -0
  5. data/.eslintrc +20 -0
  6. data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
  7. data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
  8. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  9. data/.github/workflows/ci.yml +60 -0
  10. data/.gitignore +12 -0
  11. data/.rubocop.yml +3 -0
  12. data/.stylelintrc.json +8 -0
  13. data/CHANGELOG.md +12 -0
  14. data/CODE_OF_CONDUCT.md +3 -0
  15. data/CONTRIBUTING.md +3 -0
  16. data/Gemfile +18 -0
  17. data/LICENSE.md +3 -0
  18. data/README.md +35 -0
  19. data/Rakefile +49 -0
  20. data/app/assets/javascripts/workarea/storefront/accordions/config.js +18 -0
  21. data/app/assets/javascripts/workarea/storefront/accordions/modules/accordions.js +44 -0
  22. data/app/assets/stylesheets/workarea/jquery_ui/storefront/accordions/_ui_accordion.scss +13 -0
  23. data/bin/rails +18 -0
  24. data/config/routes.rb +2 -0
  25. data/lib/tasks/accordions_tasks.rake +4 -0
  26. data/lib/workarea/accordions.rb +10 -0
  27. data/lib/workarea/accordions/engine.rb +30 -0
  28. data/lib/workarea/accordions/version.rb +5 -0
  29. data/package.json +9 -0
  30. data/test/dummy/Rakefile +6 -0
  31. data/test/dummy/app/assets/config/manifest.js +4 -0
  32. data/test/dummy/app/assets/images/.keep +0 -0
  33. data/test/dummy/app/assets/javascripts/application.js +13 -0
  34. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  35. data/test/dummy/app/controllers/application_controller.rb +3 -0
  36. data/test/dummy/app/controllers/concerns/.keep +0 -0
  37. data/test/dummy/app/helpers/application_helper.rb +2 -0
  38. data/test/dummy/app/jobs/application_job.rb +2 -0
  39. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  40. data/test/dummy/app/models/concerns/.keep +0 -0
  41. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  42. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  43. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  44. data/test/dummy/bin/bundle +3 -0
  45. data/test/dummy/bin/rails +4 -0
  46. data/test/dummy/bin/rake +4 -0
  47. data/test/dummy/bin/setup +34 -0
  48. data/test/dummy/bin/update +29 -0
  49. data/test/dummy/config.ru +5 -0
  50. data/test/dummy/config/application.rb +26 -0
  51. data/test/dummy/config/boot.rb +5 -0
  52. data/test/dummy/config/cable.yml +9 -0
  53. data/test/dummy/config/environment.rb +5 -0
  54. data/test/dummy/config/environments/development.rb +56 -0
  55. data/test/dummy/config/environments/production.rb +86 -0
  56. data/test/dummy/config/environments/test.rb +43 -0
  57. data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
  58. data/test/dummy/config/initializers/assets.rb +11 -0
  59. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  60. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  61. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  62. data/test/dummy/config/initializers/inflections.rb +16 -0
  63. data/test/dummy/config/initializers/mime_types.rb +4 -0
  64. data/test/dummy/config/initializers/new_framework_defaults.rb +18 -0
  65. data/test/dummy/config/initializers/workarea.rb +5 -0
  66. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  67. data/test/dummy/config/locales/en.yml +23 -0
  68. data/test/dummy/config/puma.rb +47 -0
  69. data/test/dummy/config/routes.rb +5 -0
  70. data/test/dummy/config/secrets.yml +22 -0
  71. data/test/dummy/config/spring.rb +6 -0
  72. data/test/dummy/db/seeds.rb +2 -0
  73. data/test/dummy/lib/assets/.keep +0 -0
  74. data/test/dummy/log/.keep +0 -0
  75. data/test/dummy/public/404.html +67 -0
  76. data/test/dummy/public/422.html +67 -0
  77. data/test/dummy/public/500.html +66 -0
  78. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  79. data/test/dummy/public/apple-touch-icon.png +0 -0
  80. data/test/dummy/public/favicon.ico +1 -0
  81. data/test/system/workarea/accordions/storefront_system_test.rb +13 -0
  82. data/test/test_helper.rb +8 -0
  83. data/workarea-accordions.gemspec +22 -0
  84. data/yarn.lock +3290 -0
  85. metadata +187 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 28185b3c57ad4f88732bf89e02448e46eb51f6668d8876f4b4b6091a43efc0b6
4
+ data.tar.gz: d4ae3c30307f74bc4eb1a746a96d22eccc86d5f43fd001b1fed36ccb4d243886
5
+ SHA512:
6
+ metadata.gz: c9c78b344655d851d24ee58bd23d48122bfc6679c975109b692d2c18dd4ecaffbdf8269e336085cc1be440910fba1fb00ea228b450146632d721b1d305dfc9cb
7
+ data.tar.gz: b6fcea76d4ba0da375b05c2f6c82cbb12e1e7e53feec89dc0724d3ff9fe09a9cb12d80bc6f5f79fba0ab5e89573836b2f0e13361bb7ab6df66de472156ea2f3f
@@ -0,0 +1,28 @@
1
+ ---
2
+ engines:
3
+ scss-lint:
4
+ enabled: true
5
+ duplication:
6
+ enabled: true
7
+ config:
8
+ languages:
9
+ - ruby
10
+ - javascript
11
+ eslint:
12
+ enabled: true
13
+ fixme:
14
+ enabled: true
15
+ rubocop:
16
+ enabled: true
17
+ ratings:
18
+ paths:
19
+ - "**.css"
20
+ - "**.js"
21
+ - "**.rb"
22
+ exclude_paths:
23
+ - "*/lib/**/engine.rb"
24
+ - "*/assets/**/dependencies/**/*"
25
+ - docs/**/*
26
+ - testing/**/*
27
+ - core/app/assets/javascripts/workarea/core/polyfills.js
28
+ - "**/vendor/**/*"
@@ -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,60 @@
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
+ - uses: workarea-commerce/ci/stylelint@v1
15
+ with:
16
+ args: '**/*.scss'
17
+
18
+ admin_tests:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@v1
22
+ - uses: actions/setup-ruby@v1
23
+ with:
24
+ ruby-version: 2.6.x
25
+ - uses: workarea-commerce/ci/test@v1
26
+ with:
27
+ command: bin/rails app:workarea:test:admin
28
+
29
+ core_tests:
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - uses: actions/checkout@v1
33
+ - uses: actions/setup-ruby@v1
34
+ with:
35
+ ruby-version: 2.6.x
36
+ - uses: workarea-commerce/ci/test@v1
37
+ with:
38
+ command: bin/rails app:workarea:test:core
39
+
40
+ storefront_tests:
41
+ runs-on: ubuntu-latest
42
+ steps:
43
+ - uses: actions/checkout@v1
44
+ - uses: actions/setup-ruby@v1
45
+ with:
46
+ ruby-version: 2.6.x
47
+ - uses: workarea-commerce/ci/test@v1
48
+ with:
49
+ command: bin/rails app:workarea:test:storefront
50
+
51
+ plugins_tests:
52
+ runs-on: ubuntu-latest
53
+ steps:
54
+ - uses: actions/checkout@v1
55
+ - uses: actions/setup-ruby@v1
56
+ with:
57
+ ruby-version: 2.6.x
58
+ - uses: workarea-commerce/ci/test@v1
59
+ with:
60
+ 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
+ node_modules/
@@ -0,0 +1,3 @@
1
+ inherit_from:
2
+ - https://raw.githubusercontent.com/workarea-commerce/workarea/master/.rubocop.yml
3
+
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "stylelint-config-recommended-scss",
3
+ "rules": {
4
+ "block-no-empty": null,
5
+ "no-descending-specificity": null,
6
+ "property-no-unknown": [true, { "ignoreProperties": ["mso-hide"] }]
7
+ }
8
+ }
@@ -0,0 +1,12 @@
1
+ Workarea Accordions 3.0.3 (2019-07-23)
2
+ --------------------------------------------------------------------------------
3
+
4
+ * Fix accordion initialization when options.initIfLessThan is null
5
+
6
+ break_points.js now requires the argument to match an existing breakpoint name. Added a condition to initialize the accordion functionality if the default configuration of null is used. This maintains existing functionality and works with the improved API for break_points.js
7
+
8
+ ACCORDIONS-10
9
+ Jake Beresford
10
+
11
+
12
+
@@ -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,18 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ # Declare your gem's dependencies in accordions.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'
@@ -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,35 @@
1
+ Workarea Accordions
2
+ ================================================================================
3
+
4
+ Accordions plugin for the Workarea Commerce platform.
5
+
6
+ Using Workarea Accordions
7
+ --------------------------------------------------------------------------------
8
+
9
+ Apply a `data-accordion` attribute to any element that contains appropriate accordion markup (See [https://jqueryui.com/accordion/](https://jqueryui.com/accordion/) for jQuery UI Accordion documentation). If no value is passed to the data attribute, then the default jQuery UI Accordion options will be used to init the accordion.
10
+
11
+ __New in version 2.0, the data attribute can only be passed an object for it's configuration.__
12
+
13
+ The configuration object accepts the following properties:
14
+
15
+ | Property | Data Type | Required? | Default| Notes |
16
+ |----------|-----------|-----------|--------|-------|
17
+ | `initIfLessThan` | string | no | `null` | Only init the accordion if breakpoint is less than the value passed. |
18
+ | `presetConfig` | string | no | n/a | Name of a preset configuration object |
19
+ | `uiAccordionOptions` | object | no | jQuery Accordion Defaults | jQuery Accordion Options |
20
+
21
+ ### Examples
22
+ `.element{ data: { accordion: '' } }`
23
+
24
+ `.element{ data: { accordion: { presetConfig: 'alternativeAccordionOptions' }.to_json } }`
25
+
26
+ `.element{ data: { accordion: { initIfLessThan: 'medium', uiAccordionOptions: { animate: false } }.to_json } }`
27
+
28
+ Workarea Platform Documentation
29
+ --------------------------------------------------------------------------------
30
+
31
+ See [https://developer.workarea.com](https://developer.workarea.com) for Workarea platform documentation.
32
+
33
+ Copyright & Licensing
34
+ --------------------------------------------------------------------------------
35
+ Workarea Commerce Platform is released under the [Business Software License](https://github.com/workarea-commerce/workarea/blob/master/LICENSE)
@@ -0,0 +1,49 @@
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
+ require 'rdoc/task'
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'B2b'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path('../test/dummy/Rakefile', __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+ load 'rails/tasks/statistics.rake'
20
+ load 'workarea/changelog.rake'
21
+
22
+ require 'rake/testtask'
23
+ Rake::TestTask.new(:test) do |t|
24
+ t.libs << 'lib'
25
+ t.libs << 'test'
26
+ t.pattern = 'test/**/*_test.rb'
27
+ t.verbose = false
28
+ end
29
+ task default: :test
30
+
31
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
32
+ require 'workarea/accordions/version'
33
+
34
+ desc "Release version #{Workarea::Accordions::VERSION} of the gem"
35
+ task :release do
36
+ host = "https://#{ENV['BUNDLE_GEMS__WEBLINC__COM']}@gems.weblinc.com"
37
+
38
+ Rake::Task['workarea:changelog'].execute
39
+ system 'git add CHANGELOG.md'
40
+ system 'git commit -m "Update CHANGELOG"'
41
+ system 'git push origin HEAD'
42
+
43
+ system "git tag -a v#{Workarea::Accordions::VERSION} -m 'Tagging #{Workarea::Accordions::VERSION}'"
44
+ system 'git push --tags'
45
+
46
+ system 'gem build workarea-accordions.gemspec'
47
+ system "gem push workarea-accordions-#{Workarea::Accordions::VERSION}.gem --host #{host}"
48
+ system "rm workarea-accordions-#{Workarea::Accordions::VERSION}.gem"
49
+ end
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @namespace WORKAREA
3
+ */
4
+
5
+ (function () {
6
+ 'use strict';
7
+
8
+ /**
9
+ * @namespace WORKAREA.config
10
+ * @property {object} defaultAccordionOptions
11
+ */
12
+
13
+ WORKAREA.config.defaultAccordionOptions = {
14
+ initIfLessThan: null, // by default, init accordions at all breakpoints
15
+ uiAccordionOptions: {} // use jQuery UI Accordion defaults
16
+ };
17
+
18
+ })();
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @namespace WORKAREA.accordions
3
+ */
4
+ WORKAREA.registerModule('accordions', (function () {
5
+ 'use strict';
6
+
7
+ var initAccordions = function (index, element) {
8
+ var $element = $(element),
9
+ data = $element.data('accordion'),
10
+ options;
11
+
12
+ if (_.isEmpty(data)) {
13
+
14
+ options = WORKAREA.config.defaultAccordionOptions;
15
+
16
+ } else if (!_.isEmpty(data.presetConfig)) {
17
+
18
+ options = _.merge({}, WORKAREA.config[data.presetConfig], data);
19
+
20
+ } else {
21
+
22
+ options = _.merge({}, WORKAREA.config.defaultAccordionOptions, data);
23
+ }
24
+
25
+ if (_.isNull(options.initIfLessThan)) {
26
+ $element.accordion(options.uiAccordionOptions);
27
+ } else if (WORKAREA.breakPoints.currentlyLessThan(options.initIfLessThan)) {
28
+ $element.accordion(options.uiAccordionOptions);
29
+ }
30
+ },
31
+
32
+ /**
33
+ * @method
34
+ * @name init
35
+ * @memberof WORKAREA.accordions
36
+ */
37
+ init = function ($scope) {
38
+ $('[data-accordion]', $scope).each(initAccordions);
39
+ };
40
+
41
+ return {
42
+ init: init
43
+ };
44
+ }()));