ui_bibz 3.0.0.beta8 → 3.0.0.beta9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d3e72f23a91692fcd9919939cac116b0434333c8597b11dcef0f7b8cb766d87
4
- data.tar.gz: f3b225819371ddbe82c9f2f3c84388f4e2fed1edce822e539e649e761f6224b8
3
+ metadata.gz: c8d466ecd1eb2df599e88385a30722ff0c1431632835d9b857f1281fa65a588d
4
+ data.tar.gz: 8db65e1c63a6c60460c7514226c29a42eb4b7664a68764356375464ac3532623
5
5
  SHA512:
6
- metadata.gz: ff3ce0988337055522cfb625287a83104691d0931219c76763e8014b0e8775496fa21312721896bc3fed30b26473f058abf2f3f7f87ea3d9cb7a19bf94409f14
7
- data.tar.gz: 64cdd3c257b47403e4ebf83ab47fb56b3c0f73136a1d4db0fbbf300925b32999b374c6054271bba50bca2b0b7da0dc37db1d9c21178c718397d1f7d6fd110ae5
6
+ metadata.gz: 5964c0dfe3a5302d8a5bcb5554da38ee0d7bfc59672b83a72b2ecef238e14c384a627f784c06d237a36a8067f4f63246eb772d367f26259a11af53071949b7f7
7
+ data.tar.gz: dc8f4393860f273950ed96efcdcb5bc57d38c3053636da293d2087323e9a57cafeecbaaaf80c8db32c1682b89b339f544191faed9bc67e459ec38ffb49f29d79
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ui_bibz (3.0.0.beta8)
4
+ ui_bibz (3.0.0.beta9)
5
5
  will-paginate-i18n
6
6
  will_paginate (~> 3.3.0)
7
7
  will_paginate-bootstrap4
@@ -114,7 +114,7 @@ GEM
114
114
  mini_mime (1.0.2)
115
115
  mini_portile2 (2.5.0)
116
116
  minitest (5.14.3)
117
- nio4r (2.5.4)
117
+ nio4r (2.5.5)
118
118
  nokogiri (1.11.1)
119
119
  mini_portile2 (~> 2.5.0)
120
120
  racc (~> 1.4)
data/lib/ui_bibz/infos.rb CHANGED
@@ -12,6 +12,6 @@ module UiBibz
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.beta8'
15
+ VERSION = '3.0.0.beta9'
16
16
  AUTHORS = ['Thooams'].freeze
17
17
  end
@@ -1,12 +1,44 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PopoverExtension
4
+ # Add popover to a component
5
+ #
6
+ # By tooltip object
7
+ #
8
+ # popover = UiBibz::Ui::Core::Notifications::Popover.new("My Popover")
9
+ # UiBibz::Ui::Core::Component.new("My content", popover: popover)
10
+ #
11
+ # By Hash
12
+ #
13
+ # UiBibz::Ui::Core::Component.new("My content", popover: { content: "My Popover" })
14
+ #
15
+ # By String
16
+ #
17
+ # UiBibz::Ui::Core::Component.new("My content", popover: "My Popover")
18
+ #
4
19
  def popover_data_html
5
20
  return if options[:popover].nil?
6
21
 
7
22
  html_options.update(generate_popover.render)
8
23
  end
9
24
 
25
+ # Add tooltip to a component
26
+ #
27
+ # By tooltip object
28
+ #
29
+ # tooltip = UiBibz::Ui::Core::Notifications::Tooltip.new("My tooltip")
30
+ # UiBibz::Ui::Core::Component.new("My content", tooltip: tooltip)
31
+ #
32
+ # By Boolean
33
+ #
34
+ # UiBibz::Ui::Core::Component.new("My content", tooltip: true)
35
+ # # or
36
+ # UiBibz::Ui::Core::Component.new("My content", {tooltip: true}, { title: 'My tooltip' })
37
+ #
38
+ # By Hash
39
+ #
40
+ # UiBibz::Ui::Core::Component.new("My content", tooltip: { title: 'My tooltip' })
41
+ #
10
42
  def tooltip_data_html
11
43
  return if options[:tooltip].nil?
12
44
 
@@ -20,7 +52,8 @@ module PopoverExtension
20
52
  when 'UiBibz::Ui::Core::Notifications::Tooltip'
21
53
  options[:tooltip]
22
54
  when 'TrueClass'
23
- UiBibz::Ui::Core::Notifications::Tooltip.new(html_options.delete(:title))
55
+ tooltip_content = html_options.delete(:title) || (sanitize_text(content) if options[:text] == false)
56
+ UiBibz::Ui::Core::Notifications::Tooltip.new(tooltip_content)
24
57
  else
25
58
  UiBibz::Ui::Core::Notifications::Tooltip.new(options[:tooltip])
26
59
  end
@@ -49,4 +49,11 @@ class PopoverTest < ActionView::TestCase
49
49
 
50
50
  assert_equal expected, actual
51
51
  end
52
+
53
+ test 'glyph with popover String' do
54
+ actual = UiBibz::Ui::Core::Icons::Glyph.new("diamond", popover: "My Content").render
55
+ expected = "<i data-bs-toggle=\"popover\" data-bs-content=\"My Content\" class=\"glyph fas fa-diamond\"></i>"
56
+
57
+ assert_equal expected, actual
58
+ end
52
59
  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: 3.0.0.beta8
4
+ version: 3.0.0.beta9
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-02-05 00:00:00.000000000 Z
11
+ date: 2021-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails