rails_accordion 0.1.6.pre.beta → 0.1.7.pre.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- metadata +17 -14
- data/README.md +0 -50
- data/Rakefile +0 -12
- data/lib/generators/rails_accordion/install_generator.rb +0 -13
- data/lib/generators/rails_accordion/templates/accordion_controller.js.tt +0 -38
- data/lib/rails_accordion/accordion.rb +0 -13
- data/lib/rails_accordion/accordion_item.rb +0 -0
- data/lib/rails_accordion/components/accordion_component.rb +0 -23
- data/lib/rails_accordion/components/item_component.rb +0 -40
- data/lib/rails_accordion/version.rb +0 -5
- data/lib/rails_accordion.rb +0 -23
- data/lib/tasks/rails_accordion_tasks.rake +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94073ae331086976ca2e7385025a490ce4617ca42f09bbcb201466e92392ca3c
|
4
|
+
data.tar.gz: 112fbd2c2f25e74e1aa3849fd431c414976230ba25d86fe2f13bb96a992d9f46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e2cf44a23d70356a2cc992a087c6e7103a8b697bd08ed53a8272d1418034de8f0fb421d2874a3b4e61707db57fceeed0be85ea479e76fd95a52e829188f66c5
|
7
|
+
data.tar.gz: 014fc43d53bbb129d77fb4771d751c6a8dfa262e4ec086ded6bd6247102334f08699872be5e002bd05183f5c3224f4562f9427a62dcb06931623e49e4eadce78
|
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: 0.1.
|
4
|
+
version: 0.1.7.pre.beta
|
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-05-
|
11
|
+
date: 2023-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: stimulus-rails
|
@@ -38,24 +38,27 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.52'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: zeitwerk
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.6'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.6'
|
41
55
|
description: rails_accordion is in development.
|
42
56
|
email:
|
43
57
|
- tajbrains@gmail.com
|
44
58
|
executables: []
|
45
59
|
extensions: []
|
46
60
|
extra_rdoc_files: []
|
47
|
-
files:
|
48
|
-
- README.md
|
49
|
-
- Rakefile
|
50
|
-
- lib/generators/rails_accordion/install_generator.rb
|
51
|
-
- lib/generators/rails_accordion/templates/accordion_controller.js.tt
|
52
|
-
- lib/rails_accordion.rb
|
53
|
-
- lib/rails_accordion/accordion.rb
|
54
|
-
- lib/rails_accordion/accordion_item.rb
|
55
|
-
- lib/rails_accordion/components/accordion_component.rb
|
56
|
-
- lib/rails_accordion/components/item_component.rb
|
57
|
-
- lib/rails_accordion/version.rb
|
58
|
-
- lib/tasks/rails_accordion_tasks.rake
|
61
|
+
files: []
|
59
62
|
homepage: https://tajbrains.com
|
60
63
|
licenses:
|
61
64
|
- MIT
|
data/README.md
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
# RailsAccordion
|
2
|
-
|
3
|
-
rails_accordion is a Ruby gem that provides an easy-to-use accordion component for use in Rails web applications. With this gem, developers can create collapsible sections of content that can be expanded or collapsed with a single click. The accordion is a great way to improve the user experience of your web application, by providing a clean and intuitive way to display complex information.
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
```rb
|
8
|
-
gem 'rails_accordion'
|
9
|
-
```
|
10
|
-
|
11
|
-
```bash
|
12
|
-
bundle install
|
13
|
-
```
|
14
|
-
|
15
|
-
```bash
|
16
|
-
rails generate rails_accordion:install
|
17
|
-
```
|
18
|
-
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
```erb
|
22
|
-
<%= accordion class: "bg-white rounded-xl overflow-auto", data: {controller: "tooltip"} do %>
|
23
|
-
<%= accordion_item do |item| %>
|
24
|
-
<% item.header do %>
|
25
|
-
Hello world
|
26
|
-
<% end %>
|
27
|
-
<% item.body do %>
|
28
|
-
Hello accordion body
|
29
|
-
<% end %>
|
30
|
-
<% end %>
|
31
|
-
<% end %>
|
32
|
-
```
|
33
|
-
|
34
|
-
## Development
|
35
|
-
|
36
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
37
|
-
|
38
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
39
|
-
|
40
|
-
## Contributing
|
41
|
-
|
42
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rails_accordion. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/rails_accordion/blob/master/CODE_OF_CONDUCT.md).
|
43
|
-
|
44
|
-
## License
|
45
|
-
|
46
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
47
|
-
|
48
|
-
## Code of Conduct
|
49
|
-
|
50
|
-
Everyone interacting in the RailsAccordion project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/rails_accordion/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
|
3
|
-
module RailsAccordion
|
4
|
-
module Generators
|
5
|
-
class InstallGenerator < Rails::Generators::Base
|
6
|
-
source_root File.expand_path('templates', __dir__)
|
7
|
-
|
8
|
-
def copy_stimulus_controller
|
9
|
-
copy_file 'accordion_controller.js.tt', 'app/javascript/controllers/accordion_controller.js'
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
import { Controller } from "@hotwired/stimulus"
|
2
|
-
|
3
|
-
export default class extends Controller {
|
4
|
-
connect() {
|
5
|
-
this.initAccordion();
|
6
|
-
}
|
7
|
-
|
8
|
-
initAccordion() {
|
9
|
-
const $toggles = $(this.element).find('.accordion_toggle');
|
10
|
-
|
11
|
-
const removeAllActiveClass = () => {
|
12
|
-
$toggles.each((el) => {
|
13
|
-
const $parent = $(el).parent();
|
14
|
-
$parent.removeClass('active');
|
15
|
-
$parent.find('.accordion_content').height(0);
|
16
|
-
});
|
17
|
-
};
|
18
|
-
|
19
|
-
$toggles.on('touch click', (e) => {
|
20
|
-
const $toggle = $(e.currentTarget);
|
21
|
-
const $parent = $toggle.parent();
|
22
|
-
const $content = $parent.find('.accordion_content');
|
23
|
-
|
24
|
-
if (!$parent.hasClass('active')) {
|
25
|
-
removeAllActiveClass();
|
26
|
-
$parent.addClass('active');
|
27
|
-
$content.height('100%');
|
28
|
-
} else {
|
29
|
-
$parent.removeClass('active');
|
30
|
-
$content.css({ height: '0px' });
|
31
|
-
}
|
32
|
-
});
|
33
|
-
}
|
34
|
-
|
35
|
-
afterReflex() {
|
36
|
-
this.initAccordion();
|
37
|
-
}
|
38
|
-
}
|
File without changes
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RailsAccordion
|
4
|
-
class AccordionComponent < ViewComponent::Base
|
5
|
-
def initialize(**args)
|
6
|
-
@args = args.presence || {}
|
7
|
-
set_controller
|
8
|
-
end
|
9
|
-
|
10
|
-
def call
|
11
|
-
content_tag :div, **@args do
|
12
|
-
content
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def set_controller
|
19
|
-
@args[:data] ||= {}
|
20
|
-
@args[:data][:controller] = [@args[:data][:controller], "accordion"].compact.join(' ')
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RailsAccordion
|
4
|
-
class ItemComponent < ViewComponent::Base
|
5
|
-
renders_one :body
|
6
|
-
renders_one :header
|
7
|
-
|
8
|
-
def initialize(**args)
|
9
|
-
@args = args.presence || {}
|
10
|
-
|
11
|
-
set_root_classes
|
12
|
-
end
|
13
|
-
|
14
|
-
def call
|
15
|
-
content_tag :div, **@args do
|
16
|
-
header_component + body_component
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def header_component
|
23
|
-
content_tag :div, header, class: "accordion_toggle"
|
24
|
-
end
|
25
|
-
|
26
|
-
def body_component
|
27
|
-
if body?
|
28
|
-
content_tag :div, class: 'accordion_content' do
|
29
|
-
content_tag :div, body, class: 'accordion_content-container p-2'
|
30
|
-
end
|
31
|
-
else
|
32
|
-
content_tag(:div, nil, class: "hidden")
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def set_root_classes
|
37
|
-
@args[:class] = [@args[:class], "accordion_item"].compact.join(' ')
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
data/lib/rails_accordion.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "rails_accordion/version"
|
4
|
-
require_relative "rails_accordion/components/accordion_component"
|
5
|
-
require_relative "rails_accordion/components/item_component"
|
6
|
-
|
7
|
-
module RailsAccordion
|
8
|
-
class Error < StandardError; end
|
9
|
-
|
10
|
-
class Railtie < Rails::Railtie
|
11
|
-
ActiveSupport.on_load :action_view do
|
12
|
-
include RailsAccordion
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def accordion(**args, &block)
|
17
|
-
render RailsAccordion::AccordionComponent.new(**args), &block
|
18
|
-
end
|
19
|
-
|
20
|
-
def accordion_item(**args, &block)
|
21
|
-
render RailsAccordion::ItemComponent.new(**args), &block
|
22
|
-
end
|
23
|
-
end
|