bs5 0.0.3 → 0.0.8
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
- data/README.md +1 -57
- data/app/components/bs5/alert_component.html.erb +1 -1
- data/app/components/bs5/alert_component.rb +5 -10
- data/app/components/bs5/badge_component.html.erb +1 -0
- data/app/components/bs5/badge_component.rb +38 -0
- data/app/components/bs5/breadcrumb_component.html.erb +9 -0
- data/app/components/bs5/breadcrumb_component.rb +12 -0
- data/app/components/bs5/close_button_component.html.erb +7 -0
- data/app/components/bs5/close_button_component.rb +29 -0
- data/app/components/bs5/example_component.html.erb +8 -0
- data/app/components/bs5/example_component.rb +44 -0
- data/app/controllers/bs5/application_controller.rb +9 -0
- data/app/controllers/bs5/examples_controller.rb +9 -0
- data/app/helpers/bs5/application_helper.rb +2 -0
- data/app/helpers/bs5/components_helper.rb +17 -3
- data/app/helpers/bs5/examples_helper.rb +9 -0
- data/app/models/bs5/application_record.rb +2 -0
- data/app/validators/style_validator.rb +11 -0
- data/app/views/bs5/examples/_accordion.html.erb +3 -0
- data/app/views/bs5/examples/_alert.html.erb +5 -0
- data/app/views/bs5/examples/_badge.html.erb +4 -0
- data/app/views/bs5/examples/_breadcrumb.html.erb +2 -0
- data/app/views/bs5/examples/_close_button.html.erb +4 -0
- data/app/views/bs5/examples/accordion/default/_example.html.erb +2 -0
- data/app/views/bs5/examples/accordion/default/snippet.html.erb +11 -0
- data/app/views/bs5/examples/accordion/flush/_example.html.erb +2 -0
- data/app/views/bs5/examples/accordion/flush/snippet.html.erb +11 -0
- data/app/views/bs5/examples/alert/additional_content/_example.html.erb +2 -0
- data/app/views/bs5/examples/alert/additional_content/snippet.html.erb +6 -0
- data/app/views/bs5/examples/alert/default/_example.html.erb +2 -0
- data/app/views/bs5/examples/alert/default/snippet.html.erb +3 -0
- data/app/views/bs5/examples/alert/dismissable/_example.html.erb +2 -0
- data/app/views/bs5/examples/alert/dismissable/snippet.html.erb +3 -0
- data/app/views/bs5/examples/alert/style/_example.html.erb +2 -0
- data/app/views/bs5/examples/alert/style/snippet.html.erb +31 -0
- data/app/views/bs5/examples/badge/default/_example.html.erb +2 -0
- data/app/views/bs5/examples/badge/default/snippet.html.erb +6 -0
- data/app/views/bs5/examples/badge/pill/_example.html.erb +2 -0
- data/app/views/bs5/examples/badge/pill/snippet.html.erb +8 -0
- data/app/views/bs5/examples/badge/style/_example.html.erb +2 -0
- data/app/views/bs5/examples/badge/style/snippet.html.erb +8 -0
- data/app/views/bs5/examples/breadcrumb/default/_example.html.erb +2 -0
- data/app/views/bs5/examples/breadcrumb/default/snippet.html.erb +14 -0
- data/app/views/bs5/examples/close_button/default/_example.html.erb +2 -0
- data/app/views/bs5/examples/close_button/default/snippet.html.erb +1 -0
- data/app/views/bs5/examples/close_button/disabled/_example.html.erb +2 -0
- data/app/views/bs5/examples/close_button/disabled/snippet.html.erb +1 -0
- data/app/views/bs5/examples/close_button/white/_example.html.erb +2 -0
- data/app/views/bs5/examples/close_button/white/snippet.html.erb +1 -0
- data/app/views/bs5/examples/index.html.erb +21 -0
- data/app/views/layouts/bs5/application.html.erb +6 -7
- data/config/locales/en.yml +8 -0
- data/config/routes.rb +5 -0
- data/lib/bs5.rb +3 -1
- data/lib/bs5/version.rb +1 -1
- data/lib/generators/bs5/install/install_generator.rb +28 -20
- data/lib/tasks/bs5_tasks.rake +1 -0
- data/lib/tasks/ci.rake +3 -0
- data/lib/tasks/rubocop.rake +5 -0
- metadata +87 -15
- data/app/jobs/bs5/application_job.rb +0 -4
- data/app/mailers/bs5/application_mailer.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77c7e79d854010df72b9492702bd2983468fb9237d3aecf619f3f6267db8c6fd
|
4
|
+
data.tar.gz: cc4cc0afd6b51f9c7b59ce3b38842255b7b4131640104aa297e9f10a655be51d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cc7b7a7c486b2b7783fbe4970900b9ec009ffcdb32bb9271fce6d15b24ef6ed7a407e6a67bb3a3056d7f3fdd64b1861b58f9baa6e012962ccdd0237d51063de
|
7
|
+
data.tar.gz: 6f5bad0ae1ce081d539855c2249292b2e2dbce5de4ece7d983aba5d31caf6414ff0b8f790a83927653db2c33c02845271ec222bceca6d01d9a5b90dc6f4c7e20
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
This is a Ruby on Rails engine to include [Bootstrap 5](https://v5.getbootstrap.com/).
|
4
4
|
|
5
|
-
[](https://badge.fury.io/rb/bs5)
|
5
|
+
[](https://badge.fury.io/rb/bs5) [](https://travis-ci.org/bazzel/bs5) [](https://rubystyle.guide)
|
6
6
|
|
7
7
|
## Usage
|
8
8
|
|
@@ -33,62 +33,6 @@ $ gem install bs5
|
|
33
33
|
Run the following command to setup your project to use Bootstrap 5.
|
34
34
|
|
35
35
|
$ rails generate bs5:install
|
36
|
-
|
37
|
-
## Components
|
38
|
-
|
39
|
-
### [Accordion](https://v5.getbootstrap.com/docs/5.0/components/accordion/) ✅
|
40
|
-
|
41
|
-
```
|
42
|
-
<%= bs5_accordion do |accordion| %>
|
43
|
-
<% accordion.slot(:item, title: 'Accordion Item #1', collapsed: false) do %>
|
44
|
-
<strong>This is the first item's accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
|
45
|
-
<% end %>
|
46
|
-
<% accordion.slot(:item, title: 'Accordion Item #2') do %>
|
47
|
-
<strong>This is the second item's accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
|
48
|
-
<% end %>
|
49
|
-
<% accordion.slot(:item, title: 'Accordion Item #3') do %>
|
50
|
-
<strong>This is the third item's accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
|
51
|
-
<% end %>
|
52
|
-
<%- end %>
|
53
|
-
```
|
54
|
-
```
|
55
|
-
<%= bs5_accordion(flush: true) do |accordion| %>
|
56
|
-
<% accordion.slot(:item, title: 'Accordion Item #1') do %>
|
57
|
-
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
|
58
|
-
<% end %>
|
59
|
-
<% accordion.slot(:item, title: 'Accordion Item #2') do %>
|
60
|
-
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
|
61
|
-
<% end %>
|
62
|
-
<% accordion.slot(:item, title: 'Accordion Item #3') do %>
|
63
|
-
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
|
64
|
-
<% end %>
|
65
|
-
<%- end %>
|
66
|
-
```
|
67
|
-
|
68
|
-
### [Alert](https://v5.getbootstrap.com/docs/5.0/components/alerts/) ✅
|
69
|
-
|
70
|
-
```
|
71
|
-
<%= bs5_alert do %>
|
72
|
-
A simple primary alert—check it out!
|
73
|
-
<%- end %>
|
74
|
-
```
|
75
|
-
|
76
|
-
```
|
77
|
-
<%= bs5_alert(type: :warning, is_dismissable: true) do %>
|
78
|
-
<strong>Holy guacamole!</strong> You should check in on some of those fields below.
|
79
|
-
<%- end %>
|
80
|
-
```
|
81
|
-
|
82
|
-
### [Badge](https://v5.getbootstrap.com/docs/5.0/components/badge/)
|
83
|
-
|
84
|
-
### [Breadcrumb](https://v5.getbootstrap.com/docs/5.0/components/breadcrumb/)
|
85
|
-
|
86
|
-
###[Button](https://v5.getbootstrap.com/docs/5.0/components/buttons/)
|
87
|
-
|
88
|
-
|
89
|
-
## Previewing components
|
90
|
-
|
91
|
-
* http://localhost:3000/rails/view_components
|
92
36
|
|
93
37
|
## Contributing
|
94
38
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div class="<%= component_class %>" role="alert">
|
2
2
|
<%= content %>
|
3
3
|
<%- if is_dismissable %>
|
4
|
-
|
4
|
+
<%= render Bs5::CloseButtonComponent.new(data: { dismiss: :alert }) %>
|
5
5
|
<%- end %>
|
6
6
|
</div>
|
@@ -2,18 +2,13 @@
|
|
2
2
|
|
3
3
|
module Bs5
|
4
4
|
class AlertComponent < ViewComponent::Base
|
5
|
-
|
5
|
+
attr_reader :style, :is_dismissable
|
6
6
|
|
7
7
|
include ActiveModel::Validations
|
8
|
+
validates :style, style: true
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
validates :type, inclusion: { in: TYPES, message: lambda do |_, data|
|
12
|
-
"#{data[:value].inspect} is not valid. Try #{TYPES.to_sentence(last_word_connector: ' or ')}."
|
13
|
-
end }
|
14
|
-
|
15
|
-
def initialize(type: :primary, is_dismissable: false)
|
16
|
-
@type = type.to_sym
|
10
|
+
def initialize(style: :primary, is_dismissable: false)
|
11
|
+
@style = style.to_sym
|
17
12
|
@is_dismissable = is_dismissable
|
18
13
|
end
|
19
14
|
|
@@ -34,7 +29,7 @@ module Bs5
|
|
34
29
|
end
|
35
30
|
|
36
31
|
def contextual_class
|
37
|
-
"alert-#{@
|
32
|
+
"alert-#{@style}"
|
38
33
|
end
|
39
34
|
end
|
40
35
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<span class="<%= component_class %>"><%= text %></span>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bs5
|
4
|
+
class BadgeComponent < ViewComponent::Base
|
5
|
+
attr_reader :text, :style
|
6
|
+
|
7
|
+
include ActiveModel::Validations
|
8
|
+
validates :style, style: true
|
9
|
+
|
10
|
+
def initialize(text:, style: :secondary, pill: false)
|
11
|
+
@text = text
|
12
|
+
@style = style.to_sym
|
13
|
+
@pill = pill
|
14
|
+
end
|
15
|
+
|
16
|
+
def before_render
|
17
|
+
raise errors.full_messages.to_sentence if invalid?
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def component_class
|
23
|
+
class_names = ['badge', contextual_class]
|
24
|
+
class_names << %w[rounded-pill] if pill?
|
25
|
+
class_names.join(' ')
|
26
|
+
end
|
27
|
+
|
28
|
+
def pill?
|
29
|
+
@pill
|
30
|
+
end
|
31
|
+
|
32
|
+
def contextual_class
|
33
|
+
class_names = ["bg-#{@style}"]
|
34
|
+
class_names << %w[text-dark] if style.in?(%i[warning info light])
|
35
|
+
class_names.join(' ')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<% if items.any? %>
|
2
|
+
<nav aria-label="breadcrumb">
|
3
|
+
<ol class="breadcrumb">
|
4
|
+
<% items.each do |item| %>
|
5
|
+
<li class="breadcrumb-item <%= item == items.last ? 'active' : '' %>" <%= item == items.last ? 'aria-current=page' : '' %>><%= item.content %></li>
|
6
|
+
<% end %>
|
7
|
+
</ol>
|
8
|
+
</nav>
|
9
|
+
<% end %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bs5
|
4
|
+
class CloseButtonComponent < ViewComponent::Base
|
5
|
+
attr_reader :data
|
6
|
+
|
7
|
+
def initialize(disabled: false, white: false, data: nil)
|
8
|
+
@disabled = disabled
|
9
|
+
@white = white
|
10
|
+
@data = data
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def white?
|
16
|
+
@white
|
17
|
+
end
|
18
|
+
|
19
|
+
def disabled?
|
20
|
+
@disabled
|
21
|
+
end
|
22
|
+
|
23
|
+
def component_class
|
24
|
+
class_names = ['btn-close']
|
25
|
+
class_names << %w[btn-close-white] if white?
|
26
|
+
class_names.join(' ')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rouge'
|
4
|
+
|
5
|
+
module Bs5
|
6
|
+
class ExampleComponent < ViewComponent::Base
|
7
|
+
include ComponentsHelper
|
8
|
+
|
9
|
+
attr_reader :snippet
|
10
|
+
|
11
|
+
def initialize(snippet:)
|
12
|
+
@snippet = snippet
|
13
|
+
@path = snippet.split('/')
|
14
|
+
@basename = @path.pop
|
15
|
+
end
|
16
|
+
|
17
|
+
def highlight
|
18
|
+
formatter = Rouge::Formatters::HTML.new
|
19
|
+
lexer = Rouge::Lexer.find(language)
|
20
|
+
formatter.format(lexer.lex(file_content)).html_safe # rubocop:disable Rails/OutputSafety
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def file_content
|
26
|
+
@file_content ||= file.read
|
27
|
+
end
|
28
|
+
|
29
|
+
def file
|
30
|
+
@file ||= examples_path
|
31
|
+
.join(*@path)
|
32
|
+
.children
|
33
|
+
.find { |ch| ch.basename.to_s.start_with?(@basename) }
|
34
|
+
end
|
35
|
+
|
36
|
+
def examples_path
|
37
|
+
Engine.root.join('app', 'views', 'bs5', 'examples')
|
38
|
+
end
|
39
|
+
|
40
|
+
def language
|
41
|
+
file.extname.delete('.')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -1,5 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Bs5
|
2
4
|
class ApplicationController < ActionController::Base
|
3
5
|
protect_from_forgery with: :exception
|
6
|
+
before_action :set_views_path
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def set_views_path
|
11
|
+
append_view_path Engine.root.join('app', 'views', 'bs5', 'examples')
|
12
|
+
end
|
4
13
|
end
|
5
14
|
end
|
@@ -2,15 +2,29 @@
|
|
2
2
|
|
3
3
|
module Bs5
|
4
4
|
module ComponentsHelper
|
5
|
+
def bs5_accordion(*args)
|
6
|
+
render AccordionComponent.new(*args) do |accordion|
|
7
|
+
yield accordion if block_given?
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
5
11
|
def bs5_alert(*args)
|
6
12
|
render AlertComponent.new(*args) do
|
7
13
|
yield if block_given?
|
8
14
|
end
|
9
15
|
end
|
10
16
|
|
11
|
-
def
|
12
|
-
render
|
13
|
-
|
17
|
+
def bs5_badge(*args)
|
18
|
+
render BadgeComponent.new(*args)
|
19
|
+
end
|
20
|
+
|
21
|
+
def bs5_close_button(*args)
|
22
|
+
render CloseButtonComponent.new(*args)
|
23
|
+
end
|
24
|
+
|
25
|
+
def bs5_breadcrumb(*args)
|
26
|
+
render BreadcrumbComponent.new(*args) do |breadcrumb|
|
27
|
+
yield breadcrumb if block_given?
|
14
28
|
end
|
15
29
|
end
|
16
30
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class StyleValidator < ActiveModel::EachValidator
|
4
|
+
STYLES = %i[primary secondary success danger warning info light dark].freeze
|
5
|
+
|
6
|
+
def validate_each(record, attribute, value)
|
7
|
+
return if value.in?(STYLES)
|
8
|
+
|
9
|
+
record.errors.add(attribute, :inclusion, valid_styles: STYLES.to_sentence)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= bs5_accordion do |accordion| %>
|
2
|
+
<% accordion.slot(:item, title: 'Accordion Item #1', collapsed: false) do %>
|
3
|
+
<strong>This is the first item's accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
|
4
|
+
<% end %>
|
5
|
+
<% accordion.slot(:item, title: 'Accordion Item #2') do %>
|
6
|
+
<strong>This is the second item's accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
|
7
|
+
<% end %>
|
8
|
+
<% accordion.slot(:item, title: 'Accordion Item #3') do %>
|
9
|
+
<strong>This is the third item's accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
|
10
|
+
<% end %>
|
11
|
+
<%- end %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= bs5_accordion(flush: true) do |accordion| %>
|
2
|
+
<% accordion.slot(:item, title: 'Accordion Item #1') do %>
|
3
|
+
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
|
4
|
+
<% end %>
|
5
|
+
<% accordion.slot(:item, title: 'Accordion Item #2') do %>
|
6
|
+
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
|
7
|
+
<% end %>
|
8
|
+
<% accordion.slot(:item, title: 'Accordion Item #3') do %>
|
9
|
+
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
|
10
|
+
<% end %>
|
11
|
+
<%- end %>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%= bs5_alert(style: :success) do %>
|
2
|
+
<h4 class="alert-heading">Well done!</h4>
|
3
|
+
<p>Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.</p>
|
4
|
+
<hr>
|
5
|
+
<p class="mb-0">Whenever you need to, be sure to use margin utilities to keep things nice and tidy.</p>
|
6
|
+
<%- end %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<%= bs5_alert(style: :primary) do %>
|
2
|
+
A simple primary alert—check it out!
|
3
|
+
<%- end %>
|
4
|
+
|
5
|
+
<%= bs5_alert(style: :secondary) do %>
|
6
|
+
A simple secondary alert—check it out!
|
7
|
+
<%- end %>
|
8
|
+
|
9
|
+
<%= bs5_alert(style: :success) do %>
|
10
|
+
A simple success alert—check it out!
|
11
|
+
<%- end %>
|
12
|
+
|
13
|
+
<%= bs5_alert(style: :danger) do %>
|
14
|
+
A simple danger alert—check it out!
|
15
|
+
<%- end %>
|
16
|
+
|
17
|
+
<%= bs5_alert(style: :warning) do %>
|
18
|
+
A simple warning alert—check it out!
|
19
|
+
<%- end %>
|
20
|
+
|
21
|
+
<%= bs5_alert(style: :info) do %>
|
22
|
+
A simple info alert—check it out!
|
23
|
+
<%- end %>
|
24
|
+
|
25
|
+
<%= bs5_alert(style: :light) do %>
|
26
|
+
A simple light alert—check it out!
|
27
|
+
<%- end %>
|
28
|
+
|
29
|
+
<%= bs5_alert(style: :dark) do %>
|
30
|
+
A simple dark alert—check it out!
|
31
|
+
<%- end %>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<h1>Example heading <%= bs5_badge(text: 'New') %></h1>
|
2
|
+
<h2>Example heading <%= bs5_badge(text: 'New') %></h2>
|
3
|
+
<h3>Example heading <%= bs5_badge(text: 'New') %></h3>
|
4
|
+
<h4>Example heading <%= bs5_badge(text: 'New') %></h4>
|
5
|
+
<h5>Example heading <%= bs5_badge(text: 'New') %></h5>
|
6
|
+
<h6>Example heading <%= bs5_badge(text: 'New') %></h6>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= bs5_badge(text: 'Primary', style: :primary, pill: true) %>
|
2
|
+
<%= bs5_badge(text: 'Secondary', style: :secondary, pill: true) %>
|
3
|
+
<%= bs5_badge(text: 'Sucess', style: :success, pill: true) %>
|
4
|
+
<%= bs5_badge(text: 'Danger', style: :danger, pill: true) %>
|
5
|
+
<%= bs5_badge(text: 'Warning', style: :warning, pill: true) %>
|
6
|
+
<%= bs5_badge(text: 'Info', style: :info, pill: true) %>
|
7
|
+
<%= bs5_badge(text: 'Light', style: :light, pill: true) %>
|
8
|
+
<%= bs5_badge(text: 'Dark', style: :dark, pill: true) %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= bs5_badge(text: 'Primary', style: :primary) %>
|
2
|
+
<%= bs5_badge(text: 'Secondary', style: :secondary) %>
|
3
|
+
<%= bs5_badge(text: 'Success', style: :success) %>
|
4
|
+
<%= bs5_badge(text: 'Danger', style: :danger) %>
|
5
|
+
<%= bs5_badge(text: 'Warning', style: :warning) %>
|
6
|
+
<%= bs5_badge(text: 'Info', style: :info) %>
|
7
|
+
<%= bs5_badge(text: 'Light', style: :light) %>
|
8
|
+
<%= bs5_badge(text: 'Dark', style: :dark) %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%= bs5_breadcrumb do |breadcrumb| %>
|
2
|
+
<% breadcrumb.slot(:item) do %>Home<% end %>
|
3
|
+
<%- end %>
|
4
|
+
|
5
|
+
<%= bs5_breadcrumb do |breadcrumb| %>
|
6
|
+
<% breadcrumb.slot(:item) do %><a href="#">Home</a><% end %>
|
7
|
+
<% breadcrumb.slot(:item) do %>Library<% end %>
|
8
|
+
<%- end %>
|
9
|
+
|
10
|
+
<%= bs5_breadcrumb do |breadcrumb| %>
|
11
|
+
<% breadcrumb.slot(:item) do %><a href="#">Home</a><% end %>
|
12
|
+
<% breadcrumb.slot(:item) do %><a href="#">Library</a><% end %>
|
13
|
+
<% breadcrumb.slot(:item) do %>Data<% end %>
|
14
|
+
<%- end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= bs5_close_button %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= bs5_close_button(disabled: true) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= bs5_close_button(white: true) %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="col">
|
3
|
+
<div class="sticky-top">
|
4
|
+
<ul class="nav flex-column">
|
5
|
+
<li>Accordion</li>
|
6
|
+
<li>Alert</li>
|
7
|
+
<li>Badge</li>
|
8
|
+
<li>Close button</li>
|
9
|
+
<li>Breadcrumb</li>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
<div class="col-10">
|
14
|
+
<h1>Bootstrap Examples</h1>
|
15
|
+
<%= render 'accordion' %>
|
16
|
+
<%= render 'alert' %>
|
17
|
+
<%= render 'badge' %>
|
18
|
+
<%= render 'close_button' %>
|
19
|
+
<%= render 'breadcrumb' %>
|
20
|
+
</div>
|
21
|
+
</div>
|
@@ -2,14 +2,13 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<title>Bs5</title>
|
5
|
-
<%=
|
6
|
-
<%=
|
7
|
-
|
8
|
-
<%= stylesheet_link_tag "bs5/application", media: "all" %>
|
5
|
+
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
6
|
+
<%= stylesheet_pack_tag 'styles', media: 'all', 'data-turbolinks-track': 'reload' %>
|
7
|
+
<style><%= Rouge::Themes::Github.render(scope: '.highlight') %></style>
|
9
8
|
</head>
|
10
9
|
<body>
|
11
|
-
|
12
|
-
<%= yield %>
|
13
|
-
|
10
|
+
<div class="container">
|
11
|
+
<%= yield %>
|
12
|
+
</div>
|
14
13
|
</body>
|
15
14
|
</html>
|
data/config/routes.rb
CHANGED
data/lib/bs5.rb
CHANGED
data/lib/bs5/version.rb
CHANGED
@@ -1,29 +1,37 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
module Bs5
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
5
|
+
def add_bootstrap # rubocop:disable Metrics/MethodLength
|
6
|
+
run 'yarn add bootstrap@next popper.js'
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
HEREDOC
|
10
|
-
|
11
|
-
inject_into_file 'app/views/layouts/application.html.erb', before: '</head>' do
|
12
|
-
<<~HEREDOC
|
13
|
-
<%= stylesheet_pack_tag 'styles', media: 'all', 'data-turbolinks-track': 'reload' %>
|
8
|
+
create_file 'app/javascript/packs/styles.scss', <<~HEREDOC
|
9
|
+
@import "~bootstrap/scss/bootstrap";
|
14
10
|
HEREDOC
|
15
|
-
end
|
16
11
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
inject_into_file 'app/views/layouts/application.html.erb', before: '</head>' do
|
13
|
+
<<~HEREDOC
|
14
|
+
<%= stylesheet_pack_tag 'styles', media: 'all', 'data-turbolinks-track': 'reload' %>
|
15
|
+
HEREDOC
|
16
|
+
end
|
22
17
|
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
inject_into_file 'app/controllers/application_controller.rb', after: "ActionController::Base\n" do
|
19
|
+
<<~HEREDOC
|
20
|
+
helper Bs5::Engine.helpers
|
21
|
+
HEREDOC
|
22
|
+
end
|
26
23
|
|
27
|
-
|
24
|
+
inject_into_file 'config/routes.rb', after: "Rails.application.routes.draw do\n" do
|
25
|
+
<<~HEREDOC
|
26
|
+
mount Bs5::Engine => '/bs5'
|
27
|
+
HEREDOC
|
28
|
+
end
|
29
|
+
|
30
|
+
append_file 'app/javascript/packs/application.js', <<~HEREDOC
|
31
|
+
import "bootstrap";
|
32
|
+
HEREDOC
|
33
|
+
|
34
|
+
gsub_file 'config/webpacker.yml', 'extract_css: false', 'extract_css: true'
|
35
|
+
end
|
28
36
|
end
|
29
37
|
end
|
data/lib/tasks/bs5_tasks.rake
CHANGED
data/lib/tasks/ci.rake
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bs5
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Baselier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,6 +30,34 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 6.0.3.4
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rouge
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 3.25.0
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 3.25.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rubocop-rails
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '2.8'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '2.8'
|
33
61
|
- !ruby/object:Gem::Dependency
|
34
62
|
name: view_component
|
35
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,19 +73,19 @@ dependencies:
|
|
45
73
|
- !ruby/object:Gem::Version
|
46
74
|
version: 2.22.0
|
47
75
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
76
|
+
name: capybara
|
49
77
|
requirement: !ruby/object:Gem::Requirement
|
50
78
|
requirements:
|
51
|
-
- - "
|
79
|
+
- - "~>"
|
52
80
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
81
|
+
version: '3.33'
|
54
82
|
type: :development
|
55
83
|
prerelease: false
|
56
84
|
version_requirements: !ruby/object:Gem::Requirement
|
57
85
|
requirements:
|
58
|
-
- - "
|
86
|
+
- - "~>"
|
59
87
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
88
|
+
version: '3.33'
|
61
89
|
- !ruby/object:Gem::Dependency
|
62
90
|
name: rspec-rails
|
63
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,19 +101,19 @@ dependencies:
|
|
73
101
|
- !ruby/object:Gem::Version
|
74
102
|
version: 4.0.1
|
75
103
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
104
|
+
name: sqlite3
|
77
105
|
requirement: !ruby/object:Gem::Requirement
|
78
106
|
requirements:
|
79
|
-
- - "
|
107
|
+
- - ">="
|
80
108
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
109
|
+
version: '0'
|
82
110
|
type: :development
|
83
111
|
prerelease: false
|
84
112
|
version_requirements: !ruby/object:Gem::Requirement
|
85
113
|
requirements:
|
86
|
-
- - "
|
114
|
+
- - ">="
|
87
115
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
116
|
+
version: '0'
|
89
117
|
description: "[WIP] Rails engine to include Bootstrap 5."
|
90
118
|
email:
|
91
119
|
- patrick.baselier@gmail.com
|
@@ -102,13 +130,55 @@ files:
|
|
102
130
|
- app/components/bs5/accordion_component.rb
|
103
131
|
- app/components/bs5/alert_component.html.erb
|
104
132
|
- app/components/bs5/alert_component.rb
|
133
|
+
- app/components/bs5/badge_component.html.erb
|
134
|
+
- app/components/bs5/badge_component.rb
|
135
|
+
- app/components/bs5/breadcrumb_component.html.erb
|
136
|
+
- app/components/bs5/breadcrumb_component.rb
|
137
|
+
- app/components/bs5/close_button_component.html.erb
|
138
|
+
- app/components/bs5/close_button_component.rb
|
139
|
+
- app/components/bs5/example_component.html.erb
|
140
|
+
- app/components/bs5/example_component.rb
|
105
141
|
- app/controllers/bs5/application_controller.rb
|
142
|
+
- app/controllers/bs5/examples_controller.rb
|
106
143
|
- app/helpers/bs5/application_helper.rb
|
107
144
|
- app/helpers/bs5/components_helper.rb
|
108
|
-
- app/
|
109
|
-
- app/mailers/bs5/application_mailer.rb
|
145
|
+
- app/helpers/bs5/examples_helper.rb
|
110
146
|
- app/models/bs5/application_record.rb
|
147
|
+
- app/validators/style_validator.rb
|
148
|
+
- app/views/bs5/examples/_accordion.html.erb
|
149
|
+
- app/views/bs5/examples/_alert.html.erb
|
150
|
+
- app/views/bs5/examples/_badge.html.erb
|
151
|
+
- app/views/bs5/examples/_breadcrumb.html.erb
|
152
|
+
- app/views/bs5/examples/_close_button.html.erb
|
153
|
+
- app/views/bs5/examples/accordion/default/_example.html.erb
|
154
|
+
- app/views/bs5/examples/accordion/default/snippet.html.erb
|
155
|
+
- app/views/bs5/examples/accordion/flush/_example.html.erb
|
156
|
+
- app/views/bs5/examples/accordion/flush/snippet.html.erb
|
157
|
+
- app/views/bs5/examples/alert/additional_content/_example.html.erb
|
158
|
+
- app/views/bs5/examples/alert/additional_content/snippet.html.erb
|
159
|
+
- app/views/bs5/examples/alert/default/_example.html.erb
|
160
|
+
- app/views/bs5/examples/alert/default/snippet.html.erb
|
161
|
+
- app/views/bs5/examples/alert/dismissable/_example.html.erb
|
162
|
+
- app/views/bs5/examples/alert/dismissable/snippet.html.erb
|
163
|
+
- app/views/bs5/examples/alert/style/_example.html.erb
|
164
|
+
- app/views/bs5/examples/alert/style/snippet.html.erb
|
165
|
+
- app/views/bs5/examples/badge/default/_example.html.erb
|
166
|
+
- app/views/bs5/examples/badge/default/snippet.html.erb
|
167
|
+
- app/views/bs5/examples/badge/pill/_example.html.erb
|
168
|
+
- app/views/bs5/examples/badge/pill/snippet.html.erb
|
169
|
+
- app/views/bs5/examples/badge/style/_example.html.erb
|
170
|
+
- app/views/bs5/examples/badge/style/snippet.html.erb
|
171
|
+
- app/views/bs5/examples/breadcrumb/default/_example.html.erb
|
172
|
+
- app/views/bs5/examples/breadcrumb/default/snippet.html.erb
|
173
|
+
- app/views/bs5/examples/close_button/default/_example.html.erb
|
174
|
+
- app/views/bs5/examples/close_button/default/snippet.html.erb
|
175
|
+
- app/views/bs5/examples/close_button/disabled/_example.html.erb
|
176
|
+
- app/views/bs5/examples/close_button/disabled/snippet.html.erb
|
177
|
+
- app/views/bs5/examples/close_button/white/_example.html.erb
|
178
|
+
- app/views/bs5/examples/close_button/white/snippet.html.erb
|
179
|
+
- app/views/bs5/examples/index.html.erb
|
111
180
|
- app/views/layouts/bs5/application.html.erb
|
181
|
+
- config/locales/en.yml
|
112
182
|
- config/routes.rb
|
113
183
|
- lib/bs5.rb
|
114
184
|
- lib/bs5/engine.rb
|
@@ -116,6 +186,8 @@ files:
|
|
116
186
|
- lib/generators/bs5/install/USAGE
|
117
187
|
- lib/generators/bs5/install/install_generator.rb
|
118
188
|
- lib/tasks/bs5_tasks.rake
|
189
|
+
- lib/tasks/ci.rake
|
190
|
+
- lib/tasks/rubocop.rake
|
119
191
|
homepage: https://github.com/bazzel/bs5
|
120
192
|
licenses:
|
121
193
|
- MIT
|
@@ -128,7 +200,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
200
|
requirements:
|
129
201
|
- - ">="
|
130
202
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
203
|
+
version: 2.6.6
|
132
204
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
205
|
requirements:
|
134
206
|
- - ">="
|