ui_bibz 2.0.2 → 2.0.3
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 +4 -4
- data/app/assets/javascripts/interface.coffee +1 -1
- data/app/assets/stylesheets/fix_addon.sass +5 -0
- data/app/assets/stylesheets/forms.sass +1 -1
- data/lib/ui_bibz/ui/core/boxes/card.rb +5 -1
- data/lib/ui_bibz/ui/core/boxes/components/card_header.rb +16 -0
- data/lib/ui_bibz/ui/core/boxes/components/card_image.rb +1 -1
- data/lib/ui_bibz/ui/core/boxes/components/card_tab_group.rb +26 -0
- data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +3 -3
- data/lib/ui_bibz/ui/core/forms/choices/choice_group.rb +1 -1
- data/lib/ui_bibz/ui/core/lists/components/list.rb +2 -2
- data/lib/ui_bibz/ui/core/lists/list_group.rb +12 -8
- data/lib/ui_bibz/ui/core/navigations/breadcrumb.rb +33 -17
- data/lib/ui_bibz/ui/core/navigations/components/breadcrumb_link.rb +11 -3
- data/lib/ui_bibz/ui/core/navigations/components/nav_link.rb +1 -1
- data/lib/ui_bibz/ui/core/navigations/tab_group.rb +7 -3
- data/lib/ui_bibz/ui/core/notifications/alert.rb +3 -5
- data/lib/ui_bibz/ui/core/notifications/badge.rb +9 -6
- data/lib/ui_bibz/version.rb +1 -1
- data/test/ui/core/boxes/card_test.rb +14 -1
- data/test/ui/core/forms/choices/checkbox_field_test.rb +1 -1
- data/test/ui/core/forms/choices/choice_group_test.rb +3 -3
- data/test/ui/core/lists/list_group_test.rb +33 -3
- data/test/ui/core/navigations/breadcrumb_test.rb +3 -3
- data/test/ui/core/navigations/tab_group_test.rb +15 -4
- data/test/ui/core/notifications/badge_test.rb +7 -0
- data/ui_bibz.gemspec +1 -1
- data/vendor/assets/stylesheets/awesome-bootstrap-checkbox.css +205 -277
- metadata +7 -7
- data/lib/ui_bibz/ui/core/forms/buttons/button_choice.rb +0 -92
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea70b53e1fa027cef5b1811801a41d6d74ff7988
|
4
|
+
data.tar.gz: fa7fcf9685f92dd939844df73d323381dfdd5b29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cbe8b9c14bdfe66f05de625bd3793a0af8342b7eaecf3145f54a2cdc42077f1e5726c88b5bdef50ffc936b0c7cc35dcb09715295ea2e5b496dae638cae1cce3
|
7
|
+
data.tar.gz: efc3de7d2b7f67dd45dec59559f398625da9b64998f7e362d2ec043d21c047d6256b657b073f1fa5310bbe86f22653b2a4ae58a3f3565c479ad5280fd9a819fa
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ui_bibz (2.0.
|
5
|
-
bootstrap (
|
4
|
+
ui_bibz (2.0.3)
|
5
|
+
bootstrap (~> 4.1.0)
|
6
6
|
font-awesome-sass
|
7
7
|
haml
|
8
8
|
haml-rails
|
@@ -61,7 +61,7 @@ GEM
|
|
61
61
|
autoprefixer-rails (8.4.1)
|
62
62
|
execjs
|
63
63
|
awesome_print (1.8.0)
|
64
|
-
bootstrap (4.
|
64
|
+
bootstrap (4.1.1)
|
65
65
|
autoprefixer-rails (>= 6.0.3)
|
66
66
|
popper_js (>= 1.12.9, < 2)
|
67
67
|
sass (>= 3.5.2)
|
@@ -118,7 +118,7 @@ GEM
|
|
118
118
|
mini_mime (1.0.0)
|
119
119
|
mini_portile2 (2.3.0)
|
120
120
|
minitest (5.11.3)
|
121
|
-
nio4r (2.3.
|
121
|
+
nio4r (2.3.1)
|
122
122
|
nokogiri (1.8.2)
|
123
123
|
mini_portile2 (~> 2.3.0)
|
124
124
|
popper_js (1.12.9)
|
@@ -97,7 +97,11 @@ module UiBibz::Ui::Core::Boxes
|
|
97
97
|
# Add Header which is a component
|
98
98
|
def header content = nil, options = nil, html_options = nil, &block
|
99
99
|
options, content = inherit_options(content, options, block)
|
100
|
-
|
100
|
+
if is_tap(content, options)
|
101
|
+
@header = UiBibz::Ui::Core::Boxes::Components::CardHeader.new(content, options, html_options).tap(&block).render
|
102
|
+
else
|
103
|
+
@header = UiBibz::Ui::Core::Boxes::Components::CardHeader.new(content, options, html_options, &block).render
|
104
|
+
end
|
101
105
|
end
|
102
106
|
|
103
107
|
# Add Body div which is a component
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'ui_bibz/ui/core/boxes/components/card_tab_group'
|
1
2
|
module UiBibz::Ui::Core::Boxes::Components
|
2
3
|
|
3
4
|
# Create a card header
|
@@ -29,6 +30,13 @@ module UiBibz::Ui::Core::Boxes::Components
|
|
29
30
|
# 'Exemple'
|
30
31
|
# end.render
|
31
32
|
#
|
33
|
+
# UiBibz::Ui::Core::Boxes::CardHeader.new(tap: true) do |h|
|
34
|
+
# h.tab_group do |tg|
|
35
|
+
# tg.tab 'link', url: '#link"
|
36
|
+
# tg.tab 'link', url: '#link"
|
37
|
+
# end
|
38
|
+
# end.render
|
39
|
+
#
|
32
40
|
class CardHeader < UiBibz::Ui::Core::Component
|
33
41
|
|
34
42
|
# See UiBibz::Ui::Core::Component.initialize
|
@@ -41,6 +49,14 @@ module UiBibz::Ui::Core::Boxes::Components
|
|
41
49
|
content_tag :div, glyph_and_content_html, html_options
|
42
50
|
end
|
43
51
|
|
52
|
+
def tab_group content = nil, options = nil, html_options = nil, &block
|
53
|
+
if is_tap(content, options)
|
54
|
+
@content = CardTabGroup.new(content, options, html_options).tap(&block).render
|
55
|
+
else
|
56
|
+
@content = CardTabGroup.new(content, options, html_options, &block).render
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
44
60
|
private
|
45
61
|
|
46
62
|
def component_html_classes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module UiBibz::Ui::Core::Boxes::Components
|
2
|
+
|
3
|
+
# Create a card tab group
|
4
|
+
#
|
5
|
+
# This element is an extend of UiBibz::Ui::Core::Navigation::TabGroup.
|
6
|
+
#
|
7
|
+
# ==== Attributes
|
8
|
+
#
|
9
|
+
# * +content+ - Content of element
|
10
|
+
# * +options+ - Options of element
|
11
|
+
# * +html_options+ - Html Options of element
|
12
|
+
#
|
13
|
+
class CardTabGroup < UiBibz::Ui::Core::Navigations::TabGroup
|
14
|
+
|
15
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def component_html_classes
|
22
|
+
super << "card-header-tabs"
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -65,7 +65,7 @@ module UiBibz::Ui::Core::Forms::Choices
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def checkbox_html_options
|
68
|
-
{ class: '
|
68
|
+
{ class: 'form-check-input', disabled: options[:state] == :disabled }
|
69
69
|
end
|
70
70
|
|
71
71
|
def label_name
|
@@ -73,7 +73,7 @@ module UiBibz::Ui::Core::Forms::Choices
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def label_html_options
|
76
|
-
|
76
|
+
{ class: join_classes("form-check-label", ("fix-label" if options[:label] == false)) }
|
77
77
|
end
|
78
78
|
|
79
79
|
def label_content
|
@@ -104,7 +104,7 @@ module UiBibz::Ui::Core::Forms::Choices
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def component_html_classes
|
107
|
-
super << ["
|
107
|
+
super << ["form-check", "abc-checkbox", type, indeterminate, inline]
|
108
108
|
end
|
109
109
|
|
110
110
|
end
|
@@ -114,11 +114,11 @@ module UiBibz::Ui::Core::Lists::Components
|
|
114
114
|
|
115
115
|
def is_link_type?
|
116
116
|
@html_options[:href] = @options[:url] if @options[:url]
|
117
|
-
@options[:
|
117
|
+
@options[:tag_type] == :a || @html_options.delete(:tag_type) == :a
|
118
118
|
end
|
119
119
|
|
120
120
|
def is_button_type?
|
121
|
-
@options[:
|
121
|
+
@options[:tag_type] == :button || @html_options.delete(:tag_type) == :button
|
122
122
|
end
|
123
123
|
|
124
124
|
def tag_type
|
@@ -15,8 +15,9 @@ module UiBibz::Ui::Core::Lists
|
|
15
15
|
#
|
16
16
|
# You can add HTML attributes using the +html_options+.
|
17
17
|
# You can pass arguments in options attribute:
|
18
|
-
# * +
|
19
|
-
#
|
18
|
+
# * +flush+ - Boolean
|
19
|
+
# * +tag_type+ - Type of list (default: :li)
|
20
|
+
# (+:a+, +:button+, +:li+)
|
20
21
|
#
|
21
22
|
# ==== Signatures
|
22
23
|
#
|
@@ -33,7 +34,7 @@ module UiBibz::Ui::Core::Lists
|
|
33
34
|
# d.list 'Test2', status: :primary
|
34
35
|
# end.render
|
35
36
|
#
|
36
|
-
# UiBibz::Ui::Core::ListGroup.new(
|
37
|
+
# UiBibz::Ui::Core::ListGroup.new(tag_type: :li).tap do |d|
|
37
38
|
# d.list 'Test', status: :success, url: '#test'
|
38
39
|
# d.list(status: :primary) do
|
39
40
|
# 'Test 2'
|
@@ -84,10 +85,9 @@ module UiBibz::Ui::Core::Lists
|
|
84
85
|
# Add group list
|
85
86
|
# See UiBibz::Ui::Core::List
|
86
87
|
def list content = nil, options = {} , html_options = nil, &block
|
87
|
-
|
88
|
-
options = options.merge({ tag: @options[:tag] }) unless @options[:tag].nil?
|
88
|
+
options = options.merge({ tag_type: @options[:tag_type] }) unless @options[:tag_type].nil?
|
89
89
|
|
90
|
-
if is_tap
|
90
|
+
if is_tap(content, options)
|
91
91
|
@lists << UiBibz::Ui::Core::Lists::Components::List.new(content, options, html_options).tap(&block).render
|
92
92
|
else
|
93
93
|
@lists << UiBibz::Ui::Core::Lists::Components::List.new(content, options, html_options, &block).render
|
@@ -97,11 +97,15 @@ module UiBibz::Ui::Core::Lists
|
|
97
97
|
private
|
98
98
|
|
99
99
|
def component_html_classes
|
100
|
-
"list-group"
|
100
|
+
super << ["list-group", flush]
|
101
|
+
end
|
102
|
+
|
103
|
+
def flush
|
104
|
+
"list-group-flush" if options[:flush]
|
101
105
|
end
|
102
106
|
|
103
107
|
def tag_type
|
104
|
-
[:a, :button].include?(options[:
|
108
|
+
[:a, :button].include?(options[:tag_type]) ? :div : :ul
|
105
109
|
end
|
106
110
|
|
107
111
|
end
|
@@ -15,6 +15,13 @@ module UiBibz::Ui::Core::Navigations
|
|
15
15
|
# * +options+ - Options of element
|
16
16
|
# * +html_options+ - Html Options of element
|
17
17
|
#
|
18
|
+
# ==== Options
|
19
|
+
#
|
20
|
+
# You can add HTML attributes using the +html_options+.
|
21
|
+
# You can pass arguments in options attribute:
|
22
|
+
# * +link_label+ - [Symbol | String] Display label of link with store
|
23
|
+
# * +link_url+ - [String] Display url of link with store
|
24
|
+
#
|
18
25
|
# ==== Components
|
19
26
|
#
|
20
27
|
# +link+ is UiBibz::Ui::Core::Navigations::BreadCrumb::Components::BreadcrumbLink component
|
@@ -28,6 +35,9 @@ module UiBibz::Ui::Core::Navigations
|
|
28
35
|
# ...
|
29
36
|
# end
|
30
37
|
#
|
38
|
+
# UiBibz::Ui::Core::Navigations::Breadcrumb.new(@store)
|
39
|
+
#
|
40
|
+
#
|
31
41
|
# ==== Examples
|
32
42
|
#
|
33
43
|
# UiBibz::Ui::Core::Navigations::Breadcrumb.new().tap do |b|
|
@@ -38,16 +48,24 @@ module UiBibz::Ui::Core::Navigations
|
|
38
48
|
# b.link 'Level 2', state: :active
|
39
49
|
# end.render
|
40
50
|
#
|
51
|
+
# # or
|
52
|
+
#
|
53
|
+
# @users = User.all
|
54
|
+
# UiBibz::Ui::Core::Navigations::Breadcrumb.new(@users).render
|
55
|
+
#
|
41
56
|
# ==== Helper
|
42
57
|
#
|
43
|
-
#
|
58
|
+
# ui_breadcrumb({tap: true}) do |b|
|
44
59
|
# b.link(content, options = {}, html_options = {})
|
45
60
|
# b.link(options = {}, html_options = {}) do
|
46
61
|
# content
|
47
62
|
# end
|
48
63
|
# end
|
49
64
|
#
|
50
|
-
#
|
65
|
+
# # or
|
66
|
+
#
|
67
|
+
# @users = User.all
|
68
|
+
# ui_breadcrumb(@users, { link_label: name, link_url: user_path(:id) })
|
51
69
|
#
|
52
70
|
class Breadcrumb < UiBibz::Ui::Core::Component
|
53
71
|
|
@@ -55,12 +73,14 @@ module UiBibz::Ui::Core::Navigations
|
|
55
73
|
def initialize content = nil, options = nil, html_options = nil, &block
|
56
74
|
super
|
57
75
|
@links = []
|
76
|
+
generate_links unless @content.nil?
|
58
77
|
end
|
59
78
|
|
60
79
|
# Render html tag
|
61
80
|
def pre_render
|
62
|
-
|
63
|
-
|
81
|
+
content_tag :nav, html_options do
|
82
|
+
content_tag :ol, @links.join.html_safe, class: 'breadcrumb'
|
83
|
+
end
|
64
84
|
end
|
65
85
|
|
66
86
|
# Add breadcrumb link items
|
@@ -71,16 +91,12 @@ module UiBibz::Ui::Core::Navigations
|
|
71
91
|
|
72
92
|
private
|
73
93
|
|
74
|
-
def
|
75
|
-
|
76
|
-
end
|
77
|
-
|
78
|
-
def store
|
79
|
-
@options[:store]
|
94
|
+
def component_html_options
|
95
|
+
super.merge({ "arial-label": "breadcrumb" })
|
80
96
|
end
|
81
97
|
|
82
98
|
def model_name
|
83
|
-
|
99
|
+
content.class.to_s
|
84
100
|
end
|
85
101
|
|
86
102
|
def link_label
|
@@ -92,14 +108,14 @@ module UiBibz::Ui::Core::Navigations
|
|
92
108
|
end
|
93
109
|
|
94
110
|
def generate_links
|
95
|
-
|
96
|
-
|
97
|
-
@links << UiBibz::Ui::Core::Navigations::Components::BreadcrumbLink.new(item.send(link_label), status: :disabled).render
|
98
|
-
else
|
99
|
-
@links << UiBibz::Ui::Core::Navigations::Components::BreadcrumbLink.new(item.send(link_label), url: inject_url(link_url, item)).render
|
100
|
-
end
|
111
|
+
content.each do |item|
|
112
|
+
@links << UiBibz::Ui::Core::Navigations::Components::BreadcrumbLink.new(item.send(link_label), url: inject_url(link_url, item), current: item == last_item).render
|
101
113
|
end
|
102
114
|
end
|
103
115
|
|
116
|
+
def last_item
|
117
|
+
content.last
|
118
|
+
end
|
119
|
+
|
104
120
|
end
|
105
121
|
end
|
@@ -52,15 +52,23 @@ module UiBibz::Ui::Core::Navigations::Components
|
|
52
52
|
|
53
53
|
private
|
54
54
|
|
55
|
+
def component_html_options
|
56
|
+
super.merge(options[:current] ? { "aria-current": "page" } : {})
|
57
|
+
end
|
58
|
+
|
55
59
|
def component_html_classes
|
56
60
|
"breadcrumb-item"
|
57
61
|
end
|
58
62
|
|
63
|
+
def component_options
|
64
|
+
super.merge(options[:current] ? { status: :disabled } : {})
|
65
|
+
end
|
66
|
+
|
59
67
|
def link_html
|
60
|
-
if options[:
|
61
|
-
link_to glyph_and_content_html, options[:url] || '#'
|
62
|
-
else
|
68
|
+
if options[:current]
|
63
69
|
glyph_and_content_html
|
70
|
+
else
|
71
|
+
link_to glyph_and_content_html, options[:url] || '#'
|
64
72
|
end
|
65
73
|
end
|
66
74
|
|
@@ -52,7 +52,7 @@ module UiBibz::Ui::Core::Navigations
|
|
52
52
|
if options[:nav_type] == "nav-links"
|
53
53
|
UiBibz::Ui::Core::Navigations::NavLinkLink.new(content, options, html_options).render
|
54
54
|
else
|
55
|
-
if options[:tag_type] ==
|
55
|
+
if options[:tag_type] == :span
|
56
56
|
cont = UiBibz::Ui::Core::Navigations::NavLinkSpan.new(content, @old_options).render
|
57
57
|
else
|
58
58
|
cont = UiBibz::Ui::Core::Navigations::NavLinkLink.new(content, options).render
|
@@ -16,8 +16,8 @@ module UiBibz::Ui::Core::Navigations
|
|
16
16
|
# You can pass arguments in options attribute:
|
17
17
|
# * +position+ - Symbol
|
18
18
|
# (+:left+, +:right+, +:center+)
|
19
|
-
# * +
|
20
|
-
# (+:a+, +:
|
19
|
+
# * +tag_type+ - Symbol
|
20
|
+
# (+:a+, +:span)
|
21
21
|
# * +justify+ - Boolean
|
22
22
|
# * +fill+ - Boolean
|
23
23
|
#
|
@@ -35,7 +35,7 @@ module UiBibz::Ui::Core::Navigations
|
|
35
35
|
#
|
36
36
|
# ==== Examples
|
37
37
|
#
|
38
|
-
# UiBibz::Ui::Core::Navigations::TabGroup.new(
|
38
|
+
# UiBibz::Ui::Core::Navigations::TabGroup.new(tag_type: :span).tap do |n|
|
39
39
|
# n.tab 'Test', url: '#test'
|
40
40
|
# n.tab 'Test2', url: '#test2', state: :active
|
41
41
|
# n.dropdown('Action') do |d|
|
@@ -78,5 +78,9 @@ module UiBibz::Ui::Core::Navigations
|
|
78
78
|
["nav", "nav-tabs", position, justify, fill]
|
79
79
|
end
|
80
80
|
|
81
|
+
def type
|
82
|
+
"nav-tabs"
|
83
|
+
end
|
84
|
+
|
81
85
|
end
|
82
86
|
end
|
@@ -18,11 +18,9 @@ module UiBibz::Ui::Core::Notifications
|
|
18
18
|
# You can pass arguments in options attribute:
|
19
19
|
# * +status+ - status of élement with symbol value:
|
20
20
|
# (+:default+, +:primary+, +:info+, +:warning+, +:danger+)
|
21
|
-
# * +glyph+ - Add glyph with name or hash options
|
22
|
-
# * +name+ - String
|
23
|
-
#
|
24
|
-
# * +type+ - Symbol
|
25
|
-
# *+timeout+ - Integer
|
21
|
+
# * +glyph+ - [String | Hash] Add glyph with name or hash options
|
22
|
+
# * +name+ - [String]
|
23
|
+
# *+timeout+ - [Integer]
|
26
24
|
#
|
27
25
|
# ==== Signatures
|
28
26
|
#
|