ui_bibz 2.1.5 → 2.1.6
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/Gemfile.lock +49 -49
- data/app/assets/javascripts/interface.coffee +1 -1
- data/app/assets/stylesheets/forms.sass +5 -0
- data/lib/ui_bibz/infos.rb +1 -1
- data/lib/ui_bibz/inputs/ui_bibz_inputs/base_input.rb +4 -1
- data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_checkbox_field_input.rb +22 -0
- data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_text_field_input.rb +0 -3
- data/lib/ui_bibz/ui/core/component.rb +3 -0
- data/lib/ui_bibz/ui/core/forms/buttons/button_group.rb +6 -0
- data/lib/ui_bibz/ui/core/forms/buttons/components/button_group_split_dropdown.rb +72 -0
- data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +3 -2
- data/lib/ui_bibz/ui/core/forms/dropdowns/dropdown.rb +14 -9
- data/lib/ui_bibz/ui/core/forms/dropdowns/split_dropdown.rb +0 -4
- data/lib/ui_bibz/ui/core/forms/textareas/markdown_editor_field.rb +1 -1
- data/lib/ui_bibz/ui/core/navigations/components/nav_dropdown.rb +1 -1
- data/lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb +4 -3
- data/lib/ui_bibz/ui/extensions/core/component/popover_extension.rb +18 -0
- data/lib/ui_bibz/utils/glyph_changer.rb +4 -2
- data/test/simple_form_test.rb +1 -1
- data/test/ui/core/forms/buttons/button_group_test.rb +1 -1
- data/test/ui/core/forms/choices/checkbox_field_test.rb +1 -1
- data/test/ui/core/forms/dropdowns/dropdown_test.rb +5 -5
- data/test/ui/core/forms/surrounds/surround_field_test.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dc93e1f6e25ab337d80b307a374924508f9d667b08b0d030aaad4b89a448993e
|
|
4
|
+
data.tar.gz: 05cc31f7e7d1caaf78416377e5469bda4d0481a32983cfdc747d04d9c83675e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: effedc75df8ae266ef0dacd1eb510f60a3503792625e9b21078da481d7a0a31b41fcca0fabbea80e71c1d05dedba83970c93d35fe40d38612d571cca9b484858
|
|
7
|
+
data.tar.gz: 5086e9fc5aec716e4e710e37ce25fa201712c2d86631156e97319d9e20ae8ec3afb6453d1c61b7dbf14895c207973be5a216a085a948eab71ab57215b0ca6fe9
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
ui_bibz (2.1.
|
|
4
|
+
ui_bibz (2.1.6)
|
|
5
5
|
bootstrap (= 4.1.3)
|
|
6
6
|
haml
|
|
7
7
|
haml-rails
|
|
@@ -15,49 +15,49 @@ PATH
|
|
|
15
15
|
GEM
|
|
16
16
|
remote: https://rubygems.org/
|
|
17
17
|
specs:
|
|
18
|
-
actioncable (5.2.
|
|
19
|
-
actionpack (= 5.2.
|
|
18
|
+
actioncable (5.2.2)
|
|
19
|
+
actionpack (= 5.2.2)
|
|
20
20
|
nio4r (~> 2.0)
|
|
21
21
|
websocket-driver (>= 0.6.1)
|
|
22
|
-
actionmailer (5.2.
|
|
23
|
-
actionpack (= 5.2.
|
|
24
|
-
actionview (= 5.2.
|
|
25
|
-
activejob (= 5.2.
|
|
22
|
+
actionmailer (5.2.2)
|
|
23
|
+
actionpack (= 5.2.2)
|
|
24
|
+
actionview (= 5.2.2)
|
|
25
|
+
activejob (= 5.2.2)
|
|
26
26
|
mail (~> 2.5, >= 2.5.4)
|
|
27
27
|
rails-dom-testing (~> 2.0)
|
|
28
|
-
actionpack (5.2.
|
|
29
|
-
actionview (= 5.2.
|
|
30
|
-
activesupport (= 5.2.
|
|
28
|
+
actionpack (5.2.2)
|
|
29
|
+
actionview (= 5.2.2)
|
|
30
|
+
activesupport (= 5.2.2)
|
|
31
31
|
rack (~> 2.0)
|
|
32
32
|
rack-test (>= 0.6.3)
|
|
33
33
|
rails-dom-testing (~> 2.0)
|
|
34
34
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
35
|
-
actionview (5.2.
|
|
36
|
-
activesupport (= 5.2.
|
|
35
|
+
actionview (5.2.2)
|
|
36
|
+
activesupport (= 5.2.2)
|
|
37
37
|
builder (~> 3.1)
|
|
38
38
|
erubi (~> 1.4)
|
|
39
39
|
rails-dom-testing (~> 2.0)
|
|
40
40
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
41
|
-
activejob (5.2.
|
|
42
|
-
activesupport (= 5.2.
|
|
41
|
+
activejob (5.2.2)
|
|
42
|
+
activesupport (= 5.2.2)
|
|
43
43
|
globalid (>= 0.3.6)
|
|
44
|
-
activemodel (5.2.
|
|
45
|
-
activesupport (= 5.2.
|
|
46
|
-
activerecord (5.2.
|
|
47
|
-
activemodel (= 5.2.
|
|
48
|
-
activesupport (= 5.2.
|
|
44
|
+
activemodel (5.2.2)
|
|
45
|
+
activesupport (= 5.2.2)
|
|
46
|
+
activerecord (5.2.2)
|
|
47
|
+
activemodel (= 5.2.2)
|
|
48
|
+
activesupport (= 5.2.2)
|
|
49
49
|
arel (>= 9.0)
|
|
50
|
-
activestorage (5.2.
|
|
51
|
-
actionpack (= 5.2.
|
|
52
|
-
activerecord (= 5.2.
|
|
50
|
+
activestorage (5.2.2)
|
|
51
|
+
actionpack (= 5.2.2)
|
|
52
|
+
activerecord (= 5.2.2)
|
|
53
53
|
marcel (~> 0.3.1)
|
|
54
|
-
activesupport (5.2.
|
|
54
|
+
activesupport (5.2.2)
|
|
55
55
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
56
56
|
i18n (>= 0.7, < 2)
|
|
57
57
|
minitest (~> 5.1)
|
|
58
58
|
tzinfo (~> 1.1)
|
|
59
59
|
arel (9.0.0)
|
|
60
|
-
autoprefixer-rails (9.3
|
|
60
|
+
autoprefixer-rails (9.4.3)
|
|
61
61
|
execjs
|
|
62
62
|
awesome_print (1.8.0)
|
|
63
63
|
bootstrap (4.1.3)
|
|
@@ -68,10 +68,10 @@ GEM
|
|
|
68
68
|
byebug (10.0.2)
|
|
69
69
|
codeclimate-test-reporter (1.0.7)
|
|
70
70
|
simplecov
|
|
71
|
-
concurrent-ruby (1.1.
|
|
71
|
+
concurrent-ruby (1.1.4)
|
|
72
72
|
crass (1.0.4)
|
|
73
73
|
docile (1.3.1)
|
|
74
|
-
erubi (1.
|
|
74
|
+
erubi (1.8.0)
|
|
75
75
|
erubis (2.7.0)
|
|
76
76
|
execjs (2.7.0)
|
|
77
77
|
factory_bot (4.11.1)
|
|
@@ -96,7 +96,7 @@ GEM
|
|
|
96
96
|
haml (>= 4.0, < 6)
|
|
97
97
|
nokogiri (>= 1.6.0)
|
|
98
98
|
ruby_parser (~> 3.5)
|
|
99
|
-
i18n (1.
|
|
99
|
+
i18n (1.3.0)
|
|
100
100
|
concurrent-ruby (~> 1.0)
|
|
101
101
|
jquery-rails (4.3.3)
|
|
102
102
|
rails-dom-testing (>= 1, < 3)
|
|
@@ -111,46 +111,46 @@ GEM
|
|
|
111
111
|
marcel (0.3.3)
|
|
112
112
|
mimemagic (~> 0.3.2)
|
|
113
113
|
method_source (0.9.2)
|
|
114
|
-
mimemagic (0.3.
|
|
114
|
+
mimemagic (0.3.3)
|
|
115
115
|
mini_mime (1.0.1)
|
|
116
|
-
mini_portile2 (2.
|
|
116
|
+
mini_portile2 (2.4.0)
|
|
117
117
|
minitest (5.11.3)
|
|
118
118
|
nio4r (2.3.1)
|
|
119
|
-
nokogiri (1.
|
|
120
|
-
mini_portile2 (~> 2.
|
|
119
|
+
nokogiri (1.9.1)
|
|
120
|
+
mini_portile2 (~> 2.4.0)
|
|
121
121
|
popper_js (1.14.5)
|
|
122
122
|
rack (2.0.6)
|
|
123
123
|
rack-test (1.1.0)
|
|
124
124
|
rack (>= 1.0, < 3)
|
|
125
|
-
rails (5.2.
|
|
126
|
-
actioncable (= 5.2.
|
|
127
|
-
actionmailer (= 5.2.
|
|
128
|
-
actionpack (= 5.2.
|
|
129
|
-
actionview (= 5.2.
|
|
130
|
-
activejob (= 5.2.
|
|
131
|
-
activemodel (= 5.2.
|
|
132
|
-
activerecord (= 5.2.
|
|
133
|
-
activestorage (= 5.2.
|
|
134
|
-
activesupport (= 5.2.
|
|
125
|
+
rails (5.2.2)
|
|
126
|
+
actioncable (= 5.2.2)
|
|
127
|
+
actionmailer (= 5.2.2)
|
|
128
|
+
actionpack (= 5.2.2)
|
|
129
|
+
actionview (= 5.2.2)
|
|
130
|
+
activejob (= 5.2.2)
|
|
131
|
+
activemodel (= 5.2.2)
|
|
132
|
+
activerecord (= 5.2.2)
|
|
133
|
+
activestorage (= 5.2.2)
|
|
134
|
+
activesupport (= 5.2.2)
|
|
135
135
|
bundler (>= 1.3.0)
|
|
136
|
-
railties (= 5.2.
|
|
136
|
+
railties (= 5.2.2)
|
|
137
137
|
sprockets-rails (>= 2.0.0)
|
|
138
138
|
rails-dom-testing (2.0.3)
|
|
139
139
|
activesupport (>= 4.2.0)
|
|
140
140
|
nokogiri (>= 1.6)
|
|
141
141
|
rails-html-sanitizer (1.0.4)
|
|
142
142
|
loofah (~> 2.2, >= 2.2.2)
|
|
143
|
-
railties (5.2.
|
|
144
|
-
actionpack (= 5.2.
|
|
145
|
-
activesupport (= 5.2.
|
|
143
|
+
railties (5.2.2)
|
|
144
|
+
actionpack (= 5.2.2)
|
|
145
|
+
activesupport (= 5.2.2)
|
|
146
146
|
method_source
|
|
147
147
|
rake (>= 0.8.7)
|
|
148
148
|
thor (>= 0.19.0, < 2.0)
|
|
149
|
-
rake (12.3.
|
|
149
|
+
rake (12.3.2)
|
|
150
150
|
rb-fsevent (0.10.3)
|
|
151
|
-
rb-inotify (0.
|
|
152
|
-
ffi (
|
|
153
|
-
ruby_parser (3.
|
|
151
|
+
rb-inotify (0.10.0)
|
|
152
|
+
ffi (~> 1.0)
|
|
153
|
+
ruby_parser (3.12.0)
|
|
154
154
|
sexp_processor (~> 4.9)
|
|
155
155
|
sass (3.7.2)
|
|
156
156
|
sass-listen (~> 4.0.0)
|
data/lib/ui_bibz/infos.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module UiBibz
|
|
2
2
|
NAME = "Ui Bibz"
|
|
3
|
-
VERSION = "2.1.
|
|
3
|
+
VERSION = "2.1.6"
|
|
4
4
|
DESCRIPTION = "A Rails Interface Framework using Bootstrap."
|
|
5
5
|
SUMMARY = "Create your project with Ui Bibz. Over a thirty reusable components built to provide iconography, dropdowns, input groups, navigation, alerts, and much more."
|
|
6
6
|
LICENSE = "MIT"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
module UiBibzInputs
|
|
2
2
|
class BaseInput < SimpleForm::Inputs::Base
|
|
3
|
+
include ActionView::Helpers::FormTagHelper
|
|
3
4
|
|
|
4
5
|
def input(wrapper_options)
|
|
5
6
|
super
|
|
@@ -12,7 +13,9 @@ module UiBibzInputs
|
|
|
12
13
|
private
|
|
13
14
|
|
|
14
15
|
def input_attribute_name
|
|
15
|
-
"#{ @builder.
|
|
16
|
+
new_attribute_name = "#{ @builder.lookup_model_names.first }"
|
|
17
|
+
new_attribute_name += "[#{ @builder.lookup_model_names.second }_attributes]" if @builder.lookup_model_names.second
|
|
18
|
+
new_attribute_name += "[#{ attribute_name }]"
|
|
16
19
|
end
|
|
17
20
|
|
|
18
21
|
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module UiBibzInputs
|
|
2
|
+
class UiCheckboxFieldInput < BaseInput
|
|
3
|
+
include UiBibz::Ui::Core::Forms::Choices
|
|
4
|
+
|
|
5
|
+
def input(wrapper_options)
|
|
6
|
+
UiBibz::Ui::Core::Forms::Choices::CheckboxField.new(input_attribute_name, new_options, new_input_html_options).render
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def new_input_html_options
|
|
10
|
+
input_html_options.merge({ checked: value.nil? ? false : value })
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def value
|
|
14
|
+
@value ||= @builder.object.send(attribute_name)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def new_options
|
|
18
|
+
options.merge({ label: attribute_name.to_s.titleize })
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require 'haml'
|
|
2
2
|
require 'ui_bibz/ui/extensions/core/component/klass_extension'
|
|
3
3
|
require 'ui_bibz/ui/extensions/core/component/glyph_extension'
|
|
4
|
+
require 'ui_bibz/ui/extensions/core/component/popover_extension'
|
|
4
5
|
module UiBibz::Ui::Core
|
|
5
6
|
|
|
6
7
|
# Creates a component of the given +name+ using options created by the set of +options+.
|
|
@@ -41,6 +42,7 @@ module UiBibz::Ui::Core
|
|
|
41
42
|
class Component < UiBibz::Ui::Base
|
|
42
43
|
include KlassExtension
|
|
43
44
|
include GlyphExtension
|
|
45
|
+
include PopoverExtension
|
|
44
46
|
|
|
45
47
|
# Constants
|
|
46
48
|
STATUSES = %i(primary secondary success danger warning info light dark)
|
|
@@ -156,6 +158,7 @@ module UiBibz::Ui::Core
|
|
|
156
158
|
|
|
157
159
|
def initialize_component_html_data
|
|
158
160
|
component_html_data
|
|
161
|
+
popover_data_html
|
|
159
162
|
end
|
|
160
163
|
|
|
161
164
|
def initialize_component_html_options
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'ui_bibz/ui/core/forms/buttons/components/button_group_dropdown'
|
|
2
|
+
require 'ui_bibz/ui/core/forms/buttons/components/button_group_split_dropdown'
|
|
2
3
|
module UiBibz::Ui::Core::Forms::Buttons
|
|
3
4
|
|
|
4
5
|
# Create a button group
|
|
@@ -82,6 +83,11 @@ module UiBibz::Ui::Core::Forms::Buttons
|
|
|
82
83
|
@items << ButtonGroupDropdown.new(content, options, html_options).tap(&block).render
|
|
83
84
|
end
|
|
84
85
|
|
|
86
|
+
def split_dropdown content, options = {}, html_options = nil, &block
|
|
87
|
+
options = @options.merge(options)
|
|
88
|
+
@items << ButtonGroupSplitDropdown.new(content, options, html_options).tap(&block).render
|
|
89
|
+
end
|
|
90
|
+
|
|
85
91
|
def input attribute_name, options = {}, &block
|
|
86
92
|
options = @options.merge(options)
|
|
87
93
|
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
module UiBibz::Ui::Core::Forms::Buttons
|
|
2
|
+
|
|
3
|
+
# Create a button choice
|
|
4
|
+
#
|
|
5
|
+
# This element is an extend of UiBibz::Ui::Core::Forms::Buttons::Button
|
|
6
|
+
#
|
|
7
|
+
# ==== Attributes
|
|
8
|
+
#
|
|
9
|
+
# * +content+ - Content of element
|
|
10
|
+
# * +options+ - Options of element
|
|
11
|
+
# * +html_options+ - Html Options of element
|
|
12
|
+
#
|
|
13
|
+
# ==== Options
|
|
14
|
+
#
|
|
15
|
+
# You can add HTML attributes using the +html_options+.
|
|
16
|
+
# You can pass arguments in options attribute:
|
|
17
|
+
# * +type+ - Symbol (+:checkbox+, +:radio+)
|
|
18
|
+
# * +status+ - status of élement with symbol value:
|
|
19
|
+
# (+:primary+, +:secondary+, +:info+, +:warning+, +:danger+)
|
|
20
|
+
# * +size+
|
|
21
|
+
# (+:xs+, +:sm+, +:lg+)
|
|
22
|
+
# * +url+ - String url
|
|
23
|
+
# * +outline+ - Boolean
|
|
24
|
+
# * +state+ - Symbol (+:active+, +:disabled)
|
|
25
|
+
# * +type+ - Symbol (+:block)
|
|
26
|
+
# * +name+ - String name of input checkbox
|
|
27
|
+
# * +id+ - String id of input checkbox
|
|
28
|
+
# * +input_html_options+ - Hash of input html options
|
|
29
|
+
# * +glyph+ - Add glyph with name or hash options
|
|
30
|
+
# * +name+ - String
|
|
31
|
+
# * +size+ - Integer
|
|
32
|
+
# * +type+ - Symbol
|
|
33
|
+
#
|
|
34
|
+
# ==== Signatures
|
|
35
|
+
#
|
|
36
|
+
# UiBibz::Ui::Core::Forms::Buttons::Choice.new(content, options = nil, html_options = nil)
|
|
37
|
+
#
|
|
38
|
+
# UiBibz::Ui::Core::Forms::Buttons::Choice.new(options = nil, html_options = nil) do
|
|
39
|
+
# content
|
|
40
|
+
# end
|
|
41
|
+
#
|
|
42
|
+
# ==== Examples
|
|
43
|
+
#
|
|
44
|
+
# UiBibz::Ui::Core::Forms::Buttons::Choice.new('test', state: :active)
|
|
45
|
+
#
|
|
46
|
+
# UiBibz::Ui::Core::Forms::Buttons::Choice.new({id: 'state', input_html_options: { class: 'state'}}, { class: 'lable-class'}) do
|
|
47
|
+
# test
|
|
48
|
+
# end.render
|
|
49
|
+
#
|
|
50
|
+
# ==== Helper
|
|
51
|
+
#
|
|
52
|
+
# choice(content, options = {}, html_options = {})
|
|
53
|
+
#
|
|
54
|
+
# choice(options = {}, html_options = {}) do
|
|
55
|
+
# content
|
|
56
|
+
# end
|
|
57
|
+
#
|
|
58
|
+
class ButtonGroupSplitDropdown < UiBibz::Ui::Core::Forms::Dropdowns::SplitDropdown
|
|
59
|
+
|
|
60
|
+
# See UiBibz::Ui::Core::Forms::Buttons::Button.initialize
|
|
61
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
|
62
|
+
super
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
private
|
|
66
|
+
|
|
67
|
+
def component_html_classes
|
|
68
|
+
super << "btn-group"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -59,8 +59,9 @@ module UiBibz::Ui::Core::Forms::Choices
|
|
|
59
59
|
|
|
60
60
|
def checkbox_field_html_tag
|
|
61
61
|
options[:action] = html_options[:data].delete(:action)
|
|
62
|
-
content_tag
|
|
63
|
-
concat
|
|
62
|
+
content_tag(:div, html_options.except(:id, "data-action")) do
|
|
63
|
+
concat hidden_field_tag content, '0', id: "#{ content }-hidden"
|
|
64
|
+
concat check_box_tag content, options[:value] || '1', options[:checked] || html_options[:checked], checkbox_html_options
|
|
64
65
|
concat label_tag label_name, label_content, label_html_options
|
|
65
66
|
end
|
|
66
67
|
end
|
|
@@ -95,8 +95,13 @@ module UiBibz::Ui::Core::Forms::Dropdowns
|
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
# Add html component
|
|
98
|
-
def html content
|
|
99
|
-
|
|
98
|
+
def html content = nil, &block
|
|
99
|
+
if !block.nil?
|
|
100
|
+
context = eval("self", block.binding)
|
|
101
|
+
@items << context.capture(&block)
|
|
102
|
+
else
|
|
103
|
+
@items << content
|
|
104
|
+
end
|
|
100
105
|
end
|
|
101
106
|
|
|
102
107
|
def id
|
|
@@ -106,11 +111,11 @@ module UiBibz::Ui::Core::Forms::Dropdowns
|
|
|
106
111
|
protected
|
|
107
112
|
|
|
108
113
|
def component_html_classes
|
|
109
|
-
[type, open, inline]
|
|
114
|
+
[type, open, inline, without_caret]
|
|
110
115
|
end
|
|
111
116
|
|
|
112
117
|
def button_content
|
|
113
|
-
|
|
118
|
+
glyph_and_content_html(options[:text].nil? ? @content : '').html_safe
|
|
114
119
|
end
|
|
115
120
|
|
|
116
121
|
def button_html
|
|
@@ -122,11 +127,7 @@ module UiBibz::Ui::Core::Forms::Dropdowns
|
|
|
122
127
|
end
|
|
123
128
|
|
|
124
129
|
def ul_html
|
|
125
|
-
content_tag :div, @items.join.html_safe, class: join_classes("dropdown-menu", position, open), "arial-labelledby" => id
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
def caret
|
|
129
|
-
content_tag :span, '', class: 'caret'
|
|
130
|
+
content_tag :div, @items.join.html_safe, class: join_classes("dropdown-menu", position, open, ), "arial-labelledby" => id
|
|
130
131
|
end
|
|
131
132
|
|
|
132
133
|
def dropdown_tag
|
|
@@ -149,6 +150,10 @@ module UiBibz::Ui::Core::Forms::Dropdowns
|
|
|
149
150
|
"btn-group" if @options[:inline]
|
|
150
151
|
end
|
|
151
152
|
|
|
153
|
+
def without_caret
|
|
154
|
+
"without-caret" if @options[:caret] == false
|
|
155
|
+
end
|
|
156
|
+
|
|
152
157
|
def outline
|
|
153
158
|
"outline" if @options[:outline]
|
|
154
159
|
end
|
|
@@ -30,9 +30,10 @@ module GlyphExtension
|
|
|
30
30
|
{}
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
glyph_options[:text]
|
|
34
|
-
glyph_options[:content]
|
|
35
|
-
glyph_options[:shortcut]
|
|
33
|
+
glyph_options[:text] = options[:text] unless options[:text].nil?
|
|
34
|
+
glyph_options[:content] = options[:content] unless options[:content].nil?
|
|
35
|
+
glyph_options[:shortcut] = options[:shortcut] unless options[:shortcut].nil?
|
|
36
|
+
glyph_options[:html_options] = options[:html_options] unless options[:html_options].nil?
|
|
36
37
|
|
|
37
38
|
UiBibz::Utils::GlyphChanger.new(glyph_options[:name], glyph_options).render unless glyph_options[:name].nil?
|
|
38
39
|
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module PopoverExtension
|
|
2
|
+
|
|
3
|
+
def popover_data_html
|
|
4
|
+
unless options[:popover].blank?
|
|
5
|
+
add_html_data :toggle, "popover"
|
|
6
|
+
add_html_data :content, (options[:popover].kind_of?(String) ? options[:popover] : options[:popover][:content])
|
|
7
|
+
end
|
|
8
|
+
if options[:popover].kind_of?(Hash)
|
|
9
|
+
add_html_data :title, options[:popover].try(:[], :title) unless options[:popover].try(:[], :title).nil?
|
|
10
|
+
add_html_data :placement, options[:popover].try(:[], :position) unless options[:popover].try(:[], :position).nil?
|
|
11
|
+
add_html_data :trigger, options[:popover].try(:[], :trigger) unless options[:popover].try(:[], :trigger).nil?
|
|
12
|
+
add_html_data :template, options[:popover].try(:[], :template) unless options[:popover].try(:[], :template).nil?
|
|
13
|
+
add_html_data :animation, options[:popover].try(:[], :animation) unless options[:popover].try(:[], :animation).nil?
|
|
14
|
+
add_html_data :html, options[:popover].try(:[], :html) unless options[:popover].try(:[], :html).nil?
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
@@ -22,7 +22,8 @@ module UiBibz::Utils
|
|
|
22
22
|
def format_opts
|
|
23
23
|
glyph_name = @glyph_options.try(:[], :name)
|
|
24
24
|
glyph_opts = @glyph_options
|
|
25
|
-
glyph_html_opts = @options[:
|
|
25
|
+
glyph_html_opts = @options[:html_options] || {}
|
|
26
|
+
glyph_html_opts = glyph_html_opts.merge(@options[:text] ? {} : { title: @options[:content] })
|
|
26
27
|
glyph_items = @glyph_options.try(:[], :items) || []
|
|
27
28
|
|
|
28
29
|
[glyph_name, glyph_opts, glyph_html_opts, glyph_items]
|
|
@@ -35,7 +36,8 @@ module UiBibz::Utils
|
|
|
35
36
|
glyph_name = @glyph_options
|
|
36
37
|
glyph_opts = @options
|
|
37
38
|
title = [(@options[:content] unless @options[:text]), ("<kbd>#{ @options[:shortcut] }</kbd>" unless @options[:shortcut].nil?)].compact.join(" ")
|
|
38
|
-
glyph_html_opts =
|
|
39
|
+
glyph_html_opts = @options[:html_options] || {}
|
|
40
|
+
glyph_html_opts = glyph_html_opts.merge(title.blank? ? {} : { title: title.html_safe })
|
|
39
41
|
end
|
|
40
42
|
|
|
41
43
|
UiBibz::Ui::Core::Icons::Glyph.new(glyph_name, glyph_opts, glyph_html_opts).render unless glyph_name.nil?
|
data/test/simple_form_test.rb
CHANGED
|
@@ -84,7 +84,7 @@ class SimpleFormTest < ActionView::TestCase
|
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"✓\" /><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_markdown_editor_field optional user_name_fr\"><label class=\"control-label ui_markdown_editor_field optional\" for=\"user_name_fr\">Name fr</label><textarea name=\"user[name_fr]\" id=\"user_name_fr\" class=\"ui_markdown_editor_field optional\" data-provide=\"markdown\" data-iconlibrary=\"fa-5\">
|
|
87
|
-
</textarea></div></form>"
|
|
87
|
+
test1</textarea></div></form>"
|
|
88
88
|
|
|
89
89
|
assert_equal expected, actual
|
|
90
90
|
end
|
|
@@ -45,7 +45,7 @@ class ButtonGroupTest < ActionView::TestCase
|
|
|
45
45
|
d.link 'Link 1', url: '#link1', glyph: 'eye'
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
|
-
expected = "<div class=\"btn-group\" role=\"group\"><div id=\"dropdown-test\" class=\"dropup btn-group\"><button class=\"btn btn-success dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"dropdown-test\">Dropdown
|
|
48
|
+
expected = "<div class=\"btn-group\" role=\"group\"><div id=\"dropdown-test\" class=\"dropup btn-group\"><button class=\"btn btn-success dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"dropdown-test\">Dropdown</button><div class=\"dropdown-menu\" arial-labelledby=\"dropdown-test\"><a class=\"dropdown-item\" href=\"#link1\"><i class=\"glyph fas fa-eye\"></i> Link 1</a></div></div></div>"
|
|
49
49
|
|
|
50
50
|
assert_equal expected, actual
|
|
51
51
|
end
|
|
@@ -4,7 +4,7 @@ class CheckboxFieldTest < ActionView::TestCase
|
|
|
4
4
|
|
|
5
5
|
test 'checkbox_field' do
|
|
6
6
|
actual = UiBibz::Ui::Core::Forms::Choices::CheckboxField.new('John', { value: 1, status: :primary, type: :circle }).render
|
|
7
|
-
expected = "<div class=\"abc-checkbox-primary form-check abc-checkbox abc-checkbox-circle\"><input type=\"checkbox\" name=\"John\" id=\"John\" value=\"1\" class=\"form-check-input\" /><label class=\"form-check-label\" for=\"John\">John</label></div>"
|
|
7
|
+
expected = "<div class=\"abc-checkbox-primary form-check abc-checkbox abc-checkbox-circle\"><input type=\"hidden\" name=\"John\" id=\"John-hidden\" value=\"0\" /><input type=\"checkbox\" name=\"John\" id=\"John\" value=\"1\" class=\"form-check-input\" /><label class=\"form-check-label\" for=\"John\">John</label></div>"
|
|
8
8
|
|
|
9
9
|
assert_equal expected, actual
|
|
10
10
|
end
|
|
@@ -6,7 +6,7 @@ class DropdownTest < ActionView::TestCase
|
|
|
6
6
|
actual = UiBibz::Ui::Core::Forms::Dropdowns::Dropdown.new("Dropdown").tap do |d|
|
|
7
7
|
d.link 'link'
|
|
8
8
|
end
|
|
9
|
-
expected = "<div class=\"dropdown\"><button class=\"btn btn-secondary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"#{ actual.id }\">Dropdown
|
|
9
|
+
expected = "<div class=\"dropdown\"><button class=\"btn btn-secondary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"#{ actual.id }\">Dropdown</button><div class=\"dropdown-menu\" arial-labelledby=\"#{ actual.id }\"><a class=\"dropdown-item\" href=\"#\">link</a></div></div>"
|
|
10
10
|
|
|
11
11
|
assert_equal expected, actual.render
|
|
12
12
|
end
|
|
@@ -15,7 +15,7 @@ class DropdownTest < ActionView::TestCase
|
|
|
15
15
|
actual = UiBibz::Ui::Core::Forms::Dropdowns::Dropdown.new("Dropdown", status: :primary).tap do |d|
|
|
16
16
|
d.link 'link'
|
|
17
17
|
end
|
|
18
|
-
expected = "<div class=\"dropdown\"><button class=\"btn btn-primary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"#{ actual.id }\">Dropdown
|
|
18
|
+
expected = "<div class=\"dropdown\"><button class=\"btn btn-primary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"#{ actual.id }\">Dropdown</button><div class=\"dropdown-menu\" arial-labelledby=\"#{ actual.id }\"><a class=\"dropdown-item\" href=\"#\">link</a></div></div>"
|
|
19
19
|
|
|
20
20
|
assert_equal expected, actual.render
|
|
21
21
|
end
|
|
@@ -24,7 +24,7 @@ class DropdownTest < ActionView::TestCase
|
|
|
24
24
|
actual = UiBibz::Ui::Core::Forms::Dropdowns::Dropdown.new("Dropdown", status: :primary, outline: true).tap do |d|
|
|
25
25
|
d.link 'link'
|
|
26
26
|
end
|
|
27
|
-
expected = "<div class=\"dropdown\"><button class=\"btn btn-outline-primary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"#{ actual.id }\">Dropdown
|
|
27
|
+
expected = "<div class=\"dropdown\"><button class=\"btn btn-outline-primary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"#{ actual.id }\">Dropdown</button><div class=\"dropdown-menu\" arial-labelledby=\"#{ actual.id }\"><a class=\"dropdown-item\" href=\"#\">link</a></div></div>"
|
|
28
28
|
|
|
29
29
|
assert_equal expected, actual.render
|
|
30
30
|
end
|
|
@@ -37,7 +37,7 @@ class DropdownTest < ActionView::TestCase
|
|
|
37
37
|
d.divider
|
|
38
38
|
d.link 'Link3', url: '#link3'
|
|
39
39
|
end
|
|
40
|
-
expected = "<div class=\"dropup\"><button class=\"btn btn-success dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"#{ actual.id }\"><i class=\"glyph fas fa-diamond\"></i> Dropdown
|
|
40
|
+
expected = "<div class=\"dropup\"><button class=\"btn btn-success dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"#{ actual.id }\"><i class=\"glyph fas fa-diamond\"></i> Dropdown</button><div class=\"dropdown-menu\" arial-labelledby=\"#{ actual.id }\"><a class=\"dropdown-item\" href=\"#link1\"><i class=\"glyph fas fa-eye\"></i> Link 1</a><h6 class=\"dropdown-header\" role=\"presentation\">header</h6><a class=\"dropdown-item\" href=\"#link2\">Link 2</a><div class=\"dropdown-divider\"></div><a class=\"dropdown-item\" href=\"#link3\">Link3</a></div></div>"
|
|
41
41
|
|
|
42
42
|
assert_equal expected, actual.render
|
|
43
43
|
end
|
|
@@ -46,7 +46,7 @@ class DropdownTest < ActionView::TestCase
|
|
|
46
46
|
actual = UiBibz::Ui::Core::Forms::Dropdowns::Dropdown.new("Split Dropdown").tap do |d|
|
|
47
47
|
d.link 'state'
|
|
48
48
|
end
|
|
49
|
-
expected = "<div class=\"dropdown\"><button class=\"btn btn-secondary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"#{ actual.id }\">Split Dropdown
|
|
49
|
+
expected = "<div class=\"dropdown\"><button class=\"btn btn-secondary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"#{ actual.id }\">Split Dropdown</button><div class=\"dropdown-menu\" arial-labelledby=\"#{ actual.id }\"><a class=\"dropdown-item\" href=\"#\">state</a></div></div>"
|
|
50
50
|
|
|
51
51
|
assert_equal expected, actual.render
|
|
52
52
|
end
|
|
@@ -30,7 +30,7 @@ class SurroundFieldTest < ActionView::TestCase
|
|
|
30
30
|
d.link 'Link3', url: '#link3'
|
|
31
31
|
end
|
|
32
32
|
end.render
|
|
33
|
-
expected = "<div class=\"input-group ui_surround_field\"><div id=\"dropdown-test\" class=\"dropdown input-group-btn\"><button class=\"btn btn-secondary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"dropdown-test\">Dropdown
|
|
33
|
+
expected = "<div class=\"input-group ui_surround_field\"><div id=\"dropdown-test\" class=\"dropdown input-group-btn\"><button class=\"btn btn-secondary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\" id=\"dropdown-test\">Dropdown</button><div class=\"dropdown-menu\" arial-labelledby=\"dropdown-test\"><a class=\"dropdown-item\" href=\"#link1\"><i class=\"glyph fas fa-eye\"></i> Link 1</a><h6 class=\"dropdown-header\" role=\"presentation\">header</h6><a class=\"dropdown-item\" href=\"#link2\">Link 2</a><div class=\"dropdown-divider\"></div><a class=\"dropdown-item\" href=\"#link3\">Link3</a></div></div></div>"
|
|
34
34
|
|
|
35
35
|
assert_equal expected, actual
|
|
36
36
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ui_bibz
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thooams
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-12-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -283,6 +283,7 @@ files:
|
|
|
283
283
|
- lib/ui_bibz/inputs/ui_bibz_inputs/collection_input.rb
|
|
284
284
|
- lib/ui_bibz/inputs/ui_bibz_inputs/string_input.rb
|
|
285
285
|
- lib/ui_bibz/inputs/ui_bibz_inputs/ui_auto_complete_field_input.rb
|
|
286
|
+
- lib/ui_bibz/inputs/ui_bibz_inputs/ui_checkbox_field_input.rb
|
|
286
287
|
- lib/ui_bibz/inputs/ui_bibz_inputs/ui_choice_group_input.rb
|
|
287
288
|
- lib/ui_bibz/inputs/ui_bibz_inputs/ui_date_picker_field_input.rb
|
|
288
289
|
- lib/ui_bibz/inputs/ui_bibz_inputs/ui_dropdown_select_field_input.rb
|
|
@@ -317,6 +318,7 @@ files:
|
|
|
317
318
|
- lib/ui_bibz/ui/core/forms/buttons/button_link.rb
|
|
318
319
|
- lib/ui_bibz/ui/core/forms/buttons/button_refresh.rb
|
|
319
320
|
- lib/ui_bibz/ui/core/forms/buttons/components/button_group_dropdown.rb
|
|
321
|
+
- lib/ui_bibz/ui/core/forms/buttons/components/button_group_split_dropdown.rb
|
|
320
322
|
- lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb
|
|
321
323
|
- lib/ui_bibz/ui/core/forms/choices/choice_group.rb
|
|
322
324
|
- lib/ui_bibz/ui/core/forms/choices/components/choice.rb
|
|
@@ -392,6 +394,7 @@ files:
|
|
|
392
394
|
- lib/ui_bibz/ui/core/windows/modal.rb
|
|
393
395
|
- lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb
|
|
394
396
|
- lib/ui_bibz/ui/extensions/core/component/klass_extension.rb
|
|
397
|
+
- lib/ui_bibz/ui/extensions/core/component/popover_extension.rb
|
|
395
398
|
- lib/ui_bibz/ui/extensions/core/forms/connect_extension.rb
|
|
396
399
|
- lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb
|
|
397
400
|
- lib/ui_bibz/ui/ux/containers/components/panel_body.rb
|