collapsible_section 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 524092c930ddb71116e48e940ebd81cfb602a9164c3c14fc860e0c31625b6073
4
+ data.tar.gz: 1ed792284e2d1f143e0a9478f1bec216f7d430c9f7f5fd87eef1d1d71d926aba
5
+ SHA512:
6
+ metadata.gz: beca26ae646a442b20f4ad9788167570e7db374555fbde0f688cff53dcf37d2e42a75bffb05d0343d7d610bc15cfb623ceaa353b9afec6a3894c8c3f9a674563
7
+ data.tar.gz: 992f64bb568ab91e2d947d4fe076bbd9d18ba9aeaf76a694c33e09683174e455f91c23e2a6fba0c545200008860cd72b9e09b42720bf54f5c329a1446b096570
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2025-07-20
4
+
5
+ - Initial release
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Yaroslav Yenkala
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # CollapsibleSection
2
+
3
+ A Rails gem that provides a simple helper method to generate HTML5 `<details>` collapsible sections with consistent styling and structure.
4
+
5
+ ## Usage in your project
6
+
7
+ Add to Gemfile:
8
+
9
+ ```Gemfile
10
+ gem 'collapsible_section', '~> 0.1.0'
11
+ ```
12
+
13
+ After building and installing the gem, replace your selected code with:
14
+
15
+ ```ruby
16
+ = collapsible_section(t('your_text'), open: true) do
17
+ = render('some_section_for_block', some_variable_for_block: current_variable)
18
+ ```
19
+
20
+ This will generate the same HTML structure but through a reusable gem component:
21
+
22
+ ```haml
23
+ %details.section-collapsable{open: true}
24
+ %summary.section-header
25
+ %h3.section-title
26
+ = your_title
27
+ = your_block
28
+ ```
29
+
30
+ ## Installation
31
+
32
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
33
+
34
+ Install the gem and add to the application's Gemfile by executing:
35
+
36
+ ```bash
37
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
38
+ ```
39
+
40
+ If bundler is not being used to manage dependencies, install the gem by executing:
41
+
42
+ ```bash
43
+ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
44
+ ```
45
+
46
+ ## Usage
47
+
48
+ TODO: Write usage instructions here
49
+
50
+ ## Development
51
+
52
+ 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.
53
+
54
+ 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).
55
+
56
+ ## Contributing
57
+
58
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/collapsible_section. 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]/collapsible_section/blob/main/CODE_OF_CONDUCT.md).
59
+
60
+ ## License
61
+
62
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
63
+
64
+ ## Code of Conduct
65
+
66
+ Everyone interacting in the CollapsibleSection project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/collapsible_section/blob/main/CODE_OF_CONDUCT.md).
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CollapsibleSection
4
+ module Helper
5
+ def collapsible_section(title, open: true, &block)
6
+ content_tag(:details, class: "section-collapsable", open: open) do
7
+ summary_content = content_tag(:h3, title, class: "section-title")
8
+ concat content_tag(:summary, summary_content, class: "section-header")
9
+ concat capture(&block) if block_given?
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CollapsibleSection
4
+ class Railtie < Rails::Railtie
5
+ initializer "collapsible_section.helper" do
6
+ ActionView::Base.include CollapsibleSection::Helper
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CollapsibleSection
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "collapsible_section/version"
4
+ require_relative "collapsible_section/helper"
5
+ require_relative "collapsible_section/railtie" if defined?(Rails)
6
+
7
+ module CollapsibleSection
8
+ class Error < StandardError; end
9
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: collapsible_section
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Yaroslav Yenkala
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2025-08-04 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: rails
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '7.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '7.0'
26
+ description: This gem provides a simple helper method to create collapsible sections
27
+ in Rails views.
28
+ email:
29
+ - yaroslavrick@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - CHANGELOG.md
35
+ - LICENSE.txt
36
+ - README.md
37
+ - lib/collapsible_section.rb
38
+ - lib/collapsible_section/helper.rb
39
+ - lib/collapsible_section/railtie.rb
40
+ - lib/collapsible_section/version.rb
41
+ homepage: https://github.com/yaroslavrick/collapsible_section
42
+ licenses:
43
+ - MIT
44
+ metadata:
45
+ homepage_uri: https://github.com/yaroslavrick/collapsible_section
46
+ changelog_uri: https://github.com/yaroslavrick/collapsible_section/blob/main/CHANGELOG.md
47
+ rubygems_mfa_required: 'true'
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 3.3.0
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubygems_version: 3.6.2
63
+ specification_version: 4
64
+ summary: Simple collapsible section helper for Rails applications.
65
+ test_files: []