rails_accordion 1.0.1 → 1.0.3

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: c8c3c4514120b3168aff3120e0b13292c7f2988c720106c864d019f8acb834c4
4
+ data.tar.gz: f91f2a9f0ebfc33416245309dc6c53e5b619b92cb5f792cd651fe14ecd70f674
5
5
  SHA512:
6
- metadata.gz: 0a084e498ffecca067f1b6626b69d82f37b5eabd8c236ca7bc7b84ff1e13da1b679420de9119362459ca66dd7a015b8a1edcd16fef52d91dc9da09c0cdcdb3c0
7
- data.tar.gz: e5df22a526a4133e2840eb743b4387744273430d39f118f72b8ca8ac7a7426b69f9d9495bda1507941c3c6d35bdaf4fe2e42450ee500040850e851396aa8ca34
6
+ metadata.gz: d4a7a6fc21265d50dbbb8b5bb184340648009eb43ffc50931a3833b682fbfaabd8e7d2dc1be8ac5d728074be7deeb2d993901588722542d463d7c2eb5552d947
7
+ data.tar.gz: d6a09a1bb1e78fb7c778e5905037f13030344a228ae9806a156d9ad464fc187739013aadbde4aa4db33a622a9fbf9596b786ff7a788a8336a96bc14836c9af77
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,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,11 @@
1
+ module RailsAccordion
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace RailsAccordion
4
+
5
+ config.app_middleware.use(
6
+ Rack::Static,
7
+ urls: ["/rails_accordion_assets"],
8
+ root: RailsAccordion::Engine.root.join("public")
9
+ )
10
+ end
11
+ end
@@ -7,26 +7,16 @@ 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
10
  class Railtie < Rails::Railtie
25
11
  ActiveSupport.on_load :action_view do
26
12
  include RailsAccordion
27
13
  end
28
14
  end
29
15
 
16
+ def self.root
17
+ RailsAccordion::Engine.routes.find_script_name({})
18
+ end
19
+
30
20
  def accordion(**args, &block)
31
21
  render AccordionComponent.new(**args), &block
32
22
  end
@@ -34,6 +24,10 @@ module RailsAccordion
34
24
  def accordion_item(**args, &block)
35
25
  render ItemComponent.new(**args), &block
36
26
  end
27
+
28
+ def rails_accordion_assets
29
+ render "rails_accordion/assets"
30
+ end
37
31
  end
38
32
 
39
33
  loader.eager_load
@@ -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.3
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,13 @@ 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
76
77
  - app/javascript/controllers/accordion_controller.js
77
78
  - app/javascript/rails_accordion.js
79
+ - app/views/rails_accordion/_assets.html.erb
78
80
  - bin/console
79
81
  - bin/rails
80
82
  - bin/setup
@@ -82,12 +84,10 @@ files:
82
84
  - lib/generators/rails_accordion/templates/rails_accordion.tt
83
85
  - lib/rails_accordion.rb
84
86
  - lib/rails_accordion/configuration.rb
87
+ - lib/rails_accordion/engine.rb
85
88
  - lib/rails_accordion/version.rb
86
89
  - lib/tasks/rails_accordion_tasks.rake
87
90
  - 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
91
  homepage: https://github.com/Tajbrains/rails_accordion
92
92
  licenses:
93
93
  - MIT