bs5 0.0.6 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/components/bs5/alert_component.rb +2 -0
- data/app/components/bs5/badge_component.rb +2 -0
- data/app/components/bs5/breadcrumb_component.html.erb +9 -0
- data/app/components/bs5/breadcrumb_component.rb +12 -0
- data/app/components/bs5/button_tag_component.rb +100 -0
- data/app/components/bs5/button_to_component.rb +106 -0
- data/app/helpers/bs5/components_helper.rb +10 -13
- data/app/validators/style_validator.rb +2 -4
- data/app/views/bs5/examples/_alert.html.erb +1 -0
- data/app/views/bs5/examples/_breadcrumb.html.erb +2 -0
- data/app/views/bs5/examples/_buttons.html.erb +11 -0
- data/app/views/bs5/examples/_close_button.html.erb +4 -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/dismissable/_example.html.erb +1 -1
- data/app/views/bs5/examples/alert/style/snippet.html.erb +28 -0
- data/app/views/bs5/examples/badge/default/_example.html.erb +1 -1
- data/app/views/bs5/examples/badge/default/snippet.html.erb +6 -1
- data/app/views/bs5/examples/badge/pill/_example.html.erb +1 -1
- data/app/views/bs5/examples/badge/pill/snippet.html.erb +8 -1
- data/app/views/bs5/examples/badge/style/_example.html.erb +1 -1
- data/app/views/bs5/examples/badge/style/snippet.html.erb +8 -1
- 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/buttons/button_tag/block_buttons/_example.html.erb +5 -0
- data/app/views/bs5/examples/buttons/button_tag/block_buttons/block_buttons.html.erb +4 -0
- data/app/views/bs5/examples/buttons/button_tag/block_buttons/responsive_block_buttons_1.html.erb +4 -0
- data/app/views/bs5/examples/buttons/button_tag/block_buttons/responsive_block_buttons_2.html.erb +4 -0
- data/app/views/bs5/examples/buttons/button_tag/block_buttons/responsive_block_buttons_3.html.erb +4 -0
- data/app/views/bs5/examples/buttons/button_tag/default/_example.html.erb +2 -0
- data/app/views/bs5/examples/buttons/button_tag/default/snippet.html.erb +15 -0
- data/app/views/bs5/examples/buttons/button_tag/outline/_example.html.erb +2 -0
- data/app/views/bs5/examples/buttons/button_tag/outline/snippet.html.erb +19 -0
- data/app/views/bs5/examples/buttons/button_tag/size/_example.html.erb +3 -0
- data/app/views/bs5/examples/buttons/button_tag/size/large.html.erb +3 -0
- data/app/views/bs5/examples/buttons/button_tag/size/small.html.erb +3 -0
- data/app/views/bs5/examples/buttons/button_tag/style/_example.html.erb +2 -0
- data/app/views/bs5/examples/buttons/button_tag/style/snippet.html.erb +19 -0
- data/app/views/bs5/examples/buttons/button_tag/toggle_states/_example.html.erb +2 -0
- data/app/views/bs5/examples/buttons/button_tag/toggle_states/snippet.html.erb +3 -0
- data/app/views/bs5/examples/buttons/button_to/default/_example.html.erb +2 -0
- data/app/views/bs5/examples/buttons/button_to/default/snippet.html.erb +11 -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 +23 -4
- data/config/definitions.rb +31 -0
- data/config/locales/en.yml +12 -0
- data/lib/bs5/version.rb +1 -1
- metadata +38 -4
- data/app/jobs/bs5/application_job.rb +0 -6
- data/app/mailers/bs5/application_mailer.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d45e3e9d6c5303c22f72e3637abc45b8302a2834956d9213a3cbe3300320658
|
4
|
+
data.tar.gz: 0c9d8ed8656a427932ba2fae5a49bb6f8110bd0a86d7af8a0f95020ae0cafd6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 149b6ad2c77ad23fcef6c02d0a6e6b147dd32e0d1299807484233b207dc7280c90d3bf2fce397c02b64376478ace48bcc30aea57de654fa9ce0a6c4a715ccc7d
|
7
|
+
data.tar.gz: 59471a7a2b75588e27d203e982ae52f1b1e54498ca0e26c6776bf7b5ef34166cbd7f644a80302f6ec1034b747b34f5b144d03bca836c07f84ba5808f3dbfa999
|
@@ -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,100 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bs5
|
4
|
+
class ButtonTagComponent < ViewComponent::Base
|
5
|
+
STYLES = %i[primary secondary success danger warning info light dark link].freeze
|
6
|
+
DEFAULT_STYLE = :primary
|
7
|
+
SIZES = { small: :sm, large: :lg }.freeze
|
8
|
+
CLASS_PREFIX = 'btn'
|
9
|
+
|
10
|
+
attr_reader :content_or_options, :size
|
11
|
+
|
12
|
+
include ActiveModel::Validations
|
13
|
+
validates :style, style: true
|
14
|
+
validates :size, inclusion: { in: SIZES.keys, valid_sizes: SIZES.keys.to_sentence, allow_nil: true }
|
15
|
+
|
16
|
+
def initialize(content_or_options = nil, options = nil)
|
17
|
+
if content_or_options.is_a? Hash
|
18
|
+
self.options = content_or_options
|
19
|
+
else
|
20
|
+
@content_or_options = content_or_options
|
21
|
+
self.options = options
|
22
|
+
end
|
23
|
+
|
24
|
+
extract_custom_options
|
25
|
+
merge_default_options
|
26
|
+
end
|
27
|
+
|
28
|
+
def before_render
|
29
|
+
raise errors.full_messages.to_sentence if invalid?
|
30
|
+
end
|
31
|
+
|
32
|
+
def call
|
33
|
+
button_tag(content || content_or_options, options)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def options=(value)
|
39
|
+
@options = Hash(value).symbolize_keys!
|
40
|
+
end
|
41
|
+
|
42
|
+
def options
|
43
|
+
@options.empty? ? nil : @options
|
44
|
+
end
|
45
|
+
|
46
|
+
def extract_custom_options
|
47
|
+
extract_style
|
48
|
+
extract_outline
|
49
|
+
extract_size
|
50
|
+
end
|
51
|
+
|
52
|
+
def extract_style
|
53
|
+
@style = @options.delete(:style)
|
54
|
+
end
|
55
|
+
|
56
|
+
def extract_outline
|
57
|
+
@outline = @options.delete(:outline)
|
58
|
+
end
|
59
|
+
|
60
|
+
def extract_size
|
61
|
+
@size = @options.delete(:size)
|
62
|
+
end
|
63
|
+
|
64
|
+
def merge_default_options
|
65
|
+
@options.deep_merge!(default_options) do |_key, this_val, other_val|
|
66
|
+
[this_val, other_val].join(' ').strip
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def default_options
|
71
|
+
{ class: button_class }
|
72
|
+
end
|
73
|
+
|
74
|
+
def button_class
|
75
|
+
[CLASS_PREFIX, contextual_class, size_class].compact.join(' ')
|
76
|
+
end
|
77
|
+
|
78
|
+
def contextual_class
|
79
|
+
[CLASS_PREFIX, outline? ? 'outline' : nil, style].compact.join('-')
|
80
|
+
end
|
81
|
+
|
82
|
+
def size_class
|
83
|
+
return unless size?
|
84
|
+
|
85
|
+
[CLASS_PREFIX, SIZES[size]].join('-')
|
86
|
+
end
|
87
|
+
|
88
|
+
def style
|
89
|
+
(@style || DEFAULT_STYLE).to_sym
|
90
|
+
end
|
91
|
+
|
92
|
+
def outline?
|
93
|
+
!!@outline
|
94
|
+
end
|
95
|
+
|
96
|
+
def size?
|
97
|
+
!!size
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bs5
|
4
|
+
class ButtonToComponent < ViewComponent::Base
|
5
|
+
STYLES = %i[primary secondary success danger warning info light dark link].freeze
|
6
|
+
DEFAULT_STYLE = :primary
|
7
|
+
SIZES = { small: :sm, large: :lg }.freeze
|
8
|
+
CLASS_PREFIX = 'btn'
|
9
|
+
|
10
|
+
attr_reader :size
|
11
|
+
|
12
|
+
include ActiveModel::Validations
|
13
|
+
validates :style, style: true
|
14
|
+
validates :size, inclusion: { in: SIZES.keys, valid_sizes: SIZES.keys.to_sentence, allow_nil: true }
|
15
|
+
|
16
|
+
def initialize(name = nil, options = nil, html_options = nil)
|
17
|
+
@name = name
|
18
|
+
@options = options
|
19
|
+
@html_options = html_options
|
20
|
+
|
21
|
+
if @name.is_a? Hash
|
22
|
+
self.button_to_options = @name
|
23
|
+
elsif @options.is_a? Hash
|
24
|
+
self.button_to_options = @options
|
25
|
+
else
|
26
|
+
@html_options ||= {}
|
27
|
+
self.button_to_options = @html_options
|
28
|
+
end
|
29
|
+
|
30
|
+
extract_custom_options
|
31
|
+
merge_default_options
|
32
|
+
end
|
33
|
+
|
34
|
+
def before_render
|
35
|
+
raise errors.full_messages.to_sentence if invalid?
|
36
|
+
end
|
37
|
+
|
38
|
+
def call
|
39
|
+
if content
|
40
|
+
button_to(@name, @options, @html_options) { content }
|
41
|
+
else
|
42
|
+
button_to(@name, @options, @html_options)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def button_to_options=(hash)
|
49
|
+
@button_to_options = hash.symbolize_keys!
|
50
|
+
end
|
51
|
+
|
52
|
+
def extract_custom_options
|
53
|
+
extract_style
|
54
|
+
extract_outline
|
55
|
+
extract_size
|
56
|
+
end
|
57
|
+
|
58
|
+
def extract_style
|
59
|
+
@style = @button_to_options.delete(:style)
|
60
|
+
end
|
61
|
+
|
62
|
+
def extract_outline
|
63
|
+
@outline = @button_to_options.delete(:outline)
|
64
|
+
end
|
65
|
+
|
66
|
+
def extract_size
|
67
|
+
@size = @button_to_options.delete(:size)
|
68
|
+
end
|
69
|
+
|
70
|
+
def merge_default_options
|
71
|
+
@button_to_options.deep_merge!(default_options) do |_key, this_val, other_val|
|
72
|
+
[this_val, other_val].join(' ').strip
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def default_options
|
77
|
+
{ class: button_class }
|
78
|
+
end
|
79
|
+
|
80
|
+
def button_class
|
81
|
+
[CLASS_PREFIX, contextual_class, size_class].compact.join(' ')
|
82
|
+
end
|
83
|
+
|
84
|
+
def contextual_class
|
85
|
+
[CLASS_PREFIX, outline? ? 'outline' : nil, style].compact.join('-')
|
86
|
+
end
|
87
|
+
|
88
|
+
def size_class
|
89
|
+
return unless size?
|
90
|
+
|
91
|
+
[CLASS_PREFIX, SIZES[size]].join('-')
|
92
|
+
end
|
93
|
+
|
94
|
+
def style
|
95
|
+
(@style || DEFAULT_STYLE).to_sym
|
96
|
+
end
|
97
|
+
|
98
|
+
def outline?
|
99
|
+
!!@outline
|
100
|
+
end
|
101
|
+
|
102
|
+
def size?
|
103
|
+
!!size
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -2,24 +2,21 @@
|
|
2
2
|
|
3
3
|
module Bs5
|
4
4
|
module ComponentsHelper
|
5
|
-
|
6
|
-
render AccordionComponent.new(*args) do |accordion|
|
7
|
-
yield accordion if block_given?
|
8
|
-
end
|
9
|
-
end
|
5
|
+
COMPONENTS = %w[accordion alert badge close_button breadcrumb button_tag button_to].freeze
|
10
6
|
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
COMPONENTS.each do |name|
|
8
|
+
define_method("bs5_#{name}") do |*args, &block|
|
9
|
+
clazz = "Bs5::#{name.classify}Component".constantize
|
10
|
+
render_component(clazz, *args, &block)
|
14
11
|
end
|
15
12
|
end
|
16
13
|
|
17
|
-
|
18
|
-
render BadgeComponent.new(*args)
|
19
|
-
end
|
14
|
+
private
|
20
15
|
|
21
|
-
def
|
22
|
-
render
|
16
|
+
def render_component(component_clazz, *args)
|
17
|
+
render component_clazz.new(*args) do |c|
|
18
|
+
yield c if block_given?
|
19
|
+
end
|
23
20
|
end
|
24
21
|
end
|
25
22
|
end
|
@@ -1,11 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class StyleValidator < ActiveModel::EachValidator
|
4
|
-
STYLES = %i[primary secondary success danger warning info light dark].freeze
|
5
|
-
|
6
4
|
def validate_each(record, attribute, value)
|
7
|
-
return if value.in?(STYLES)
|
5
|
+
return if value.in?(valid_styles = record.class::STYLES)
|
8
6
|
|
9
|
-
record.errors.add(attribute, :inclusion, valid_styles:
|
7
|
+
record.errors.add(attribute, :inclusion, valid_styles: valid_styles.to_sentence)
|
10
8
|
end
|
11
9
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<h2>Buttons</h2>
|
2
|
+
<h3>Decorating Rails' <code>button_tag</code></h3>
|
3
|
+
<%= render 'bs5/examples/buttons/button_tag/default/example' %>
|
4
|
+
<%= render 'bs5/examples/buttons/button_tag/style/example' %>
|
5
|
+
<%= render 'bs5/examples/buttons/button_tag/outline/example' %>
|
6
|
+
<%= render 'bs5/examples/buttons/button_tag/size/example' %>
|
7
|
+
<%= render 'bs5/examples/buttons/button_tag/block_buttons/example' %>
|
8
|
+
<%= render 'bs5/examples/buttons/button_tag/toggle_states/example' %>
|
9
|
+
|
10
|
+
<h3>Decorating Rails' <code>button_to</code></h3>
|
11
|
+
<%= render 'bs5/examples/buttons/button_to/default/example' %>
|
@@ -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 %>
|
@@ -1,2 +1,2 @@
|
|
1
|
-
<h3>
|
1
|
+
<h3>Dismissing</h3>
|
2
2
|
<%= bs5_example(snippet: 'alert/dismissable/snippet') %>
|
@@ -1,3 +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
|
+
|
1
13
|
<%= bs5_alert(style: :danger) do %>
|
2
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!
|
3
31
|
<%- end %>
|
@@ -1,2 +1,2 @@
|
|
1
|
-
<h3>
|
1
|
+
<h3>Example</h3>
|
2
2
|
<%= bs5_example(snippet: 'badge/default/snippet') %>
|
@@ -1 +1,6 @@
|
|
1
|
-
<%= bs5_badge(text: 'New')
|
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>
|
@@ -1,2 +1,2 @@
|
|
1
|
-
<h3>Pill</h3>
|
1
|
+
<h3>Pill badges</h3>
|
2
2
|
<%= bs5_example(snippet: 'badge/pill/snippet') %>
|
@@ -1 +1,8 @@
|
|
1
|
-
<%= bs5_badge(text: '
|
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) %>
|
@@ -1,2 +1,2 @@
|
|
1
|
-
<h3>
|
1
|
+
<h3>Background colors</h3>
|
2
2
|
<%= bs5_example(snippet: 'badge/style/snippet') %>
|
@@ -1 +1,8 @@
|
|
1
|
-
<%= bs5_badge(text: '
|
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,5 @@
|
|
1
|
+
<h3>Block buttons</h3>
|
2
|
+
<%= bs5_example(snippet: 'buttons/button_tag/block_buttons/block_buttons') %>
|
3
|
+
<%= bs5_example(snippet: 'buttons/button_tag/block_buttons/responsive_block_buttons_1') %>
|
4
|
+
<%= bs5_example(snippet: 'buttons/button_tag/block_buttons/responsive_block_buttons_2') %>
|
5
|
+
<%= bs5_example(snippet: 'buttons/button_tag/block_buttons/responsive_block_buttons_3') %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<%= bs5_button_tag %>
|
2
|
+
|
3
|
+
<%= bs5_button_tag 'Reset', type: 'reset' %>
|
4
|
+
|
5
|
+
<%= bs5_button_tag 'Button', type: 'button' %>
|
6
|
+
|
7
|
+
<%= bs5_button_tag 'Reset', type: 'reset', disabled: true %>
|
8
|
+
|
9
|
+
<%= bs5_button_tag(type: 'button') do %>
|
10
|
+
<%= content_tag(:strong, 'Ask me!') %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= bs5_button_tag 'Save', data: { confirm: 'Are you sure?' } %>
|
14
|
+
|
15
|
+
<%= bs5_button_tag 'Checkout', data: { disable_with: 'Please wait...' } %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= bs5_button_tag 'Primary', style: :primary, outline: true %>
|
2
|
+
|
3
|
+
<%= bs5_button_tag 'Secondary', style: :secondary, outline: true %>
|
4
|
+
|
5
|
+
<%= bs5_button_tag 'Success', style: :success, outline: true %>
|
6
|
+
|
7
|
+
<%= bs5_button_tag 'Danger', style: :danger, outline: true %>
|
8
|
+
|
9
|
+
<%= bs5_button_tag(style: :warning, outline: true, type: 'button') do %>
|
10
|
+
<%= content_tag(:strong, 'Warning') %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= bs5_button_tag 'Info', style: :info, outline: true %>
|
14
|
+
|
15
|
+
<%= bs5_button_tag 'Light', style: :light, outline: true %>
|
16
|
+
|
17
|
+
<%= bs5_button_tag 'Dark', style: :dark, outline: true %>
|
18
|
+
|
19
|
+
<%= bs5_button_tag 'Link', style: :link, outline: true %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= bs5_button_tag 'Primary', style: :primary %>
|
2
|
+
|
3
|
+
<%= bs5_button_tag 'Secondary', style: :secondary %>
|
4
|
+
|
5
|
+
<%= bs5_button_tag 'Success', style: :success %>
|
6
|
+
|
7
|
+
<%= bs5_button_tag 'Danger', style: :danger %>
|
8
|
+
|
9
|
+
<%= bs5_button_tag(style: :warning, type: 'button') do %>
|
10
|
+
<%= content_tag(:strong, 'Warning') %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= bs5_button_tag 'Info', style: :info %>
|
14
|
+
|
15
|
+
<%= bs5_button_tag 'Light', style: :light %>
|
16
|
+
|
17
|
+
<%= bs5_button_tag 'Dark', style: :dark %>
|
18
|
+
|
19
|
+
<%= bs5_button_tag 'Link', style: :link %>
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<%= bs5_button_tag('Toggle button', data: { toggle: 'button' }, autocomplete: 'off') %>
|
2
|
+
<%= bs5_button_tag('Active toggle button', class: 'active', data: { toggle: 'button' }, autocomplete: 'off', aria: { pressed: true }) %>
|
3
|
+
<%= bs5_button_tag('Disabled toggle button', data: { toggle: 'button' }, autocomplete: 'off', disabled: true) %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div class="d-grid gap-2 d-md-flex">
|
2
|
+
<%= bs5_button_to('New', 'http://www.example.com') %>
|
3
|
+
|
4
|
+
<%= bs5_button_to('http://www.example.com', style: :success) do %>
|
5
|
+
Make happy <strong>John Doe</strong>
|
6
|
+
<%- end %>
|
7
|
+
|
8
|
+
<%= bs5_button_to('New', 'http://www.example.com', style: :dark, outline: true, size: :large, form_class: 'new-thing') %>
|
9
|
+
|
10
|
+
<%= bs5_button_to('Destroy', 'http://www.example.com', style: :danger, method: "delete", remote: true, data: { confirm: 'Are you sure?', disable_with: 'loading...' }) %>
|
11
|
+
</div>
|
@@ -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) %>
|
@@ -1,4 +1,23 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
|
4
|
-
|
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
|
+
<li>Buttons</li>
|
11
|
+
</ul>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
<div class="col-10">
|
15
|
+
<h1>Bootstrap Examples</h1>
|
16
|
+
<%= render 'accordion' %>
|
17
|
+
<%= render 'alert' %>
|
18
|
+
<%= render 'badge' %>
|
19
|
+
<%= render 'close_button' %>
|
20
|
+
<%= render 'breadcrumb' %>
|
21
|
+
<%= render 'buttons' %>
|
22
|
+
</div>
|
23
|
+
</div>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# The following comments fill some of the gaps in Solargraph's understanding of
|
2
|
+
# Rails apps. Since they're all in YARD, they get mapped in Solargraph but
|
3
|
+
# ignored at runtime.
|
4
|
+
#
|
5
|
+
# You can put this file anywhere in the project, as long as it gets included in
|
6
|
+
# the workspace maps. It's recommended that you keep it in a standalone file
|
7
|
+
# instead of pasting it into an existing one.
|
8
|
+
#
|
9
|
+
# @!parse
|
10
|
+
# class ActionController::Base
|
11
|
+
# include ActionController::MimeResponds
|
12
|
+
# extend ActiveSupport::Callbacks::ClassMethods
|
13
|
+
# extend AbstractController::Callbacks::ClassMethods
|
14
|
+
# end
|
15
|
+
# class ActiveRecord::Base
|
16
|
+
# extend ActiveRecord::QueryMethods
|
17
|
+
# extend ActiveRecord::FinderMethods
|
18
|
+
# extend ActiveRecord::Associations::ClassMethods
|
19
|
+
# extend ActiveRecord::Inheritance::ClassMethods
|
20
|
+
# include ActiveRecord::Persistence
|
21
|
+
# end
|
22
|
+
# @!override ActiveRecord::FinderMethods#find
|
23
|
+
# @overload find(id)
|
24
|
+
# @param id [Integer]
|
25
|
+
# @return [self]
|
26
|
+
# @overload find(list)
|
27
|
+
# @param list [Array]
|
28
|
+
# @return [Array<self>]
|
29
|
+
# @overload find(*args)
|
30
|
+
# @return [Array<self>]
|
31
|
+
# @return [self, Array<self>]
|
data/config/locales/en.yml
CHANGED
@@ -6,3 +6,15 @@ en:
|
|
6
6
|
attributes:
|
7
7
|
style:
|
8
8
|
inclusion: "is not included in the list: %{valid_styles}."
|
9
|
+
bs5/button_tag_component:
|
10
|
+
attributes:
|
11
|
+
style:
|
12
|
+
inclusion: "is not included in the list: %{valid_styles}."
|
13
|
+
size:
|
14
|
+
inclusion: "is not included in the list: %{valid_sizes}."
|
15
|
+
bs5/button_to_component:
|
16
|
+
attributes:
|
17
|
+
style:
|
18
|
+
inclusion: "is not included in the list: %{valid_styles}."
|
19
|
+
size:
|
20
|
+
inclusion: "is not included in the list: %{valid_sizes}."
|
data/lib/bs5/version.rb
CHANGED
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.11
|
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-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -132,6 +132,10 @@ files:
|
|
132
132
|
- app/components/bs5/alert_component.rb
|
133
133
|
- app/components/bs5/badge_component.html.erb
|
134
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/button_tag_component.rb
|
138
|
+
- app/components/bs5/button_to_component.rb
|
135
139
|
- app/components/bs5/close_button_component.html.erb
|
136
140
|
- app/components/bs5/close_button_component.rb
|
137
141
|
- app/components/bs5/example_component.html.erb
|
@@ -141,17 +145,20 @@ files:
|
|
141
145
|
- app/helpers/bs5/application_helper.rb
|
142
146
|
- app/helpers/bs5/components_helper.rb
|
143
147
|
- app/helpers/bs5/examples_helper.rb
|
144
|
-
- app/jobs/bs5/application_job.rb
|
145
|
-
- app/mailers/bs5/application_mailer.rb
|
146
148
|
- app/models/bs5/application_record.rb
|
147
149
|
- app/validators/style_validator.rb
|
148
150
|
- app/views/bs5/examples/_accordion.html.erb
|
149
151
|
- app/views/bs5/examples/_alert.html.erb
|
150
152
|
- app/views/bs5/examples/_badge.html.erb
|
153
|
+
- app/views/bs5/examples/_breadcrumb.html.erb
|
154
|
+
- app/views/bs5/examples/_buttons.html.erb
|
155
|
+
- app/views/bs5/examples/_close_button.html.erb
|
151
156
|
- app/views/bs5/examples/accordion/default/_example.html.erb
|
152
157
|
- app/views/bs5/examples/accordion/default/snippet.html.erb
|
153
158
|
- app/views/bs5/examples/accordion/flush/_example.html.erb
|
154
159
|
- app/views/bs5/examples/accordion/flush/snippet.html.erb
|
160
|
+
- app/views/bs5/examples/alert/additional_content/_example.html.erb
|
161
|
+
- app/views/bs5/examples/alert/additional_content/snippet.html.erb
|
155
162
|
- app/views/bs5/examples/alert/default/_example.html.erb
|
156
163
|
- app/views/bs5/examples/alert/default/snippet.html.erb
|
157
164
|
- app/views/bs5/examples/alert/dismissable/_example.html.erb
|
@@ -164,8 +171,35 @@ files:
|
|
164
171
|
- app/views/bs5/examples/badge/pill/snippet.html.erb
|
165
172
|
- app/views/bs5/examples/badge/style/_example.html.erb
|
166
173
|
- app/views/bs5/examples/badge/style/snippet.html.erb
|
174
|
+
- app/views/bs5/examples/breadcrumb/default/_example.html.erb
|
175
|
+
- app/views/bs5/examples/breadcrumb/default/snippet.html.erb
|
176
|
+
- app/views/bs5/examples/buttons/button_tag/block_buttons/_example.html.erb
|
177
|
+
- app/views/bs5/examples/buttons/button_tag/block_buttons/block_buttons.html.erb
|
178
|
+
- app/views/bs5/examples/buttons/button_tag/block_buttons/responsive_block_buttons_1.html.erb
|
179
|
+
- app/views/bs5/examples/buttons/button_tag/block_buttons/responsive_block_buttons_2.html.erb
|
180
|
+
- app/views/bs5/examples/buttons/button_tag/block_buttons/responsive_block_buttons_3.html.erb
|
181
|
+
- app/views/bs5/examples/buttons/button_tag/default/_example.html.erb
|
182
|
+
- app/views/bs5/examples/buttons/button_tag/default/snippet.html.erb
|
183
|
+
- app/views/bs5/examples/buttons/button_tag/outline/_example.html.erb
|
184
|
+
- app/views/bs5/examples/buttons/button_tag/outline/snippet.html.erb
|
185
|
+
- app/views/bs5/examples/buttons/button_tag/size/_example.html.erb
|
186
|
+
- app/views/bs5/examples/buttons/button_tag/size/large.html.erb
|
187
|
+
- app/views/bs5/examples/buttons/button_tag/size/small.html.erb
|
188
|
+
- app/views/bs5/examples/buttons/button_tag/style/_example.html.erb
|
189
|
+
- app/views/bs5/examples/buttons/button_tag/style/snippet.html.erb
|
190
|
+
- app/views/bs5/examples/buttons/button_tag/toggle_states/_example.html.erb
|
191
|
+
- app/views/bs5/examples/buttons/button_tag/toggle_states/snippet.html.erb
|
192
|
+
- app/views/bs5/examples/buttons/button_to/default/_example.html.erb
|
193
|
+
- app/views/bs5/examples/buttons/button_to/default/snippet.html.erb
|
194
|
+
- app/views/bs5/examples/close_button/default/_example.html.erb
|
195
|
+
- app/views/bs5/examples/close_button/default/snippet.html.erb
|
196
|
+
- app/views/bs5/examples/close_button/disabled/_example.html.erb
|
197
|
+
- app/views/bs5/examples/close_button/disabled/snippet.html.erb
|
198
|
+
- app/views/bs5/examples/close_button/white/_example.html.erb
|
199
|
+
- app/views/bs5/examples/close_button/white/snippet.html.erb
|
167
200
|
- app/views/bs5/examples/index.html.erb
|
168
201
|
- app/views/layouts/bs5/application.html.erb
|
202
|
+
- config/definitions.rb
|
169
203
|
- config/locales/en.yml
|
170
204
|
- config/routes.rb
|
171
205
|
- lib/bs5.rb
|