rails_accordion 0.1.6.pre.beta → 0.1.8.pre.beta

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: 2ea3fe333f60ade1175aa01c95276b51dfc63926872b0796986a8f45b2f7d1bc
4
- data.tar.gz: e74020dbf76050ee024f7220164289578ded3a57bfc41f89a8d05f0726091855
3
+ metadata.gz: b39b7fbe42557d8a2acff68b4809b8e9f255729fa207d2f6942795fb9b1e7f0e
4
+ data.tar.gz: 1b7435447fc4e59f76359b70e4d8da33c4c89a06a5be2341421eb274ad322e49
5
5
  SHA512:
6
- metadata.gz: 15d0ebc7d8fb88b0b70c25b5f4f97537c62e9a845342cffcaba296e39eac0b205c3feeef9d9b1e1f74bdfd8227d513c7107f8e5e217b1baa26a7f85a8c971763
7
- data.tar.gz: 885ad23a42b4bdbc3f841f5d33901742e7fa1b6ba74f74934394cccdde3e8ebe51d8e7cbd1d0188e314a196a2fae86bd928debdc629643921c050c54c72b127b
6
+ metadata.gz: 48f15b533edef3785480f1502295f541be98bbceb5a3f12a5dbba13d66dd4dc8b73f87eeb673f07d81fe1cbd83f1737749160233a5f181454f27ef724b6ca5bf
7
+ data.tar.gz: 3ad161b05e66617b83357c328a15af57043bb57ae9464ac971b04ca859da39b3cb81b95169084f33f3345982326bdfafd80f30af4ea9834fbfe91bdd3b929710
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.6.pre.beta
4
+ version: 0.1.8.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-17 00:00:00.000000000 Z
11
+ date: 2023-05-20 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,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- require "rubocop/rake_task"
9
-
10
- RuboCop::RakeTask.new
11
-
12
- task default: %i[spec rubocop]
@@ -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
- }
@@ -1,13 +0,0 @@
1
- module RailsAccordion
2
- class Accordion
3
- class_attribute :items, default: []
4
-
5
- def initialize(**args, &block)
6
- @args = args.presence || {}
7
- end
8
-
9
- def add_item(**args, &block)
10
-
11
- end
12
- end
13
- end
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
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RailsAccordion
4
- VERSION = "0.1.6-beta"
5
- end
@@ -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
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :rails_table do
3
- # # Task goes here
4
- # end