ui_bibz 3.0.0.beta3 → 3.0.0.beta8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/.github/workflows/dependencies-checker.yml +13 -0
- data/.github/workflows/linter.yml +16 -0
- data/.rubocop.yml +1 -0
- data/Gemfile.lock +15 -18
- data/README.md +7 -6
- data/lib/ui_bibz.rb +2 -0
- data/lib/ui_bibz/infos.rb +2 -2
- data/lib/ui_bibz/ui/core/forms/dropdowns/split_dropdown.rb +4 -4
- data/lib/ui_bibz/ui/core/forms/files/file_field.rb +8 -14
- data/lib/ui_bibz/ui/core/navigations/navbar.rb +1 -1
- data/lib/ui_bibz/ui/core/notifications/popover.rb +89 -0
- data/lib/ui_bibz/ui/core/notifications/toast.rb +4 -4
- data/lib/ui_bibz/ui/core/notifications/tooltip.rb +89 -0
- data/lib/ui_bibz/ui/extensions/core/component/popover_extension.rb +22 -19
- data/test/simple_form_test.rb +1 -1
- data/test/ui/core/forms/buttons/button_test.rb +4 -4
- data/test/ui/core/forms/files/file_field_test.rb +1 -1
- data/test/ui/core/navigations/navbar_test.rb +4 -4
- data/test/ui/core/notifications/popover_test.rb +52 -0
- data/test/ui/core/notifications/tooltip_test.rb +58 -0
- data/ui_bibz.gemspec +1 -2
- metadata +12 -19
- data/.codeclimate.yml +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d3e72f23a91692fcd9919939cac116b0434333c8597b11dcef0f7b8cb766d87
|
4
|
+
data.tar.gz: f3b225819371ddbe82c9f2f3c84388f4e2fed1edce822e539e649e761f6224b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff3ce0988337055522cfb625287a83104691d0931219c76763e8014b0e8775496fa21312721896bc3fed30b26473f058abf2f3f7f87ea3d9cb7a19bf94409f14
|
7
|
+
data.tar.gz: 64cdd3c257b47403e4ebf83ab47fb56b3c0f73136a1d4db0fbbf300925b32999b374c6054271bba50bca2b0b7da0dc37db1d9c21178c718397d1f7d6fd110ae5
|
data/.github/workflows/ci.yml
CHANGED
@@ -23,6 +23,6 @@ jobs:
|
|
23
23
|
- name: Test with Rake
|
24
24
|
uses: paambaati/codeclimate-action@v2.7.5
|
25
25
|
env:
|
26
|
-
CC_TEST_REPORTER_ID:
|
26
|
+
CC_TEST_REPORTER_ID: 7e50558afc7a861280e3194a765a159e9ea5bdd22d2ebe6c13e5e23fe914c66b
|
27
27
|
with:
|
28
28
|
coverageCommand: bundle exec rake
|
@@ -0,0 +1,13 @@
|
|
1
|
+
name: Dependencies Checker
|
2
|
+
|
3
|
+
on: pull_request
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
audit:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@v2
|
10
|
+
- name: 'Bundler Audit'
|
11
|
+
uses: andrewmcodes/bundler-audit-action@main
|
12
|
+
env:
|
13
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ui_bibz (3.0.0.
|
4
|
+
ui_bibz (3.0.0.beta8)
|
5
5
|
will-paginate-i18n
|
6
|
-
will_paginate (~> 3.
|
6
|
+
will_paginate (~> 3.3.0)
|
7
7
|
will_paginate-bootstrap4
|
8
8
|
|
9
9
|
GEM
|
@@ -64,16 +64,14 @@ GEM
|
|
64
64
|
minitest (~> 5.1)
|
65
65
|
tzinfo (~> 1.1)
|
66
66
|
zeitwerk (~> 2.2, >= 2.2.2)
|
67
|
-
ast (2.4.
|
67
|
+
ast (2.4.2)
|
68
68
|
awesome_print (1.8.0)
|
69
69
|
builder (3.2.4)
|
70
70
|
byebug (11.1.3)
|
71
71
|
childprocess (4.0.0)
|
72
|
-
|
73
|
-
simplecov
|
74
|
-
concurrent-ruby (1.1.7)
|
72
|
+
concurrent-ruby (1.1.8)
|
75
73
|
crass (1.0.6)
|
76
|
-
docile (1.3.
|
74
|
+
docile (1.3.5)
|
77
75
|
erubi (1.10.0)
|
78
76
|
erubis (2.7.0)
|
79
77
|
factory_bot (4.11.1)
|
@@ -97,14 +95,14 @@ GEM
|
|
97
95
|
haml (>= 4.0, < 6)
|
98
96
|
nokogiri (>= 1.6.0)
|
99
97
|
ruby_parser (~> 3.5)
|
100
|
-
i18n (1.8.
|
98
|
+
i18n (1.8.8)
|
101
99
|
concurrent-ruby (~> 1.0)
|
102
100
|
iniparse (1.5.0)
|
103
101
|
jquery-rails (4.4.0)
|
104
102
|
rails-dom-testing (>= 1, < 3)
|
105
103
|
railties (>= 4.2.0)
|
106
104
|
thor (>= 0.14, < 2.0)
|
107
|
-
loofah (2.
|
105
|
+
loofah (2.9.0)
|
108
106
|
crass (~> 1.0.2)
|
109
107
|
nokogiri (>= 1.5.9)
|
110
108
|
mail (2.7.1)
|
@@ -160,7 +158,7 @@ GEM
|
|
160
158
|
rake (13.0.3)
|
161
159
|
regexp_parser (2.0.3)
|
162
160
|
rexml (3.2.4)
|
163
|
-
rubocop (1.
|
161
|
+
rubocop (1.9.1)
|
164
162
|
parallel (~> 1.10)
|
165
163
|
parser (>= 3.0.0.0)
|
166
164
|
rainbow (>= 2.2.2, < 4.0)
|
@@ -169,9 +167,9 @@ GEM
|
|
169
167
|
rubocop-ast (>= 1.2.0, < 2.0)
|
170
168
|
ruby-progressbar (~> 1.7)
|
171
169
|
unicode-display_width (>= 1.4.0, < 3.0)
|
172
|
-
rubocop-ast (1.4.
|
170
|
+
rubocop-ast (1.4.1)
|
173
171
|
parser (>= 2.7.1.5)
|
174
|
-
rubocop-minitest (0.10.
|
172
|
+
rubocop-minitest (0.10.3)
|
175
173
|
rubocop (>= 0.87, < 2.0)
|
176
174
|
rubocop-performance (1.9.2)
|
177
175
|
rubocop (>= 0.90.0, < 2.0)
|
@@ -181,13 +179,13 @@ GEM
|
|
181
179
|
rack (>= 1.1)
|
182
180
|
rubocop (>= 0.90.0, < 2.0)
|
183
181
|
ruby-progressbar (1.11.0)
|
184
|
-
ruby_parser (3.15.
|
182
|
+
ruby_parser (3.15.1)
|
185
183
|
sexp_processor (~> 4.9)
|
186
|
-
sexp_processor (4.15.
|
184
|
+
sexp_processor (4.15.2)
|
187
185
|
simple_form (5.0.3)
|
188
186
|
actionpack (>= 5.0)
|
189
187
|
activemodel (>= 5.0)
|
190
|
-
simplecov (0.21.
|
188
|
+
simplecov (0.21.2)
|
191
189
|
docile (~> 1.1)
|
192
190
|
simplecov-html (~> 0.11)
|
193
191
|
simplecov_json_formatter (~> 0.1)
|
@@ -202,7 +200,7 @@ GEM
|
|
202
200
|
sprockets (>= 3.0.0)
|
203
201
|
sqlite3 (1.4.2)
|
204
202
|
temple (0.8.2)
|
205
|
-
thor (1.0
|
203
|
+
thor (1.1.0)
|
206
204
|
thread_safe (0.3.6)
|
207
205
|
tilt (2.0.10)
|
208
206
|
tzinfo (1.2.9)
|
@@ -212,7 +210,7 @@ GEM
|
|
212
210
|
websocket-extensions (>= 0.1.0)
|
213
211
|
websocket-extensions (0.1.5)
|
214
212
|
will-paginate-i18n (0.1.15)
|
215
|
-
will_paginate (3.
|
213
|
+
will_paginate (3.3.0)
|
216
214
|
will_paginate-bootstrap4 (0.2.2)
|
217
215
|
will_paginate (~> 3.0, >= 3.0.0)
|
218
216
|
zeitwerk (2.4.2)
|
@@ -223,7 +221,6 @@ PLATFORMS
|
|
223
221
|
DEPENDENCIES
|
224
222
|
awesome_print
|
225
223
|
byebug
|
226
|
-
codeclimate-test-reporter
|
227
224
|
factory_bot_rails (~> 4.0)
|
228
225
|
haml-rails
|
229
226
|
jquery-rails (>= 3.1.0)
|
data/README.md
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
![Ui Bibz logo](https://repository-images.githubusercontent.com/29547689/e29b2180-0d59-11eb-89f3-4541571d7c67)
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/ui_bibz.svg)](https://badge.fury.io/rb/ui_bibz)
|
4
|
-
[![
|
5
|
-
[![Test Coverage](https://codeclimate.com/
|
6
|
-
[![
|
7
|
-
[![
|
8
|
-
![
|
4
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/cfbe9828c32d69581534/maintainability)](https://codeclimate.com/github/thooams/ui_bibz/maintainability)
|
5
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/cfbe9828c32d69581534/test_coverage)](https://codeclimate.com/github/thooams/ui_bibz/test_coverage)
|
6
|
+
[![security](https://hakiri.io/github/thooams/ui_bibz/main.svg)](https://hakiri.io/github/thooams/ui_bibz/main)
|
7
|
+
[![Ci](https://github.com/thooams/ui_bibz/workflows/CI/badge.svg)](https://github.com/thooams/ui_bibz/actions)
|
8
|
+
[![Linter](https://github.com/thooams/chart_bibz/workflows/Linter/badge.svg)](https://github.com/thooams/chart_bibz/actions)
|
9
|
+
[![Inline docs](http://inch-ci.org/github/thooams/ui_bibz.svg?branch=main)](http://inch-ci.org/github/thooams/ui_bibz)
|
9
10
|
|
10
11
|
This project rocks and uses MIT-LICENSE.
|
11
12
|
|
@@ -21,7 +22,7 @@ Full documentation is here with bootstrap 5:
|
|
21
22
|
[Ui Bibz v3](http://hummel.link/ui-bibz/)
|
22
23
|
|
23
24
|
Older documentation is here with bootstrap 4:
|
24
|
-
[Ui Bibz v2.5](http://hummel.link/
|
25
|
+
[Ui Bibz v2.5](http://hummel.link/ui-bibz/docs/v2.5/)
|
25
26
|
|
26
27
|
|
27
28
|
## Donate
|
data/lib/ui_bibz.rb
CHANGED
@@ -180,9 +180,11 @@ module UiBibz
|
|
180
180
|
module Notifications
|
181
181
|
autoload :Alert, 'ui_bibz/ui/core/notifications/alert'
|
182
182
|
autoload :Badge, 'ui_bibz/ui/core/notifications/badge'
|
183
|
+
autoload :Popover, 'ui_bibz/ui/core/notifications/popover'
|
183
184
|
autoload :ProgressBar, 'ui_bibz/ui/core/notifications/progress_bar'
|
184
185
|
autoload :Spinner, 'ui_bibz/ui/core/notifications/spinner'
|
185
186
|
autoload :Toast, 'ui_bibz/ui/core/notifications/toast'
|
187
|
+
autoload :Tooltip, 'ui_bibz/ui/core/notifications/tooltip'
|
186
188
|
end
|
187
189
|
|
188
190
|
module Windows
|
data/lib/ui_bibz/infos.rb
CHANGED
@@ -7,11 +7,11 @@ module UiBibz
|
|
7
7
|
DESCRIPTION = "A Rails Interface Framework using Bootstrap #{BOOTSTRAP_VERSION}."
|
8
8
|
SUMMARY = "Ui Bibz is an Ui Framework that allows you to build an interface very quickly and simply using Bootstrap #{BOOTSTRAP_VERSION}."
|
9
9
|
LICENSE = 'MIT'
|
10
|
-
FONTAWESOME_VERSION = '5.15.
|
10
|
+
FONTAWESOME_VERSION = '5.15.2'
|
11
11
|
HOMEPAGE = 'https://hummel.link/ui-bibz/'
|
12
12
|
REPO = 'git+https://github.com/thooams/ui_bibz.git'
|
13
13
|
EMAIL = 'thomas@hummel.link'
|
14
14
|
AUTHOR = 'Thooams [Thomas HUMMEL]'
|
15
|
-
VERSION = '3.0.0.
|
15
|
+
VERSION = '3.0.0.beta8'
|
16
16
|
AUTHORS = ['Thooams'].freeze
|
17
17
|
end
|
@@ -73,12 +73,12 @@ module UiBibz::Ui::Core::Forms::Dropdowns
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def button_html
|
76
|
-
content_tag :button, button_content, class: join_classes('btn', button_status, size)
|
76
|
+
content_tag :button, button_content, (options[:html_button] || {}).merge(class: join_classes('btn', button_status, size, options[:html_button].try(:[], :class)))
|
77
77
|
end
|
78
78
|
|
79
79
|
def split_html
|
80
|
-
content_tag :button, split_content, class: split_classes, type: 'button',
|
81
|
-
|
80
|
+
content_tag :button, split_content, (options[:html_split] || {}).merge(class: split_classes, type: 'button',
|
81
|
+
'data-bs-toggle' => 'dropdown', 'aria-haspopup' => true, 'aria-expanded' => false)
|
82
82
|
end
|
83
83
|
|
84
84
|
def split_content
|
@@ -86,7 +86,7 @@ module UiBibz::Ui::Core::Forms::Dropdowns
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def split_classes
|
89
|
-
join_classes('btn', button_status, size, 'dropdown-toggle', 'dropdown-toggle-split')
|
89
|
+
join_classes('btn', button_status, size, 'dropdown-toggle', 'dropdown-toggle-split', options[:split_html].try(:[], :class))
|
90
90
|
end
|
91
91
|
|
92
92
|
def src_only
|
@@ -45,19 +45,17 @@ module UiBibz::Ui::Core::Forms::Files
|
|
45
45
|
|
46
46
|
# Render html tag
|
47
47
|
def pre_render
|
48
|
-
|
49
|
-
concat file_field_tag content, class: 'form-file-input', multiple: options[:multiple], disabled: disabled?
|
50
|
-
concat label_text_and_button
|
51
|
-
end
|
48
|
+
file_field_tag content, html_options
|
52
49
|
end
|
53
50
|
|
54
51
|
private
|
55
52
|
|
56
|
-
def
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
53
|
+
def component_html_options
|
54
|
+
super.merge({
|
55
|
+
multiple: options[:multiple],
|
56
|
+
disabled: disabled?,
|
57
|
+
value: format_value(options[:input_text] || options[:value])
|
58
|
+
})
|
61
59
|
end
|
62
60
|
|
63
61
|
def format_value(value)
|
@@ -70,12 +68,8 @@ module UiBibz::Ui::Core::Forms::Files
|
|
70
68
|
value.to_s
|
71
69
|
end
|
72
70
|
|
73
|
-
def label_name
|
74
|
-
html_options[:id] || content
|
75
|
-
end
|
76
|
-
|
77
71
|
def component_html_classes
|
78
|
-
super << 'form-
|
72
|
+
super << 'form-control'
|
79
73
|
end
|
80
74
|
end
|
81
75
|
end
|
@@ -163,7 +163,7 @@ module UiBibz::Ui::Core::Navigations
|
|
163
163
|
end
|
164
164
|
|
165
165
|
def navbar_toggle_button_html
|
166
|
-
content_tag :button, '☰', class: 'navbar-toggler hidden-sm-up', type: :button, data: { "bs-toggle": 'collapse', target: "##{id}" }
|
166
|
+
content_tag :button, '☰', class: 'navbar-toggler hidden-sm-up', type: :button, data: { "bs-toggle": 'collapse', "bs-target": "##{id}" }
|
167
167
|
end
|
168
168
|
|
169
169
|
def expand_size
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module UiBibz::Ui::Core::Notifications
|
4
|
+
# Create a popover
|
5
|
+
#
|
6
|
+
# This element is an extend of UiBibz::Ui::Core::Component.
|
7
|
+
#
|
8
|
+
# ==== Attributes
|
9
|
+
#
|
10
|
+
# * +content+ - Content of element
|
11
|
+
# * +options+ - Options of element
|
12
|
+
# * +html_options+ - Html Options of element
|
13
|
+
#
|
14
|
+
# ==== Options
|
15
|
+
#
|
16
|
+
# You can add HTML attributes using the +html_options+.
|
17
|
+
# You can pass arguments in options attribute:
|
18
|
+
#
|
19
|
+
# ==== Signatures
|
20
|
+
#
|
21
|
+
# UiBibz::Ui::Core::Notifications::Popover.new(content, options = nil, html_options = nil)
|
22
|
+
#
|
23
|
+
# UiBibz::Ui::Core::Notifications::Popover.new(options = nil, html_options = nil) do
|
24
|
+
# content
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# ==== Examples
|
28
|
+
#
|
29
|
+
# UiBibz::Ui::Core::Notifications::Popover.new(class: 'my-toast').tap |t|
|
30
|
+
# t.header "My header toast", glyph: 'eye', time: 'now'
|
31
|
+
# t.body "My body toast"
|
32
|
+
# end
|
33
|
+
#
|
34
|
+
# ==== Helper
|
35
|
+
#
|
36
|
+
# popover = UiBibz::Ui::Core::Notifications::Popover.new(position: :left) do
|
37
|
+
# My content
|
38
|
+
# end
|
39
|
+
# ui_glyph("diamond", popover: popover)
|
40
|
+
#
|
41
|
+
# # or
|
42
|
+
#
|
43
|
+
# ui_glyph("diamond", {popover: true}, { title: "My content" })
|
44
|
+
#
|
45
|
+
# # or
|
46
|
+
#
|
47
|
+
# ui_glyph("diamond", popover: { title: "My content", position: :right})
|
48
|
+
#
|
49
|
+
class Popover < UiBibz::Ui::Core::Component
|
50
|
+
# Note that for security reasons the sanitize, sanitizeFn, and allowList
|
51
|
+
# options cannot be supplied using data attributes.
|
52
|
+
# https://getbootstrap.com/docs/5.0/components/popovers/#options
|
53
|
+
DATA_ATTRIBUTES = %i[animation container delay html selector
|
54
|
+
template title trigger offset fallbackPlacement
|
55
|
+
boundary customClass popperConfig].freeze
|
56
|
+
|
57
|
+
# See UiBibz::Ui::Core::Component.initialize
|
58
|
+
def initialize(content = nil, options = nil, html_options = nil, &block)
|
59
|
+
super
|
60
|
+
@content = @options[:content] if content.is_a?(Hash) && block.nil?
|
61
|
+
end
|
62
|
+
|
63
|
+
# Render html tag
|
64
|
+
def render
|
65
|
+
base_attributes.merge(data_attributes)
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def base_attributes
|
71
|
+
{
|
72
|
+
'data-bs-toggle' => 'popover',
|
73
|
+
'data-bs-content' => @content.html_safe
|
74
|
+
}.tap do |h|
|
75
|
+
h['data-bs-placement'] = options[:position] || options[:placement] if (options[:position] || options[:placement]).present?
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def data_attributes
|
80
|
+
DATA_ATTRIBUTES.map do |data_attribute|
|
81
|
+
options[data_attribute].to_s.blank? ? nil : { "data-bs-#{data_attribute}" => data_attribute_value(data_attribute) }
|
82
|
+
end.compact.reduce(&:merge) || {}
|
83
|
+
end
|
84
|
+
|
85
|
+
def data_attribute_value(data_attribute)
|
86
|
+
options[data_attribute].is_a?(String) ? options[data_attribute].html_safe : options[data_attribute]
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -25,20 +25,20 @@ module UiBibz::Ui::Core::Notifications
|
|
25
25
|
#
|
26
26
|
# ==== Signatures
|
27
27
|
#
|
28
|
-
# UiBibz::Ui::Core::Toast.new(content, options = nil, html_options = nil)
|
28
|
+
# UiBibz::Ui::Core::Notifications::Toast.new(content, options = nil, html_options = nil)
|
29
29
|
#
|
30
|
-
# UiBibz::Ui::Core::Toast.new(options = nil, html_options = nil) do
|
30
|
+
# UiBibz::Ui::Core::Notifications::Toast.new(options = nil, html_options = nil) do
|
31
31
|
# content
|
32
32
|
# end
|
33
33
|
#
|
34
34
|
# ==== Examples
|
35
35
|
#
|
36
|
-
# UiBibz::Ui::Core::Toast.new(class: 'my-toast').tap |t|
|
36
|
+
# UiBibz::Ui::Core::Notifications::Toast.new(class: 'my-toast').tap |t|
|
37
37
|
# t.header "My header toast", glyph: 'eye', time: 'now'
|
38
38
|
# t.body "My body toast"
|
39
39
|
# end
|
40
40
|
#
|
41
|
-
# UiBibz::Ui::Core::Toast.new(class: 'my-toast').tap |t|
|
41
|
+
# UiBibz::Ui::Core::Notifications::Toast.new(class: 'my-toast').tap |t|
|
42
42
|
# t.header glyph: 'eye', time: 'now' do
|
43
43
|
# My header toast
|
44
44
|
# end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module UiBibz::Ui::Core::Notifications
|
4
|
+
# Create a tooltip
|
5
|
+
#
|
6
|
+
# This element is an extend of UiBibz::Ui::Core::Component.
|
7
|
+
#
|
8
|
+
# ==== Attributes
|
9
|
+
#
|
10
|
+
# * +content+ - Content of element
|
11
|
+
# * +options+ - Options of element
|
12
|
+
# * +html_options+ - Html Options of element
|
13
|
+
#
|
14
|
+
# ==== Options
|
15
|
+
#
|
16
|
+
# You can add HTML attributes using the +html_options+.
|
17
|
+
# You can pass arguments in options attribute:
|
18
|
+
#
|
19
|
+
# ==== Signatures
|
20
|
+
#
|
21
|
+
# UiBibz::Ui::Core::Notifications::Tooltip.new(content, options = nil, html_options = nil)
|
22
|
+
#
|
23
|
+
# UiBibz::Ui::Core::Notifications::Tooltip.new(options = nil, html_options = nil) do
|
24
|
+
# content
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# ==== Examples
|
28
|
+
#
|
29
|
+
# UiBibz::Ui::Core::Notifications::Tooltip.new("My content")
|
30
|
+
#
|
31
|
+
# # or
|
32
|
+
#
|
33
|
+
# UiBibz::Ui::Core::Notifications::Tooltip.new(position: :right) do
|
34
|
+
# content
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# ==== Helper
|
38
|
+
#
|
39
|
+
# tooltip = UiBibz::Ui::Core::Notifications::Tooltip.new("My content", position: :left)
|
40
|
+
# ui_glyph("diamond", tooltip: tooltip)
|
41
|
+
#
|
42
|
+
# # or
|
43
|
+
#
|
44
|
+
# ui_glyph("diamond", {tooltip: true}, { title: "My content" })
|
45
|
+
#
|
46
|
+
# # or
|
47
|
+
#
|
48
|
+
# ui_glyph("diamond", tooltip: { title: "My content", position: :right})
|
49
|
+
#
|
50
|
+
class Tooltip < UiBibz::Ui::Core::Component
|
51
|
+
# Note that for security reasons the sanitize, sanitizeFn, and allowList
|
52
|
+
# options cannot be supplied using data attributes.
|
53
|
+
# https://getbootstrap.com/docs/5.0/components/tooltips/#options
|
54
|
+
DATA_ATTRIBUTES = %i[animation container delay html selector template trigger
|
55
|
+
fallbackPlacement boundary].freeze
|
56
|
+
|
57
|
+
# See UiBibz::Ui::Core::Component.initialize
|
58
|
+
def initialize(content = nil, options = nil, html_options = nil, &block)
|
59
|
+
super
|
60
|
+
@content = @options[:title] if content.is_a?(Hash) && block.nil?
|
61
|
+
end
|
62
|
+
|
63
|
+
# Render html tag
|
64
|
+
def render
|
65
|
+
base_attributes.merge(data_attributes)
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def base_attributes
|
71
|
+
{
|
72
|
+
'data-bs-toggle' => 'tooltip',
|
73
|
+
'data-bs-title' => @content.html_safe
|
74
|
+
}.tap do |h|
|
75
|
+
h['data-bs-placement'] = options[:position] || options[:placement] if (options[:position] || options[:placement]).present?
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def data_attributes
|
80
|
+
DATA_ATTRIBUTES.map do |data_attribute|
|
81
|
+
options[data_attribute].to_s.blank? ? nil : { "data-bs-#{data_attribute}" => data_attribute_value(data_attribute) }
|
82
|
+
end.compact.reduce(&:merge) || {}
|
83
|
+
end
|
84
|
+
|
85
|
+
def data_attribute_value(data_attribute)
|
86
|
+
options[data_attribute].is_a?(String) ? options[data_attribute].html_safe : options[data_attribute]
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -1,34 +1,37 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module PopoverExtension
|
4
|
-
TOOLTIP_METHODS = %i[animation container delay html placement selector template title trigger
|
5
|
-
offset fallback_placement boundary sanitize white_list santitize_fn].freeze
|
6
|
-
|
7
|
-
POPOVER_METHODS = %i[animation container delay html placement selector template title
|
8
|
-
trigger offset fallback_placement boundary sanitize white_list sanitize_fn].freeze
|
9
|
-
|
10
4
|
def popover_data_html
|
11
|
-
if options[:popover].
|
12
|
-
add_html_data 'bs-toggle', value: 'popover'
|
13
|
-
add_html_data 'bs-content', value: (options[:popover].is_a?(String) ? options[:popover] : options[:popover][:content])
|
14
|
-
end
|
5
|
+
return if options[:popover].nil?
|
15
6
|
|
16
|
-
|
17
|
-
|
18
|
-
POPOVER_METHODS.each { |mth| add_html_data(mth, value: options[:popover].try(:[], mth)) unless options[:popover].try(:[], mth).nil? }
|
19
|
-
add_html_data 'bs-placement', value: options[:popover].try(:[], :position) unless options[:popover].try(:[], :position).nil?
|
7
|
+
html_options.update(generate_popover.render)
|
20
8
|
end
|
21
9
|
|
22
10
|
def tooltip_data_html
|
23
11
|
return if options[:tooltip].nil?
|
24
12
|
|
25
|
-
|
13
|
+
html_options.update(generate_tooltip.render)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def generate_tooltip
|
19
|
+
case options[:tooltip].class.name
|
20
|
+
when 'UiBibz::Ui::Core::Notifications::Tooltip'
|
21
|
+
options[:tooltip]
|
22
|
+
when 'TrueClass'
|
23
|
+
UiBibz::Ui::Core::Notifications::Tooltip.new(html_options.delete(:title))
|
24
|
+
else
|
25
|
+
UiBibz::Ui::Core::Notifications::Tooltip.new(options[:tooltip])
|
26
|
+
end
|
27
|
+
end
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
def generate_popover
|
30
|
+
case options[:popover].class.name
|
31
|
+
when 'UiBibz::Ui::Core::Notifications::Popover'
|
32
|
+
options[:popover]
|
30
33
|
else
|
31
|
-
|
34
|
+
UiBibz::Ui::Core::Notifications::Popover.new(options[:popover])
|
32
35
|
end
|
33
36
|
end
|
34
37
|
end
|
data/test/simple_form_test.rb
CHANGED
@@ -202,7 +202,7 @@ test1</textarea></div></form>"
|
|
202
202
|
f.input :name_fr, as: :ui_file_field
|
203
203
|
end
|
204
204
|
|
205
|
-
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_file_field optional user_name_fr\"><label class=\"control-label ui_file_field optional\" for=\"user_name_fr\">Name fr</label><
|
205
|
+
expected = "<form class=\"simple_form edit_user\" id=\"edit_user_1\" action=\"/users/1\" accept-charset=\"UTF-8\" method=\"post\"><input type=\"hidden\" name=\"_method\" value=\"patch\" /><div class=\"form-group ui_file_field optional user_name_fr\"><label class=\"control-label ui_file_field optional\" for=\"user_name_fr\">Name fr</label><input type=\"file\" name=\"user[name_fr]\" id=\"user_name_fr\" value=\"test1\" class=\"ui_file_field optional form-control\" /></div></form>"
|
206
206
|
|
207
207
|
assert_equal expected, actual
|
208
208
|
end
|
@@ -90,22 +90,22 @@ class ButtonTest < ActionView::TestCase
|
|
90
90
|
end
|
91
91
|
|
92
92
|
test 'button with complex popover' do
|
93
|
-
actual = ui_button('My Button', popover: { content: 'My popover', position: :left })
|
94
|
-
expected =
|
93
|
+
actual = ui_button('My Button', popover: { content: 'My popover', position: :left, html: true })
|
94
|
+
expected = "<button data-bs-toggle=\"popover\" data-bs-content=\"My popover\" data-bs-placement=\"left\" data-bs-html=\"true\" class=\"btn-secondary btn\">My Button</button>"
|
95
95
|
|
96
96
|
assert_equal expected, actual
|
97
97
|
end
|
98
98
|
|
99
99
|
test 'button with simple tooltip' do
|
100
100
|
actual = ui_button('My Button', { tooltip: 'My Button' }, { title: 'My tooltip' })
|
101
|
-
expected = '<button title="My tooltip" data-bs-toggle="tooltip" data-title="My Button" class="btn-secondary btn">My Button</button>'
|
101
|
+
expected = '<button title="My tooltip" data-bs-toggle="tooltip" data-bs-title="My Button" class="btn-secondary btn">My Button</button>'
|
102
102
|
|
103
103
|
assert_equal expected, actual
|
104
104
|
end
|
105
105
|
|
106
106
|
test 'button with complex tooltip' do
|
107
107
|
actual = ui_button('My Button', tooltip: { title: 'My tooltip', position: :left })
|
108
|
-
expected = '<button data-bs-toggle="tooltip" data-title="My tooltip" data-bs-placement="left" class="btn-secondary btn">My Button</button>'
|
108
|
+
expected = '<button data-bs-toggle="tooltip" data-bs-title="My tooltip" data-bs-placement="left" class="btn-secondary btn">My Button</button>'
|
109
109
|
|
110
110
|
assert_equal expected, actual
|
111
111
|
end
|
@@ -5,7 +5,7 @@ require 'test_helper'
|
|
5
5
|
class FileFieldTest < ActionView::TestCase
|
6
6
|
test 'file_field' do
|
7
7
|
actual = UiBibz::Ui::Core::Forms::Files::FileField.new('test').render
|
8
|
-
expected = "<
|
8
|
+
expected = "<input type=\"file\" name=\"test\" id=\"test\" value=\"\" class=\"form-control\" />"
|
9
9
|
|
10
10
|
assert_equal expected, actual
|
11
11
|
end
|
@@ -4,14 +4,14 @@ require 'test_helper'
|
|
4
4
|
class NavbarTest < ActionView::TestCase
|
5
5
|
test 'Navbar' do
|
6
6
|
actual = UiBibz::Ui::Core::Navigations::Navbar.new
|
7
|
-
expected = "<nav class=\"navbar navbar-light navbar-expand-lg\"><div class=\"container\"><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-bs-toggle=\"collapse\" data-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"></div></div></nav>"
|
7
|
+
expected = "<nav class=\"navbar navbar-light navbar-expand-lg\"><div class=\"container\"><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"></div></div></nav>"
|
8
8
|
|
9
9
|
assert_equal expected, actual.render
|
10
10
|
end
|
11
11
|
|
12
12
|
test 'Navbar with options' do
|
13
13
|
actual = UiBibz::Ui::Core::Navigations::Navbar.new(title: 'Brand', expand_size: :xs, status: :primary, position: :top, brand_position: :right)
|
14
|
-
expected = "<nav class=\"bg-primary navbar navbar-light fixed-top navbar-expand-xs\"><div class=\"container\"><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-bs-toggle=\"collapse\" data-target=\"##{actual.id}\">☰</button><span class=\"navbar-brand\">Brand</span><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"></div></div></nav>"
|
14
|
+
expected = "<nav class=\"bg-primary navbar navbar-light fixed-top navbar-expand-xs\"><div class=\"container\"><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"##{actual.id}\">☰</button><span class=\"navbar-brand\">Brand</span><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"></div></div></nav>"
|
15
15
|
|
16
16
|
assert_equal expected, actual.render
|
17
17
|
end
|
@@ -30,7 +30,7 @@ class NavbarTest < ActionView::TestCase
|
|
30
30
|
end
|
31
31
|
nb.text 'test'
|
32
32
|
end
|
33
|
-
expected = "<nav class=\"navbar navbar-light navbar-expand-lg\"><div class=\"container\"><span class=\"navbar-brand\">Brand</span><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-bs-toggle=\"collapse\" data-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"><ul class=\"navbar-nav\"><li class=\"nav-item\"><a href=\"#Home\" class=\"active nav-link\">Home</a></li><li class=\"nav-item\"><a href=\"#profile\" class=\"nav-link\">Profile</a></li><li class=\"nav-item\"><a href=\"#messages\" class=\"nav-link\">Messages</a></li></ul><form type=\"form_tag\" position=\"right\" class=\"d-flex\" action=\"#\" accept-charset=\"UTF-8\" method=\"post\"><button class=\"btn-secondary btn\">Search</button></form><span class=\"navbar-text\">test</span></div></div></nav>"
|
33
|
+
expected = "<nav class=\"navbar navbar-light navbar-expand-lg\"><div class=\"container\"><span class=\"navbar-brand\">Brand</span><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"><ul class=\"navbar-nav\"><li class=\"nav-item\"><a href=\"#Home\" class=\"active nav-link\">Home</a></li><li class=\"nav-item\"><a href=\"#profile\" class=\"nav-link\">Profile</a></li><li class=\"nav-item\"><a href=\"#messages\" class=\"nav-link\">Messages</a></li></ul><form type=\"form_tag\" position=\"right\" class=\"d-flex\" action=\"#\" accept-charset=\"UTF-8\" method=\"post\"><button class=\"btn-secondary btn\">Search</button></form><span class=\"navbar-text\">test</span></div></div></nav>"
|
34
34
|
|
35
35
|
assert_equal expected, actual.render
|
36
36
|
end
|
@@ -43,7 +43,7 @@ class NavbarTest < ActionView::TestCase
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
expected =
|
46
|
-
"<nav class=\"bg-dark navbar navbar-dark navbar-expand-lg\"><div class=\"container\"><span class=\"navbar-brand\"><img src=\"/images/ruby-white\" /></span><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-bs-toggle=\"collapse\" data-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"><ul class=\"navbar-nav\"><li class=\"nav-item\"><a href=\"#link\" class=\"nav-link\">Link</a></li></ul></div></div></nav>"
|
46
|
+
"<nav class=\"bg-dark navbar navbar-dark navbar-expand-lg\"><div class=\"container\"><span class=\"navbar-brand\"><img src=\"/images/ruby-white\" /></span><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"##{actual.id}\">☰</button><div class=\"navbar-collapse collapse\" id=\"#{actual.id}\"><ul class=\"navbar-nav\"><li class=\"nav-item\"><a href=\"#link\" class=\"nav-link\">Link</a></li></ul></div></div></nav>"
|
47
47
|
|
48
48
|
assert_equal expected, actual.render
|
49
49
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
class PopoverTest < ActionView::TestCase
|
5
|
+
setup do
|
6
|
+
@parameters = { animation: true, container: "body", position: :left,
|
7
|
+
delay: 10, html: true, selector: false, template: "<b>",
|
8
|
+
trigger: "hover focus", fallbackPlacement: %w[top right],
|
9
|
+
boundary: 'clippingParents', title: "My title", offset: 2,
|
10
|
+
customClass: "test", popperConfig: "Mystring" }
|
11
|
+
end
|
12
|
+
|
13
|
+
test 'popover by hash' do
|
14
|
+
actual = UiBibz::Ui::Core::Notifications::Popover.new(@parameters.merge(content: "My Content")).render
|
15
|
+
expected = { "data-bs-toggle" => "popover", "data-bs-content" => "My Content", "data-bs-placement" => :left, "data-bs-animation" => true, "data-bs-container" => "body", "data-bs-delay" => 10, "data-bs-html" => true, "data-bs-selector" => false, "data-bs-template" => "<b>", "data-bs-title" => "My title", "data-bs-trigger" => "hover focus", "data-bs-offset" => 2, "data-bs-fallbackPlacement" => %w[top right], "data-bs-boundary" => "clippingParents", "data-bs-customClass" => "test", "data-bs-popperConfig" => "Mystring" }
|
16
|
+
|
17
|
+
assert_equal expected, actual
|
18
|
+
end
|
19
|
+
|
20
|
+
test 'popover with content and options' do
|
21
|
+
actual = UiBibz::Ui::Core::Notifications::Popover.new("My Content", @parameters).render
|
22
|
+
|
23
|
+
expected = { "data-bs-toggle" => "popover", "data-bs-content" => "My Content", "data-bs-placement" => :left, "data-bs-animation" => true, "data-bs-container" => "body", "data-bs-delay" => 10, "data-bs-html" => true, "data-bs-selector" => false, "data-bs-template" => "<b>", "data-bs-title" => "My title", "data-bs-trigger" => "hover focus", "data-bs-offset" => 2, "data-bs-fallbackPlacement" => %w[top right], "data-bs-boundary" => "clippingParents", "data-bs-customClass" => "test", "data-bs-popperConfig" => "Mystring" }
|
24
|
+
|
25
|
+
assert_equal expected, actual
|
26
|
+
end
|
27
|
+
|
28
|
+
test 'popover with block and options' do
|
29
|
+
actual = UiBibz::Ui::Core::Notifications::Popover.new(@parameters) do
|
30
|
+
"My Content"
|
31
|
+
end.render
|
32
|
+
|
33
|
+
expected = { "data-bs-toggle" => "popover", "data-bs-content" => "My Content", "data-bs-placement" => :left, "data-bs-animation" => true, "data-bs-container" => "body", "data-bs-delay" => 10, "data-bs-html" => true, "data-bs-selector" => false, "data-bs-template" => "<b>", "data-bs-title" => "My title", "data-bs-trigger" => "hover focus", "data-bs-offset" => 2, "data-bs-fallbackPlacement" => %w[top right], "data-bs-boundary" => "clippingParents", "data-bs-customClass" => "test", "data-bs-popperConfig" => "Mystring" }
|
34
|
+
|
35
|
+
assert_equal expected, actual
|
36
|
+
end
|
37
|
+
|
38
|
+
test 'glyph with popover object' do
|
39
|
+
popover = UiBibz::Ui::Core::Notifications::Popover.new(@parameters.merge(content: "My Content"))
|
40
|
+
actual = UiBibz::Ui::Core::Icons::Glyph.new("diamond", popover: popover).render
|
41
|
+
expected = "<i data-bs-toggle=\"popover\" data-bs-content=\"My Content\" data-bs-placement=\"left\" data-bs-animation=\"true\" data-bs-container=\"body\" data-bs-delay=\"10\" data-bs-html=\"true\" data-bs-selector=\"false\" data-bs-template=\"<b>\" data-bs-title=\"My title\" data-bs-trigger=\"hover focus\" data-bs-offset=\"2\" data-bs-fallbackPlacement=\"top right\" data-bs-boundary=\"clippingParents\" data-bs-customClass=\"test\" data-bs-popperConfig=\"Mystring\" class=\"glyph fas fa-diamond\"></i>"
|
42
|
+
|
43
|
+
assert_equal expected, actual
|
44
|
+
end
|
45
|
+
|
46
|
+
test 'glyph with popover hash' do
|
47
|
+
actual = UiBibz::Ui::Core::Icons::Glyph.new("diamond", popover: @parameters.merge(content: "My Content")).render
|
48
|
+
expected = "<i data-bs-toggle=\"popover\" data-bs-content=\"My Content\" data-bs-placement=\"left\" data-bs-animation=\"true\" data-bs-container=\"body\" data-bs-delay=\"10\" data-bs-html=\"true\" data-bs-selector=\"false\" data-bs-template=\"<b>\" data-bs-title=\"My title\" data-bs-trigger=\"hover focus\" data-bs-offset=\"2\" data-bs-fallbackPlacement=\"top right\" data-bs-boundary=\"clippingParents\" data-bs-customClass=\"test\" data-bs-popperConfig=\"Mystring\" class=\"glyph fas fa-diamond\"></i>"
|
49
|
+
|
50
|
+
assert_equal expected, actual
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
class TooltipTest < ActionView::TestCase
|
5
|
+
setup do
|
6
|
+
@parameters = { animation: true, container: "body", position: :left,
|
7
|
+
delay: 10, html: true, selector: false, template: "<b>",
|
8
|
+
trigger: "hover focus", fallbackPlacement: %w[top right],
|
9
|
+
boundary: 'clippingParents' }
|
10
|
+
end
|
11
|
+
|
12
|
+
test 'tooltip by hash' do
|
13
|
+
actual = UiBibz::Ui::Core::Notifications::Tooltip.new(@parameters.merge(title: "My Title")).render
|
14
|
+
expected = { "data-bs-toggle" => "tooltip", "data-bs-title" => "My Title", "data-bs-placement" => :left, "data-bs-animation" => true, "data-bs-container" => "body", "data-bs-delay" => 10, "data-bs-html" => true, "data-bs-selector" => false, "data-bs-template" => "<b>", "data-bs-trigger" => "hover focus", "data-bs-fallbackPlacement" => %w[top right], "data-bs-boundary" => "clippingParents" }
|
15
|
+
|
16
|
+
assert_equal expected, actual
|
17
|
+
end
|
18
|
+
|
19
|
+
test 'tooltip with content and options' do
|
20
|
+
actual = UiBibz::Ui::Core::Notifications::Tooltip.new("My Title", @parameters).render
|
21
|
+
|
22
|
+
expected = { "data-bs-toggle" => "tooltip", "data-bs-title" => "My Title", "data-bs-placement" => :left, "data-bs-animation" => true, "data-bs-container" => "body", "data-bs-delay" => 10, "data-bs-html" => true, "data-bs-selector" => false, "data-bs-template" => "<b>", "data-bs-trigger" => "hover focus", "data-bs-fallbackPlacement" => %w[top right], "data-bs-boundary" => "clippingParents" }
|
23
|
+
|
24
|
+
assert_equal expected, actual
|
25
|
+
end
|
26
|
+
|
27
|
+
test 'tooltip with block and options' do
|
28
|
+
actual = UiBibz::Ui::Core::Notifications::Tooltip.new(@parameters) do
|
29
|
+
"My Title"
|
30
|
+
end.render
|
31
|
+
|
32
|
+
expected = { "data-bs-toggle" => "tooltip", "data-bs-title" => "My Title", "data-bs-placement" => :left, "data-bs-animation" => true, "data-bs-container" => "body", "data-bs-delay" => 10, "data-bs-html" => true, "data-bs-selector" => false, "data-bs-template" => "<b>", "data-bs-trigger" => "hover focus", "data-bs-fallbackPlacement" => %w[top right], "data-bs-boundary" => "clippingParents" }
|
33
|
+
|
34
|
+
assert_equal expected, actual
|
35
|
+
end
|
36
|
+
|
37
|
+
test 'glyph with tooltip object' do
|
38
|
+
tooltip = UiBibz::Ui::Core::Notifications::Tooltip.new(@parameters.merge(title: "My Title"))
|
39
|
+
actual = UiBibz::Ui::Core::Icons::Glyph.new("diamond", tooltip: tooltip).render
|
40
|
+
expected = "<i data-bs-toggle=\"tooltip\" data-bs-title=\"My Title\" data-bs-placement=\"left\" data-bs-animation=\"true\" data-bs-container=\"body\" data-bs-delay=\"10\" data-bs-html=\"true\" data-bs-selector=\"false\" data-bs-template=\"<b>\" data-bs-trigger=\"hover focus\" data-bs-fallbackPlacement=\"top right\" data-bs-boundary=\"clippingParents\" class=\"glyph fas fa-diamond\"></i>"
|
41
|
+
|
42
|
+
assert_equal expected, actual
|
43
|
+
end
|
44
|
+
|
45
|
+
test 'glyph with tooltip hash' do
|
46
|
+
actual = UiBibz::Ui::Core::Icons::Glyph.new("diamond", tooltip: @parameters.merge(title: "My Title")).render
|
47
|
+
expected = "<i data-bs-toggle=\"tooltip\" data-bs-title=\"My Title\" data-bs-placement=\"left\" data-bs-animation=\"true\" data-bs-container=\"body\" data-bs-delay=\"10\" data-bs-html=\"true\" data-bs-selector=\"false\" data-bs-template=\"<b>\" data-bs-trigger=\"hover focus\" data-bs-fallbackPlacement=\"top right\" data-bs-boundary=\"clippingParents\" class=\"glyph fas fa-diamond\"></i>"
|
48
|
+
|
49
|
+
assert_equal expected, actual
|
50
|
+
end
|
51
|
+
|
52
|
+
test 'glyph with tooltip boolean' do
|
53
|
+
actual = UiBibz::Ui::Core::Icons::Glyph.new("diamond", { tooltip: true }, { title: "My Title" }).render
|
54
|
+
expected = "<i data-bs-toggle=\"tooltip\" data-bs-title=\"My Title\" class=\"glyph fas fa-diamond\"></i>"
|
55
|
+
|
56
|
+
assert_equal expected, actual
|
57
|
+
end
|
58
|
+
end
|
data/ui_bibz.gemspec
CHANGED
@@ -30,12 +30,11 @@ Gem::Specification.new do |s|
|
|
30
30
|
s.add_development_dependency 'rails', '~> 6.0.3', '>= 6.0.3.2'
|
31
31
|
|
32
32
|
# Remove these dependencies after
|
33
|
-
s.add_dependency 'will_paginate', '~> 3.
|
33
|
+
s.add_dependency 'will_paginate', '~> 3.3.0'
|
34
34
|
s.add_dependency 'will_paginate-bootstrap4'
|
35
35
|
s.add_dependency 'will-paginate-i18n'
|
36
36
|
|
37
37
|
# Development gems
|
38
|
-
s.add_development_dependency 'codeclimate-test-reporter'
|
39
38
|
s.add_development_dependency 'factory_bot_rails', '~> 4.0'
|
40
39
|
s.add_development_dependency 'haml-rails'
|
41
40
|
s.add_development_dependency 'minitest'
|
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: 3.0.0.
|
4
|
+
version: 3.0.0.beta8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thooams [Thomas HUMMEL]
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 3.
|
39
|
+
version: 3.3.0
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 3.
|
46
|
+
version: 3.3.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: will_paginate-bootstrap4
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,20 +72,6 @@ dependencies:
|
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: codeclimate-test-reporter
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - ">="
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '0'
|
82
|
-
type: :development
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - ">="
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '0'
|
89
75
|
- !ruby/object:Gem::Dependency
|
90
76
|
name: factory_bot_rails
|
91
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -261,9 +247,10 @@ executables:
|
|
261
247
|
extensions: []
|
262
248
|
extra_rdoc_files: []
|
263
249
|
files:
|
264
|
-
- ".codeclimate.yml"
|
265
250
|
- ".github/FUNDING.yml"
|
266
251
|
- ".github/workflows/ci.yml"
|
252
|
+
- ".github/workflows/dependencies-checker.yml"
|
253
|
+
- ".github/workflows/linter.yml"
|
267
254
|
- ".gitignore"
|
268
255
|
- ".gitlab-ci.yml"
|
269
256
|
- ".overcommit.yml"
|
@@ -424,9 +411,11 @@ files:
|
|
424
411
|
- lib/ui_bibz/ui/core/notifications/components/bar.rb
|
425
412
|
- lib/ui_bibz/ui/core/notifications/components/toast_body.rb
|
426
413
|
- lib/ui_bibz/ui/core/notifications/components/toast_header.rb
|
414
|
+
- lib/ui_bibz/ui/core/notifications/popover.rb
|
427
415
|
- lib/ui_bibz/ui/core/notifications/progress_bar.rb
|
428
416
|
- lib/ui_bibz/ui/core/notifications/spinner.rb
|
429
417
|
- lib/ui_bibz/ui/core/notifications/toast.rb
|
418
|
+
- lib/ui_bibz/ui/core/notifications/tooltip.rb
|
430
419
|
- lib/ui_bibz/ui/core/windows/components/modal_body.rb
|
431
420
|
- lib/ui_bibz/ui/core/windows/components/modal_footer.rb
|
432
421
|
- lib/ui_bibz/ui/core/windows/components/modal_header.rb
|
@@ -577,9 +566,11 @@ files:
|
|
577
566
|
- test/ui/core/navigations/toolbar_test.rb
|
578
567
|
- test/ui/core/notifications/alert_test.rb
|
579
568
|
- test/ui/core/notifications/badge_test.rb
|
569
|
+
- test/ui/core/notifications/popover_test.rb
|
580
570
|
- test/ui/core/notifications/progress_bar_test.rb
|
581
571
|
- test/ui/core/notifications/spinner_test.rb
|
582
572
|
- test/ui/core/notifications/toast_test.rb
|
573
|
+
- test/ui/core/notifications/tooltip_test.rb
|
583
574
|
- test/ui/core/windows/modal_test.rb
|
584
575
|
- test/ui/utils/breakdown_class_name_generator_test.rb
|
585
576
|
- test/ui/ux/containers/panel_test.rb
|
@@ -787,9 +778,11 @@ test_files:
|
|
787
778
|
- test/ui/core/navigations/toolbar_test.rb
|
788
779
|
- test/ui/core/notifications/alert_test.rb
|
789
780
|
- test/ui/core/notifications/badge_test.rb
|
781
|
+
- test/ui/core/notifications/popover_test.rb
|
790
782
|
- test/ui/core/notifications/progress_bar_test.rb
|
791
783
|
- test/ui/core/notifications/spinner_test.rb
|
792
784
|
- test/ui/core/notifications/toast_test.rb
|
785
|
+
- test/ui/core/notifications/tooltip_test.rb
|
793
786
|
- test/ui/core/windows/modal_test.rb
|
794
787
|
- test/ui/utils/breakdown_class_name_generator_test.rb
|
795
788
|
- test/ui/ux/containers/panel_test.rb
|