effective_bootstrap 0.13.0 → 0.13.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/effective_bootstrap/forms.scss +26 -0
- data/app/helpers/effective_bootstrap_helper.rb +12 -9
- data/app/models/effective/form_inputs/collection_input.rb +2 -0
- data/lib/effective_bootstrap/version.rb +1 -1
- data/lib/effective_bootstrap.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecffafbb096f543759ef66fd919f85dbf96acebd446ba522b4427c831b7b5b55
|
4
|
+
data.tar.gz: 9793e72a94792bed35abec120c8346d9c11f170e0323aa06aff49f75650d6d7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7394dc15b00b1e4bc79cd4bdffb220fa093b034dd0dc67beea558e4ae87b6e61c4d5fb37c3c9b9e4934811b0bd420c6e0da427445009b33f881d86b5097c79f0
|
7
|
+
data.tar.gz: ec4c87b103ebd7f621e6304948daeaa3adcf6078b9df9e71c6da1fba9593c98a6a97b882b3602e8b04cef5859d19d64b33d634c34107d18daed61417e0ed6c74
|
@@ -70,3 +70,29 @@ div.form-group > label + .btn-group { display: block; }
|
|
70
70
|
|
71
71
|
// File Control
|
72
72
|
.form-control-file { border: none !important; }
|
73
|
+
|
74
|
+
// Radios
|
75
|
+
form fieldset.effective-radios {
|
76
|
+
margin-top: 0;
|
77
|
+
margin-bottom: 0;
|
78
|
+
}
|
79
|
+
|
80
|
+
form fieldset.effective-checks {
|
81
|
+
margin-top: 0;
|
82
|
+
margin-bottom: 0;
|
83
|
+
}
|
84
|
+
|
85
|
+
form fieldset.effective-radios legend {
|
86
|
+
font-size: 1rem;
|
87
|
+
font-weight: inherit;
|
88
|
+
margin-top: 0.5rem;
|
89
|
+
margin-bottom: 1rem;
|
90
|
+
}
|
91
|
+
|
92
|
+
// Checks
|
93
|
+
form fieldset.effective-checks > label {
|
94
|
+
font-size: 1rem;
|
95
|
+
font-weight: inherit;
|
96
|
+
margin-top: 0.5rem;
|
97
|
+
margin-bottom: 1rem;
|
98
|
+
}
|
@@ -64,15 +64,17 @@ module EffectiveBootstrapHelper
|
|
64
64
|
# = card('title do')
|
65
65
|
# %p Stuff
|
66
66
|
# = card('Stuff', header: 'header title')
|
67
|
-
def card(
|
67
|
+
def card(resource = nil, opts = {}, &block)
|
68
68
|
raise('expected a block') unless block_given?
|
69
69
|
|
70
|
-
if
|
71
|
-
opts =
|
70
|
+
if resource.kind_of?(Hash)
|
71
|
+
opts = resource; resource = nil
|
72
72
|
end
|
73
73
|
|
74
|
+
return if resource.kind_of?(Class) && !EffectiveResources.authorized?(self, :index, resource)
|
75
|
+
|
74
76
|
header = opts.delete(:header)
|
75
|
-
title = opts.delete(:title) || effective_bootstrap_human_name(
|
77
|
+
title = opts.delete(:title) || opts.delete(:label) || effective_bootstrap_human_name(resource, plural: (opts.key?(:plural) ? opts.delete(:plural) : true))
|
76
78
|
|
77
79
|
content_tag(:div, merge_class_key(opts, 'card mb-4')) do
|
78
80
|
header = content_tag(:div, header, class: 'card-header') if header.present?
|
@@ -316,7 +318,7 @@ module EffectiveBootstrapHelper
|
|
316
318
|
def nav_link_to(resource, path, opts = {})
|
317
319
|
return if resource.kind_of?(Class) && !EffectiveResources.authorized?(self, :index, resource)
|
318
320
|
|
319
|
-
label = opts.delete(:label) || effective_bootstrap_human_name(resource, plural: true, prefer_model_name: true)
|
321
|
+
label = opts.delete(:label) || effective_bootstrap_human_name(resource, plural: (opts.key?(:plural) ? opts.delete(:plural) : true), prefer_model_name: true)
|
320
322
|
|
321
323
|
if @_nav_mode == :dropdown # We insert dropdown-items
|
322
324
|
return link_to(label, path, merge_class_key(opts, 'dropdown-item'))
|
@@ -596,12 +598,13 @@ module EffectiveBootstrapHelper
|
|
596
598
|
|
597
599
|
NUMBERS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
598
600
|
|
599
|
-
def tab(
|
600
|
-
|
601
|
+
def tab(resource, opts = {}, &block)
|
602
|
+
return if resource.kind_of?(Class) && !EffectiveResources.authorized?(self, :index, resource)
|
603
|
+
label = opts.delete(:label) || effective_bootstrap_human_name(resource, plural: (opts.key?(:plural) ? opts.delete(:plural) : true), prefer_model_name: true)
|
601
604
|
|
602
605
|
(@_tab_labels.push(label) and return) if @_tab_mode == :validate
|
603
606
|
|
604
|
-
controls =
|
607
|
+
controls = opts.delete(:controls) || label.to_s.parameterize.gsub('_', '-')
|
605
608
|
controls = "item-#{controls}" if NUMBERS.include?(controls[0]) # Can't start with a number
|
606
609
|
controls = controls[1..-1] if controls[0] == '#'
|
607
610
|
controls = "#{controls}-#{@_tab_unique}" if @_tab_unique
|
@@ -617,7 +620,7 @@ module EffectiveBootstrapHelper
|
|
617
620
|
content_tag(:a, label, id: ('tab-' + controls), class: ['nav-link', ('active' if active)].compact.join(' '), href: '#' + controls, 'aria-controls': controls, 'aria-selected': active.to_s, 'data-toggle': 'tab', role: 'tab')
|
618
621
|
end
|
619
622
|
else # Inserting the content into the tab itself
|
620
|
-
classes = ['tab-pane', 'fade', ('show active' if active),
|
623
|
+
classes = ['tab-pane', 'fade', ('show active' if active), opts[:class].presence].compact.join(' ')
|
621
624
|
content_tag(:div, id: controls, class: classes, role: 'tabpanel', 'aria-labelledby': ('tab-' + controls), 'data-tab-label': label) do
|
622
625
|
yield
|
623
626
|
end
|
@@ -96,6 +96,8 @@ module Effective
|
|
96
96
|
collection.inject({}) { |h, (k, group)| h[k] = translate(group).map { |obj| [obj.to_s, "#{obj.class.model_name}_#{obj.id}"] }; h }
|
97
97
|
elsif grouped
|
98
98
|
collection.inject({}) { |h, (k, group)| h[k] = translate(group).map { |obj| obj }; h }
|
99
|
+
elsif (collection == :boolean || collection == :booleans || collection == :boolean_collection)
|
100
|
+
EffectiveBootstrap.boolean_collection
|
99
101
|
else
|
100
102
|
translate(collection).map { |obj| obj }
|
101
103
|
end
|
data/lib/effective_bootstrap.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|