rails_accordion 1.0.1 → 1.0.2

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: e860b44c827a2fbd492dd7266d2395497681b24224e18ea5dd89ed02a59b0072
4
- data.tar.gz: f457bad1da69fc310ce1b4755b85ba8ffdcc872a9511e1d1c3edf4c2f33cc982
3
+ metadata.gz: a4bfa0f128b5f7a07becf2938b2e6ab2ab30be152eecd15967b0a09ff08f2ed3
4
+ data.tar.gz: c905d38999ab2d5e7ece8a82a319af597f116c241deb6ce1bc0d529c0c6757f6
5
5
  SHA512:
6
- metadata.gz: 0a084e498ffecca067f1b6626b69d82f37b5eabd8c236ca7bc7b84ff1e13da1b679420de9119362459ca66dd7a015b8a1edcd16fef52d91dc9da09c0cdcdb3c0
7
- data.tar.gz: e5df22a526a4133e2840eb743b4387744273430d39f118f72b8ca8ac7a7426b69f9d9495bda1507941c3c6d35bdaf4fe2e42450ee500040850e851396aa8ca34
6
+ metadata.gz: 51b624b4cbc11f354cda95330fb4f80d519d9db7fc00a455560919e92b9cdefd934889f57e03397d7dca9202f91cfc24413df1513f7fe790c06e08f9920f9171
7
+ data.tar.gz: 244ee69d1dc5965145ce1961def630fc1b374a6b4bfbadcd1681f28bde92082e7ab1c49494e7fb3c515c111a65ae2e79a9884d30b3e9c3eca5634618aabdb1f5
data/Gemfile.lock CHANGED
@@ -9,20 +9,20 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionpack (6.1.7.3)
13
- actionview (= 6.1.7.3)
14
- activesupport (= 6.1.7.3)
12
+ actionpack (6.1.7.4)
13
+ actionview (= 6.1.7.4)
14
+ activesupport (= 6.1.7.4)
15
15
  rack (~> 2.0, >= 2.0.9)
16
16
  rack-test (>= 0.6.3)
17
17
  rails-dom-testing (~> 2.0)
18
18
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
19
- actionview (6.1.7.3)
20
- activesupport (= 6.1.7.3)
19
+ actionview (6.1.7.4)
20
+ activesupport (= 6.1.7.4)
21
21
  builder (~> 3.1)
22
22
  erubi (~> 1.4)
23
23
  rails-dom-testing (~> 2.0)
24
24
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
25
- activesupport (6.1.7.3)
25
+ activesupport (6.1.7.4)
26
26
  concurrent-ruby (~> 1.0, >= 1.0.2)
27
27
  i18n (>= 1.6, < 2)
28
28
  minitest (>= 5.1)
@@ -55,14 +55,15 @@ GEM
55
55
  rack (2.2.7)
56
56
  rack-test (2.1.0)
57
57
  rack (>= 1.3)
58
- rails-dom-testing (2.0.3)
59
- activesupport (>= 4.2.0)
58
+ rails-dom-testing (2.1.1)
59
+ activesupport (>= 5.0.0)
60
+ minitest
60
61
  nokogiri (>= 1.6)
61
62
  rails-html-sanitizer (1.5.0)
62
63
  loofah (~> 2.19, >= 2.19.1)
63
- railties (6.1.7.3)
64
- actionpack (= 6.1.7.3)
65
- activesupport (= 6.1.7.3)
64
+ railties (6.1.7.4)
65
+ actionpack (= 6.1.7.4)
66
+ activesupport (= 6.1.7.4)
66
67
  method_source
67
68
  rake (>= 12.2)
68
69
  thor (~> 1.0)
@@ -123,4 +124,4 @@ DEPENDENCIES
123
124
  zeitwerk (~> 2.6)
124
125
 
125
126
  BUNDLED WITH
126
- 2.4.14
127
+ 2.4.15
data/README.md CHANGED
@@ -16,64 +16,18 @@ bundle install
16
16
  rails generate rails_accordion:install
17
17
  ```
18
18
 
19
- Then follow the instructions for your JavaScript setup:
19
+ In `application.html.erb`, add:
20
20
 
21
- - [Importmap](#importmap) (Rails 7 default)
22
- - [esbuild, rollup.js, or Webpack](#esbuild-rollupjs-or-webpack)
23
- - [Webpacker](#webpacker) (Rails 6 default)
24
- - [Sprockets](#sprockets)
25
-
26
- ### Importmap
27
-
28
- In `config/importmap.rb`, add:
29
-
30
- ```ruby
31
- pin "rails_accordion", to: "rails_accordion.js"
32
- ```
33
-
34
- And in `app/javascript/application.js`, add:
35
-
36
- ```js
37
- import "rails_accordion"
38
- ```
39
-
40
- ### esbuild, rollup.js, or Webpack
41
-
42
- Run:
43
-
44
- ```sh
45
- yarn add rails_accordion rails_accordion.js
46
- ```
47
-
48
- And in `app/javascript/application.js`, add:
49
-
50
- ```js
51
- import "rails_accordion/rails_accordion.js"
52
- ```
53
-
54
- Note: For rollup.js, this requires `format: "iife"` in `rollup.config.js`.
55
-
56
- ### Webpacker
57
-
58
- Run:
59
-
60
- ```sh
61
- yarn add rails_accordion rails_accordion.js
21
+ ```erb
22
+ <%= rails_accordion_assets %>
62
23
  ```
63
24
 
64
- And in `app/javascript/packs/application.js`, add:
25
+ In `application_helper.rb`, add:
65
26
 
66
- ```js
67
- import "rails_accordion/rails_accordion.js"
27
+ ```rb
28
+ include RailsAccordion::ApplicationHelper
68
29
  ```
69
30
 
70
- ### Sprockets
71
-
72
- In `app/assets/javascripts/application.js`, add:
73
-
74
- ```js
75
- //= require rails_accordion
76
- ```
77
31
 
78
32
  ## Usage
79
33
 
@@ -0,0 +1 @@
1
+ //= link_tree ../builds
@@ -0,0 +1,15 @@
1
+ module RailsAccordion
2
+ module ApplicationHelper
3
+ def accordion(**args, &block)
4
+ render AccordionComponent.new(**args), &block
5
+ end
6
+
7
+ def accordion_item(**args, &block)
8
+ render ItemComponent.new(**args), &block
9
+ end
10
+
11
+ def rails_accordion_assets
12
+ render "rails_accordion/assets"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,2 @@
1
+ <%= stylesheet_link_tag "/rails_accordion_assets/rails_accordion.css", "data-turbo-track": "reload", defer: true %>
2
+ <%= javascript_include_tag "/rails_accordion_assets/rails_accordion.js", "data-turbo-track": "reload" %>
data/bin/rails CHANGED
@@ -3,7 +3,6 @@
3
3
  # installed from the root of your application.
4
4
 
5
5
  ENGINE_ROOT = File.expand_path('..', __dir__)
6
- # ENGINE_PATH = File.expand_path('../lib/rails_table/engine', __dir__)
7
6
 
8
7
  # Set up gems listed in the Gemfile.
9
8
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
@@ -0,0 +1,17 @@
1
+ module RailsAccordion
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace RailsAccordion
4
+
5
+ initializer "rails_accordion.helpers" do
6
+ ActiveSupport.on_load :action_controller do
7
+ helper RailsAccordion::ApplicationHelper
8
+ end
9
+ end
10
+
11
+ config.app_middleware.use(
12
+ Rack::Static,
13
+ urls: ["/rails_accordion_assets"],
14
+ root: RailsAccordion::Engine.root.join("public")
15
+ )
16
+ end
17
+ end
@@ -7,32 +7,8 @@ loader.ignore("#{__dir__}/generators")
7
7
  loader.setup
8
8
 
9
9
  module RailsAccordion
10
-
11
- class Error < StandardError; end
12
-
13
- class Engine < ::Rails::Engine
14
- isolate_namespace RailsAccordion
15
-
16
- initializer "rails_accordion.importmap" do |app|
17
- if defined?(Importmap)
18
- app.config.assets.precompile << "rails_accordion.js"
19
- app.config.assets.precompile << "rails_accordion.css"
20
- end
21
- end
22
- end
23
-
24
- class Railtie < Rails::Railtie
25
- ActiveSupport.on_load :action_view do
26
- include RailsAccordion
27
- end
28
- end
29
-
30
- def accordion(**args, &block)
31
- render AccordionComponent.new(**args), &block
32
- end
33
-
34
- def accordion_item(**args, &block)
35
- render ItemComponent.new(**args), &block
10
+ def self.root
11
+ RailsAccordion::Engine.routes.find_script_name({})
36
12
  end
37
13
  end
38
14
 
@@ -1,4 +1,7 @@
1
- # desc "Explaining what the task does"
2
- # task :rails_table do
3
- # # Task goes here
4
- # end
1
+ namespace :rails_accordion do
2
+ desc "Build for release"
3
+ task :build do
4
+ `yarn build`
5
+ `cp -r ./app/assets/builds/* ./public/rails_accordion_assets`
6
+ end
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_accordion
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ahmadshoh Nasrullozoda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-14 00:00:00.000000000 Z
11
+ date: 2023-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stimulus-rails
@@ -70,11 +70,14 @@ files:
70
70
  - app/assets/builds/rails_accordion.css
71
71
  - app/assets/builds/rails_accordion.js
72
72
  - app/assets/builds/rails_accordion.js.map
73
+ - app/assets/config/rails_accordion_manifest.js
73
74
  - app/assets/stylesheets/rails_accordion.css
74
75
  - app/components/accordion_component.rb
75
76
  - app/components/item_component.rb
77
+ - app/helpers/rails_accordion/application_helper.rb
76
78
  - app/javascript/controllers/accordion_controller.js
77
79
  - app/javascript/rails_accordion.js
80
+ - app/views/rails_accordion/_assets.html.erb
78
81
  - bin/console
79
82
  - bin/rails
80
83
  - bin/setup
@@ -82,12 +85,10 @@ files:
82
85
  - lib/generators/rails_accordion/templates/rails_accordion.tt
83
86
  - lib/rails_accordion.rb
84
87
  - lib/rails_accordion/configuration.rb
88
+ - lib/rails_accordion/engine.rb
85
89
  - lib/rails_accordion/version.rb
86
90
  - lib/tasks/rails_accordion_tasks.rake
87
91
  - rails_accordion.gemspec
88
- - vendor/assets/javascripts/rails_accordion.js
89
- - vendor/assets/javascripts/rails_accordion.js.map
90
- - vendor/assets/stylesheets/rails_accordion.css
91
92
  homepage: https://github.com/Tajbrains/rails_accordion
92
93
  licenses:
93
94
  - MIT