├── .gitignore ├── README.md ├── bootstrap-viewcomponent.gemspec └── lib ├── bootstrap-viewcomponent.rb ├── breadcrumb.html.erb ├── breadcrumb.rb ├── breadcrumb_item.html.erb ├── breadcrumb_item.rb ├── link_to_modal.html.erb ├── link_to_modal.rb ├── modal.html.erb └── modal.rb /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bootstrap View Components 2 | 3 | A boilerplate set of view components for Bootstrap 4.4 based on [Github's View Component library](https://github.com/github/actionview-component). 4 | 5 | :squirrel: Tested in Production at [Jellyswitch](https://www.jellyswitch.com) 6 | 7 | **NOTE** This is an alpha gem and not ready for widespread use yet. Stay tuned! 8 | 9 | ## Installation 10 | 11 | Add this line to your application's Gemfile: 12 | 13 | ```ruby 14 | gem 'bootstrap-viewcomponent' 15 | ``` 16 | 17 | And run: 18 | 19 | ```sh 20 | bundle install 21 | ``` 22 | 23 | And restart your web server. 24 | 25 | ## Usage 26 | 27 | TODO 28 | 29 | ## TODO 30 | 31 | - Usage instructions 32 | - Upgrade to latest ViewComponent gem 33 | - Rails engine to demonstrate component library (in a similar format to the Bootstrap homepage) 34 | -------------------------------------------------------------------------------- /bootstrap-viewcomponent.gemspec: -------------------------------------------------------------------------------- 1 | Gem::Specification.new do |s| 2 | s.name = "bootstrap-viewcomponent" 3 | s.version = "0.0.1" 4 | 5 | s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= 6 | s.authors = ["Dave Paola"] 7 | s.date = %q{2020-03-04} 8 | s.description = %q{View Components for Bootstrap} 9 | s.email = %q{dpaola2@gmail.com} 10 | s.files = ["lib/bootstrap-viewcomponent.rb"] 11 | s.test_files = [] 12 | s.homepage = "https://github.com/dpaola2/bootstrap-viewcomponent" 13 | s.require_paths = ["lib"] 14 | s.rubygems_version = %q{1.6.2} 15 | s.summary = %q{View Components for Bootstrap} 16 | s.metadata = { "source_code_uri" => "https://github.com/dpaola2/bootstrap-viewcomponent" } 17 | 18 | s.add_runtime_dependency 'bootstrap', '~> 4.3.1' 19 | s.add_runtime_dependency "actionview-component", '1.4.0' 20 | s.add_development_dependency "actionview-component", '1.4.0' 21 | 22 | if s.respond_to? :specification_version then 23 | s.specification_version = 3 24 | 25 | if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then 26 | else 27 | end 28 | else 29 | end 30 | end -------------------------------------------------------------------------------- /lib/bootstrap-viewcomponent.rb: -------------------------------------------------------------------------------- 1 | require 'bootstrap' 2 | 3 | require 'action_view/component/base' 4 | 5 | require 'breadcrumb' 6 | require 'breadcrumb_item' 7 | require 'link_to_modal' 8 | require 'modal' -------------------------------------------------------------------------------- /lib/breadcrumb.html.erb: -------------------------------------------------------------------------------- 1 | <% if !mobile_app_request? %> 2 |
3 |
4 |
5 | 10 |
11 |
12 |
13 | <% end %> -------------------------------------------------------------------------------- /lib/breadcrumb.rb: -------------------------------------------------------------------------------- 1 | class Bootstrap::Breadcrumb < ActionView::Component::Base 2 | include ApplicationHelper 3 | 4 | def initialize(options = {}) 5 | end 6 | end -------------------------------------------------------------------------------- /lib/breadcrumb_item.html.erb: -------------------------------------------------------------------------------- 1 | <% if active %> 2 | 3 | <% else %> 4 | 5 | <% end %> -------------------------------------------------------------------------------- /lib/breadcrumb_item.rb: -------------------------------------------------------------------------------- 1 | class Bootstrap::BreadcrumbItem < ActionView::Component::Base 2 | def initialize(label:, active:, path:) 3 | @label = label 4 | @active = active 5 | @path = path 6 | end 7 | 8 | private 9 | 10 | attr_accessor :label, :active, :path 11 | end -------------------------------------------------------------------------------- /lib/link_to_modal.html.erb: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /lib/link_to_modal.rb: -------------------------------------------------------------------------------- 1 | class Bootstrap::LinkToModal < ActionView::Component::Base 2 | def initialize(id:) 3 | @id = id 4 | end 5 | 6 | private 7 | 8 | attr_accessor :id 9 | end -------------------------------------------------------------------------------- /lib/modal.html.erb: -------------------------------------------------------------------------------- 1 | 11 | 12 | -------------------------------------------------------------------------------- /lib/modal.rb: -------------------------------------------------------------------------------- 1 | class Bootstrap::Modal < ActionView::Component::Base 2 | def initialize(id:) 3 | @id = id 4 | end 5 | 6 | private 7 | 8 | attr_accessor :id 9 | end --------------------------------------------------------------------------------