ui_bibz 2.0.0.beta2.5 → 2.0.0.beta2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +4 -4
  3. data/app/assets/javascripts/interface.coffee +1 -1
  4. data/app/inputs/ui_bibz_inputs/{ui_button_choices_input.rb → ui_choice_group_input.rb} +3 -3
  5. data/lib/ui_bibz.rb +28 -29
  6. data/lib/ui_bibz/helpers/ui/core/{cards_helper.rb → boxes_helper.rb} +14 -6
  7. data/lib/ui_bibz/helpers/ui/core/forms_helper.rb +20 -11
  8. data/lib/ui_bibz/helpers/ui/core/icons_helper.rb +24 -0
  9. data/lib/ui_bibz/helpers/ui/core/lists_helper.rb +11 -0
  10. data/lib/ui_bibz/helpers/ui/core/navigations_helper.rb +64 -0
  11. data/lib/ui_bibz/helpers/ui/core/notifications_helper.rb +43 -0
  12. data/lib/ui_bibz/helpers/ui/core_helper.rb +8 -79
  13. data/lib/ui_bibz/ui/core/{cards → boxes}/card.rb +19 -19
  14. data/lib/ui_bibz/ui/core/{cards → boxes}/card_column.rb +6 -6
  15. data/lib/ui_bibz/ui/core/{cards → boxes}/card_deck.rb +6 -6
  16. data/lib/ui_bibz/ui/core/{cards → boxes}/card_group.rb +6 -6
  17. data/lib/ui_bibz/ui/core/{cards → boxes}/components/body/card_body_link.rb +5 -5
  18. data/lib/ui_bibz/ui/core/{cards → boxes}/components/body/card_body_text.rb +5 -5
  19. data/lib/ui_bibz/ui/core/{cards → boxes}/components/body/card_body_title.rb +5 -5
  20. data/lib/ui_bibz/ui/core/{cards → boxes}/components/card_body.rb +11 -11
  21. data/lib/ui_bibz/ui/core/{cards → boxes}/components/card_footer.rb +5 -5
  22. data/lib/ui_bibz/ui/core/{cards → boxes}/components/card_header.rb +5 -5
  23. data/lib/ui_bibz/ui/core/{cards → boxes}/components/card_image.rb +5 -5
  24. data/lib/ui_bibz/ui/core/{cards → boxes}/components/card_list_group.rb +5 -5
  25. data/lib/ui_bibz/ui/core/{jumbotron.rb → boxes/jumbotron.rb} +6 -6
  26. data/lib/ui_bibz/ui/core/forms/buttons/button.rb +8 -3
  27. data/lib/ui_bibz/ui/core/forms/buttons/button_choice.rb +3 -3
  28. data/lib/ui_bibz/ui/core/forms/buttons/button_group.rb +1 -6
  29. data/lib/ui_bibz/ui/core/forms/buttons/components/button_group_dropdown.rb +1 -1
  30. data/lib/ui_bibz/ui/core/forms/choices/choice_group.rb +81 -0
  31. data/lib/ui_bibz/ui/core/forms/{buttons → choices}/components/choice.rb +11 -18
  32. data/lib/ui_bibz/ui/core/{dropdowns → forms/dropdowns}/components/dropdown_divider.rb +1 -1
  33. data/lib/ui_bibz/ui/core/{dropdowns → forms/dropdowns}/components/dropdown_header.rb +5 -5
  34. data/lib/ui_bibz/ui/core/{dropdowns → forms/dropdowns}/components/dropdown_link.rb +5 -5
  35. data/lib/ui_bibz/ui/core/{dropdowns → forms/dropdowns}/dropdown.rb +12 -12
  36. data/lib/ui_bibz/ui/core/{dropdowns → forms/dropdowns}/split_dropdown.rb +6 -6
  37. data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +1 -1
  38. data/lib/ui_bibz/ui/core/forms/selects/multi_select_field.rb +8 -3
  39. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_dropdown.rb +1 -1
  40. data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +1 -1
  41. data/lib/ui_bibz/ui/core/{glyph.rb → icons/glyph.rb} +10 -10
  42. data/lib/ui_bibz/ui/core/{star.rb → icons/star.rb} +6 -6
  43. data/lib/ui_bibz/ui/core/lists/components/list.rb +2 -2
  44. data/lib/ui_bibz/ui/core/{breadcrumb.rb → navigations/breadcrumb.rb} +8 -12
  45. data/lib/ui_bibz/ui/core/{paths → navigations}/components/breadcrumb_link.rb +5 -5
  46. data/lib/ui_bibz/ui/core/{navs → navigations}/components/nav_dropdown.rb +5 -5
  47. data/lib/ui_bibz/ui/core/navigations/components/nav_link.rb +68 -0
  48. data/lib/ui_bibz/ui/core/{navs → navigations}/components/nav_link_link.rb +1 -1
  49. data/lib/ui_bibz/ui/core/{navs → navigations}/components/nav_link_list.rb +1 -1
  50. data/lib/ui_bibz/ui/core/navigations/components/nav_text.rb +50 -0
  51. data/lib/ui_bibz/ui/core/{navs → navigations}/components/navbar_brand.rb +1 -1
  52. data/lib/ui_bibz/ui/core/{navs → navigations}/components/navbar_form.rb +4 -4
  53. data/lib/ui_bibz/ui/core/{navs → navigations}/components/navbar_nav.rb +7 -7
  54. data/lib/ui_bibz/ui/core/{navs → navigations}/components/navbar_text.rb +5 -5
  55. data/lib/ui_bibz/ui/core/{navs → navigations}/components/pagination_link.rb +6 -6
  56. data/lib/ui_bibz/ui/core/navigations/link.rb +54 -0
  57. data/lib/ui_bibz/ui/core/{navs → navigations}/nav.rb +24 -13
  58. data/lib/ui_bibz/ui/core/{navs → navigations}/navbar.rb +9 -9
  59. data/lib/ui_bibz/ui/core/{navs → navigations}/pagination.rb +6 -6
  60. data/lib/ui_bibz/ui/core/navigations/tab_group.rb +82 -0
  61. data/lib/ui_bibz/ui/core/{forms/buttons/button_toolbar.rb → navigations/toolbar.rb} +12 -8
  62. data/lib/ui_bibz/ui/core/{badge.rb → notifications/badge.rb} +8 -9
  63. data/lib/ui_bibz/ui/core/{progresses → notifications}/components/bar.rb +6 -6
  64. data/lib/ui_bibz/ui/core/{progresses → notifications}/progress_bar.rb +11 -11
  65. data/lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb +1 -1
  66. data/lib/ui_bibz/ui/extensions/core/component/klass_extension.rb +18 -2
  67. data/lib/ui_bibz/ui/ux/tables/components/actions.rb +9 -9
  68. data/lib/ui_bibz/ui/ux/tables/components/as.rb +2 -2
  69. data/lib/ui_bibz/ui/ux/tables/extensions/actionable.rb +1 -1
  70. data/lib/ui_bibz/ui/ux/tables/extensions/searchable.rb +1 -1
  71. data/lib/ui_bibz/ui/ux/tables/extensions/sortable.rb +1 -1
  72. data/lib/ui_bibz/ui/ux/tables/table_card.rb +3 -3
  73. data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +4 -4
  74. data/lib/ui_bibz/utils/screwdriver.rb +10 -1
  75. data/lib/ui_bibz/version.rb +1 -1
  76. data/structure.md +64 -0
  77. data/test/ui/core/{cards → boxes}/card_test.rb +0 -0
  78. data/test/ui/core/{jumbotron_test.rb → boxes/jumbotron_test.rb} +0 -0
  79. data/test/ui/core/forms/buttons/button_test.rb +1 -1
  80. data/test/ui/core/forms/choices/choice_group_test.rb +36 -0
  81. data/test/ui/core/{dropdowns → forms/dropdowns}/dropdown_test.rb +5 -5
  82. data/test/ui/core/forms/selects/multi_select_field_test.rb +2 -2
  83. data/test/ui/core/{glyph_test.rb → icons/glyph_test.rb} +0 -0
  84. data/test/ui/core/{star_test.rb → icons/star_test.rb} +0 -0
  85. data/test/ui/core/{paths → navigations}/breadcrumb_test.rb +0 -0
  86. data/test/ui/core/{navs → navigations}/nav_test.rb +0 -0
  87. data/test/ui/core/{navs → navigations}/navbar_test.rb +4 -4
  88. data/test/ui/core/navigations/pagination_test.rb +38 -0
  89. data/test/ui/core/navigations/tab_group_test.rb +49 -0
  90. data/test/ui/core/navigations/toolbar_test.rb +31 -0
  91. data/test/ui/core/{badge_test.rb → notifications/badge_test.rb} +0 -0
  92. data/test/ui/core/{progress_test.rb → notifications/progress_bar_test.rb} +1 -1
  93. metadata +79 -69
  94. data/lib/ui_bibz/helpers/ui/core/dropdowns_helper.rb +0 -21
  95. data/lib/ui_bibz/helpers/ui/core/navs_helper.rb +0 -27
  96. data/lib/ui_bibz/helpers/ui/core/paths_helper.rb +0 -16
  97. data/lib/ui_bibz/ui/core/navs/components/nav_link.rb +0 -60
  98. data/lib/ui_bibz/ui/core/paths/breadcrumb.rb +0 -109
  99. data/test/ui/core/forms/buttons/button_choice_test.rb +0 -36
@@ -1,4 +1,4 @@
1
- module UiBibz::Ui::Core::Navs
1
+ module UiBibz::Ui::Core::Navigations
2
2
 
3
3
  # Create a NavbarText
4
4
  #
@@ -17,17 +17,17 @@ module UiBibz::Ui::Core::Navs
17
17
  #
18
18
  # ==== Signatures
19
19
  #
20
- # UiBibz::Ui::Core::Navs::NavbarText.new(content, options = nil, html_options = nil)
20
+ # UiBibz::Ui::Core::Navigations::NavbarText.new(content, options = nil, html_options = nil)
21
21
  #
22
- # UiBibz::Ui::Core::Navs::NavbarText.new(options = nil, html_options = nil) do
22
+ # UiBibz::Ui::Core::Navigations::NavbarText.new(options = nil, html_options = nil) do
23
23
  # content
24
24
  # end
25
25
  #
26
26
  # ==== Examples
27
27
  #
28
- # UiBibz::Ui::Core::Navs::NavbarText.new('Exemple).render
28
+ # UiBibz::Ui::Core::Navigations::NavbarText.new('Exemple).render
29
29
  #
30
- # UiBibz::Ui::Core::Navs::NavbarText.new(position: :right) do
30
+ # UiBibz::Ui::Core::Navigations::NavbarText.new(position: :right) do
31
31
  # 'Exemple'
32
32
  # end.render
33
33
  #
@@ -1,8 +1,8 @@
1
- module UiBibz::Ui::Core::Navs
1
+ module UiBibz::Ui::Core::Navigations
2
2
 
3
3
  # Create a PageLink
4
4
  #
5
- # This element is an extend of UiBibz::Ui::Core::Navs::Component.
5
+ # This element is an extend of UiBibz::Ui::Core::Navigations::Component.
6
6
  #
7
7
  # ==== Attributes
8
8
  #
@@ -22,17 +22,17 @@ module UiBibz::Ui::Core::Navs
22
22
  #
23
23
  # ==== Signatures
24
24
  #
25
- # UiBibz::Ui::Core::Navs::PageLink.new(content, options = nil, html_options = nil)
25
+ # UiBibz::Ui::Core::Navigations::PageLink.new(content, options = nil, html_options = nil)
26
26
  #
27
- # UiBibz::Ui::Core::Navs::PageLink.new(options = nil, html_options = nil) do
27
+ # UiBibz::Ui::Core::Navigations::PageLink.new(options = nil, html_options = nil) do
28
28
  # content
29
29
  # end
30
30
  #
31
31
  # ==== Examples
32
32
  #
33
- # UiBibz::Ui::Core::Navs::PageLink.new(content, { badge: 15, url: '/', state: :active, link_html_options: { class: 'link1' }},{ class: 'test' }).render
33
+ # UiBibz::Ui::Core::Navigations::PageLink.new(content, { badge: 15, url: '/', state: :active, link_html_options: { class: 'link1' }},{ class: 'test' }).render
34
34
  #
35
- # UiBibz::Ui::Core::Navs::PageLink.new({glyph: { name: 'eye', size: 3 }, { class: 'test' }) do
35
+ # UiBibz::Ui::Core::Navigations::PageLink.new({glyph: { name: 'eye', size: 3 }, { class: 'test' }) do
36
36
  # 'Home'
37
37
  # end.render
38
38
  #
@@ -0,0 +1,54 @@
1
+ module UiBibz::Ui::Core::Navigations
2
+
3
+ # Create a Link
4
+ #
5
+ # This element is an extend of UiBibz::Ui::Core::Component.
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
+ # * +state+ - status of élement with symbol value:
18
+ # (+:active+)
19
+ # * +url+ - String
20
+ # * +glyph+ - Add glyph with name or hash options
21
+ # * +name+ - String
22
+ # * +size+ - Integer
23
+ # * +type+ - Symbol
24
+ #
25
+ # ==== Signatures
26
+ #
27
+ # UiBibz::Ui::Core::Navigations::Link.new(content, options = nil, html_options = nil)
28
+ #
29
+ # UiBibz::Ui::Core::Navigations::Link.new(options = nil, html_options = nil) do
30
+ # content
31
+ # end
32
+ #
33
+ # ==== Examples
34
+ #
35
+ # UiBibz::Ui::Core::Navigations::Link.new('Home', { glyph: 'home', url: '#url', state: :active },{ class: 'test' }).render
36
+ #
37
+ # UiBibz::Ui::Core::Navigations::Link.new({ url: '#url', glyph: { name: 'eye', size: 3}}, { class: 'test' }) do
38
+ # 'Home'
39
+ # end.render
40
+ #
41
+ class Link < UiBibz::Ui::Core::Component
42
+
43
+ # See UiBibz::Ui::Core::Component.initialize
44
+ def initialize content = nil, options = nil, html_options = nil, &block
45
+ super
46
+ end
47
+
48
+ # Render html tag
49
+ def render
50
+ link_to content, options[:url] || '#', html_options
51
+ end
52
+
53
+ end
54
+ end
@@ -1,6 +1,7 @@
1
- require 'ui_bibz/ui/core/navs/components/nav_link'
2
- require 'ui_bibz/ui/core/navs/components/nav_dropdown'
3
- module UiBibz::Ui::Core::Navs
1
+ require 'ui_bibz/ui/core/navigations/components/nav_link'
2
+ require 'ui_bibz/ui/core/navigations/components/nav_text'
3
+ require 'ui_bibz/ui/core/navigations/components/nav_dropdown'
4
+ module UiBibz::Ui::Core::Navigations
4
5
 
5
6
  # Create a nav
6
7
  #
@@ -28,9 +29,9 @@ module UiBibz::Ui::Core::Navs
28
29
  #
29
30
  # ==== Signatures
30
31
  #
31
- # UiBibz::Ui::Core::Navs::Nav.new(content, options = nil, html_options = nil)
32
+ # UiBibz::Ui::Core::Navigations::Nav.new(content, options = nil, html_options = nil)
32
33
  #
33
- # UiBibz::Ui::Core::Navs::Nav.new(options = nil, html_options = nil).tap do |n|
34
+ # UiBibz::Ui::Core::Navigations::Nav.new(options = nil, html_options = nil).tap do |n|
34
35
  # ...
35
36
  # n.link content = nil, options = nil, html_options = nil, block
36
37
  # n.link content = nil, options = nil, html_options = nil, block
@@ -40,7 +41,7 @@ module UiBibz::Ui::Core::Navs
40
41
  #
41
42
  # ==== Examples
42
43
  #
43
- # UiBibz::Ui::Core::Navs::Nav.new(type: :pills).tap do |n|
44
+ # UiBibz::Ui::Core::Navigations::Nav.new(type: :pills).tap do |n|
44
45
  # n.link 'Test', url: '#test'
45
46
  # n.link 'Test2', url: '#test2', state: :active
46
47
  # n.dropdown('Action') do |d|
@@ -73,28 +74,38 @@ module UiBibz::Ui::Core::Navs
73
74
 
74
75
  # Render html tag
75
76
  def render
76
- content_tag tag, @items.join.html_safe, html_options
77
+ content_tag tag, @items.map(&:render).join.html_safe, html_options
77
78
  end
78
79
 
79
80
  # Add nav link items
80
- # See UiBibz::Ui::Core::Navs::NavLink
81
+ # See UiBibz::Ui::Core::Navigations::NavLink
81
82
  def link content = nil, options = {}, html_options = nil, &block
82
83
  block_given? ? content.merge!({ nav_type: type }) : options.merge!({ nav_type: type })
83
- @items << NavLink.new(content, options, html_options, &block).render
84
+ @items << NavLink.new(content, options, html_options, &block)
85
+ end
86
+
87
+ def text content = nil, options = {}, html_options = nil, &block
88
+ block_given? ? content.merge!({ nav_type: type }) : options.merge!({ nav_type: type })
89
+ @items << NavText.new(content, options, html_options, &block)
84
90
  end
85
91
 
86
92
  # Add nav in nav
87
93
  def nav content = nil, options = {}, html_options = nil, &block
88
- @items << content_tag(:li, Nav.new(content, options, html_options).tap(&block).render, class: 'nav-item')
94
+ @items << UiBibz::Ui::Core::Component.new(Nav.new(content, options).tap(&block).render, {}, html_options)
89
95
  end
90
96
 
91
97
  # Add nav dropdown items
92
- # See UiBibz::Ui::Core::Navs::NavDropdown
98
+ # See UiBibz::Ui::Core::Navigations::NavDropdown
93
99
  def dropdown content = nil, options = {}, html_options = nil, &block
94
- @items << NavDropdown.new(content, options, html_options).tap(&block).render
100
+ @items << NavDropdown.new(content, options, html_options).tap(&block)
101
+ end
102
+
103
+ def spacer num = "auto"
104
+ kls = " mr-#{ num }"
105
+ @items.last.html_options[:class].nil? ? @items.last.html_options[:class] = kls : @items.last.html_options[:class] << kls
95
106
  end
96
107
 
97
- private
108
+ protected
98
109
 
99
110
  def component_html_classes
100
111
  ["nav", type, position, stacked, justify, fill]
@@ -1,8 +1,8 @@
1
- require 'ui_bibz/ui/core/navs/components/navbar_nav'
2
- require 'ui_bibz/ui/core/navs/components/navbar_text'
3
- require 'ui_bibz/ui/core/navs/components/navbar_form'
4
- require 'ui_bibz/ui/core/navs/components/navbar_brand'
5
- module UiBibz::Ui::Core::Navs
1
+ require 'ui_bibz/ui/core/navigations/components/navbar_nav'
2
+ require 'ui_bibz/ui/core/navigations/components/navbar_text'
3
+ require 'ui_bibz/ui/core/navigations/components/navbar_form'
4
+ require 'ui_bibz/ui/core/navigations/components/navbar_brand'
5
+ module UiBibz::Ui::Core::Navigations
6
6
 
7
7
  # Create a Navbar
8
8
  #
@@ -90,24 +90,24 @@ module UiBibz::Ui::Core::Navs
90
90
  # See UiBibz::Ui::Core::NavbarNav
91
91
  def nav content = nil, options = nil, html_options = nil, &block
92
92
  options = options || {}
93
- @items << UiBibz::Ui::Core::Navs::NavbarNav.new(content, options, html_options).tap(&block).render
93
+ @items << UiBibz::Ui::Core::Navigations::NavbarNav.new(content, options, html_options).tap(&block).render
94
94
  end
95
95
 
96
96
  # Add navbar form items
97
97
  # See UiBibz::Ui::Core::NavbarForm
98
98
  def form model_or_url, options = {}, &block
99
- @items << UiBibz::Ui::Core::Navs::NavbarForm.new(model_or_url, options, &block).render
99
+ @items << UiBibz::Ui::Core::Navigations::NavbarForm.new(model_or_url, options, &block).render
100
100
  end
101
101
 
102
102
  # Not use !!!!!
103
103
  # Add navbar text items
104
104
  # See UiBibz::Ui::Core::NavbarText
105
105
  def text content = nil, options = nil, html_options = nil, &block
106
- @items << UiBibz::Ui::Core::Navs::NavbarText.new(content, options, html_options, &block).render
106
+ @items << UiBibz::Ui::Core::Navigations::NavbarText.new(content, options, html_options, &block).render
107
107
  end
108
108
 
109
109
  def brand content = nil, options = nil, html_options = nil, &block
110
- @brand = UiBibz::Ui::Core::Navs::NavbarBrand.new(content, options, html_options, &block).render
110
+ @brand = UiBibz::Ui::Core::Navigations::NavbarBrand.new(content, options, html_options, &block).render
111
111
  end
112
112
 
113
113
  def id
@@ -1,5 +1,5 @@
1
- require 'ui_bibz/ui/core/navs/components/pagination_link'
2
- module UiBibz::Ui::Core::Navs
1
+ require 'ui_bibz/ui/core/navigations/components/pagination_link'
2
+ module UiBibz::Ui::Core::Navigations
3
3
 
4
4
  # Create a Pagination
5
5
  #
@@ -22,9 +22,9 @@ module UiBibz::Ui::Core::Navs
22
22
  #
23
23
  # ==== Signatures
24
24
  #
25
- # UiBibz::Ui::Core::Navs::Pagination.new(content, options = nil, html_options = nil)
25
+ # UiBibz::Ui::Core::Navigations::Pagination.new(content, options = nil, html_options = nil)
26
26
  #
27
- # UiBibz::Ui::Core::Navs::Pagination.new(options = nil, html_options = nil).tap do |n|
27
+ # UiBibz::Ui::Core::Navigations::Pagination.new(options = nil, html_options = nil).tap do |n|
28
28
  # ...
29
29
  # n.link content = nil, options = nil, html_options = nil, block
30
30
  # n.link content = nil, options = nil, html_options = nil, block
@@ -34,7 +34,7 @@ module UiBibz::Ui::Core::Navs
34
34
  #
35
35
  # ==== Examples
36
36
  #
37
- # UiBibz::Ui::Core::Navs::Pagination.new(type: :pills).tap do |n|
37
+ # UiBibz::Ui::Core::Navigations::Pagination.new(type: :pills).tap do |n|
38
38
  # n.link 'Test', url: '#test'
39
39
  # n.link 'Test2', url: '#test2', state: :active
40
40
  # n.dropdown('Action') do |d|
@@ -67,7 +67,7 @@ module UiBibz::Ui::Core::Navs
67
67
  end
68
68
 
69
69
  # Add nav link items
70
- # See UiBibz::Ui::Core::Navs::NavLink
70
+ # See UiBibz::Ui::Core::Navigations::NavLink
71
71
  def link content = nil, options = {}, html_options = nil, &block
72
72
  @items << PaginationLink.new(content, options, html_options, &block).render
73
73
  end
@@ -0,0 +1,82 @@
1
+ module UiBibz::Ui::Core::Navigations
2
+
3
+ # Create a tab_group
4
+ #
5
+ # This element is an extend of UiBibz::Ui::Core::Component.
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
+ # * +position+ - Symbol
18
+ # (+:left+, +:right+, +:center+)
19
+ # * +tag+ - Symbol
20
+ # (+:a+, +:li)
21
+ # * +justify+ - Boolean
22
+ # * +fill+ - Boolean
23
+ #
24
+ # ==== Signatures
25
+ #
26
+ # UiBibz::Ui::Core::Navigations::TabGroup.new(content, options = nil, html_options = nil)
27
+ #
28
+ # UiBibz::Ui::Core::Navigations::TabGroup.new(options = nil, html_options = nil).tap do |n|
29
+ # ...
30
+ # n.tab content = nil, options = nil, html_options = nil, block
31
+ # n.tab content = nil, options = nil, html_options = nil, block
32
+ # n.dropdown content = nil, options = nil, html_options = nil, block
33
+ # ...
34
+ # end
35
+ #
36
+ # ==== Examples
37
+ #
38
+ # UiBibz::Ui::Core::Navigations::TabGroup.new(type: :pills).tap do |n|
39
+ # n.tab 'Test', url: '#test'
40
+ # n.tab 'Test2', url: '#test2', state: :active
41
+ # n.dropdown('Action') do |d|
42
+ # d.list content = nil, options = nil, html_options = nil, &block
43
+ # end
44
+ # end.render
45
+ #
46
+ # ==== Helper
47
+ #
48
+ # ui_tab_group(options = { tap: true }, html_options = {}) do |n|
49
+ # n.tab(content, options = {}, html_options = {})
50
+ # n.tab(options = {}, html_options = {}) do
51
+ # content
52
+ # end
53
+ # n.dropdown(name, options = {}, html_options = {}) do |d|
54
+ # d.list(content, options = {}, html_options = {})
55
+ # d.list(options = {}, html_options = {}) do
56
+ # content
57
+ # end
58
+ # end
59
+ # end
60
+ #
61
+ class TabGroup < UiBibz::Ui::Core::Navigations::Nav
62
+
63
+ # See UiBibz::Ui::Core::Component.initialize
64
+ def initialize content = nil, options = nil, html_options = nil, &block
65
+ super
66
+ end
67
+
68
+ # Add nav link items
69
+ # See UiBibz::Ui::Core::Navigations::NavLink
70
+ def tab content = nil, options = {}, html_options = nil, &block
71
+ block_given? ? content.merge!({ nav_type: type }) : options.merge!({ nav_type: type })
72
+ @items << NavLink.new(content, options, html_options, &block)
73
+ end
74
+
75
+ private
76
+
77
+ def component_html_classes
78
+ ["nav", "nav-tabs", position, justify, fill]
79
+ end
80
+
81
+ end
82
+ end
@@ -1,6 +1,6 @@
1
- module UiBibz::Ui::Core::Forms::Buttons
1
+ module UiBibz::Ui::Core::Navigations
2
2
 
3
- # Create a button toolbar
3
+ # Create a toolbar
4
4
  #
5
5
  # This element is an extend of UiBibz::Ui::Core::Component.
6
6
  #
@@ -23,13 +23,13 @@ module UiBibz::Ui::Core::Forms::Buttons
23
23
  #
24
24
  # ==== Signatures
25
25
  #
26
- # UiBibz::Ui::Core::Forms::Buttons::ButtonToolbar.new(options = nil, html_options = nil) do |bt|
26
+ # UiBibz::Ui::Core::Navigations::Toolbar.new(options = nil, html_options = nil) do |bt|
27
27
  # ...
28
28
  # end
29
29
  #
30
30
  # ==== Examples
31
31
  #
32
- # UiBibz::Ui::Core::Forms::Buttons::ButtonToolbar.new(status: :primary, size: :xs) do |bt|
32
+ # UiBibz::Ui::Core::Navigations::Toolbar.new(status: :primary, size: :xs) do |bt|
33
33
  # bt.button_group do |bg|
34
34
  # bg.ui_button 'test 1'
35
35
  # bg.ui_button 'test 2'
@@ -42,14 +42,14 @@ module UiBibz::Ui::Core::Forms::Buttons
42
42
  #
43
43
  # ==== Helper
44
44
  #
45
- # ui_button_toolbar(options = {}, html_options = {}) do |bt|
45
+ # ui_toolbar(options = {}, html_options = {}) do |bt|
46
46
  # bt.button_group do |bg|
47
47
  # bg.ui_button 'content'
48
48
  # bg.ui_button_link 'Link', url: '#'
49
49
  # end
50
50
  # end
51
51
  #
52
- class ButtonToolbar < UiBibz::Ui::Core::Component
52
+ class Toolbar < UiBibz::Ui::Core::Component
53
53
 
54
54
  # See UiBibz::Ui::Core::Component.initialize
55
55
  def initialize content = nil, options = nil, html_options = nil, &block
@@ -59,7 +59,7 @@ module UiBibz::Ui::Core::Forms::Buttons
59
59
 
60
60
  # Render html tag
61
61
  def render
62
- content_tag :div, @items.join.html_safe, html_options
62
+ content_tag :div, @items.map(&:render).join.html_safe, html_options
63
63
  end
64
64
 
65
65
  def button_group content = nil, options = nil, html_options = nil, &block
@@ -68,8 +68,12 @@ module UiBibz::Ui::Core::Forms::Buttons
68
68
  else
69
69
  content = @options.merge(content || {})
70
70
  end
71
+ @items << UiBibz::Ui::Core::Forms::Buttons::ButtonGroup.new(content, options, html_options).tap(&block)
72
+ end
71
73
 
72
- @items << ButtonGroup.new(content, options, html_options).tap(&block).render
74
+ def spacer num = "auto"
75
+ kls = "mr-#{ num }"
76
+ @items.last.html_options[:class] = @items.last.html_options[:class].nil? ? kls : join_classes(@items.last.html_options[:class], kls)
73
77
  end
74
78
 
75
79
  private
@@ -1,9 +1,8 @@
1
- module UiBibz::Ui::Core
1
+ module UiBibz::Ui::Core::Notifications
2
2
 
3
3
  # Create a badge
4
4
  #
5
5
  # This element is an extend of UiBibz::Ui::Core::Component.
6
- # The helper use 'etiquette' method to avoid conflict with Rails.
7
6
  #
8
7
  # ==== Attributes
9
8
  #
@@ -26,29 +25,29 @@ module UiBibz::Ui::Core
26
25
  #
27
26
  # ==== Signatures
28
27
  #
29
- # UiBibz::Ui::Core::Badge.new(content, options = nil, html_options = nil)
28
+ # UiBibz::Ui::Core::Notifications::Badge.new(content, options = nil, html_options = nil)
30
29
  #
31
- # UiBibz::Ui::Core::Badge.new(options = nil, html_options = nil) do
30
+ # UiBibz::Ui::Core::Notifications::Badge.new(options = nil, html_options = nil) do
32
31
  # content
33
32
  # end
34
33
  #
35
34
  # ==== Examples
36
35
  #
37
- # UiBibz::Ui::Core::Badge.new(content, status: :success, type: :pill).render
36
+ # UiBibz::Ui::Core::Notifications::Badge.new(content, status: :success, type: :pill).render
38
37
  #
39
- # UiBibz::Ui::Core::Badge.new() do
38
+ # UiBibz::Ui::Core::Notifications::Badge.new() do
40
39
  # #content
41
40
  # end.render
42
41
  #
43
42
  # ==== Helper
44
43
  #
45
- # etiquette(content, options = {}, html_options = {})
44
+ # ui_badge(content, options = {}, html_options = {})
46
45
  #
47
- # etiquette(options = {}, html_options = {}) do
46
+ # ui_badge(options = {}, html_options = {}) do
48
47
  # content
49
48
  # end
50
49
  #
51
- class Badge < Component
50
+ class Badge < UiBibz::Ui::Core::Component
52
51
 
53
52
  # See UiBibz::Ui::Core::Component.initialize
54
53
  def initialize content = nil, options = nil, html_options = nil, &block