ui_bibz 2.2.2 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +4 -4
  3. data/app/assets/javascripts/form.coffee +1 -5
  4. data/app/assets/javascripts/interface.coffee +8 -0
  5. data/app/assets/javascripts/ui_bibz.coffee.erb +1 -1
  6. data/app/assets/stylesheets/forms.sass +5 -0
  7. data/app/assets/stylesheets/notifications.sass +8 -1
  8. data/config/initializers/will_paginate.rb +1 -1
  9. data/lib/ui_bibz/helpers/ui/core/boxes_helper.rb +9 -0
  10. data/lib/ui_bibz/helpers/ui/core/notifications_helper.rb +17 -0
  11. data/lib/ui_bibz/infos.rb +2 -2
  12. data/lib/ui_bibz/ui/base.rb +1 -1
  13. data/lib/ui_bibz/ui/core/boxes/card.rb +2 -0
  14. data/lib/ui_bibz/ui/core/boxes/card_accordion.rb +65 -0
  15. data/lib/ui_bibz/ui/core/boxes/components/card_body.rb +12 -1
  16. data/lib/ui_bibz/ui/core/component.rb +12 -4
  17. data/lib/ui_bibz/ui/core/forms/buttons/button.rb +14 -4
  18. data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +0 -1
  19. data/lib/ui_bibz/ui/core/forms/dropdowns/dropdown.rb +4 -2
  20. data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +9 -12
  21. data/lib/ui_bibz/ui/core/forms/selects/select_field.rb +7 -14
  22. data/lib/ui_bibz/ui/core/navigations/link.rb +12 -0
  23. data/lib/ui_bibz/ui/core/notifications/components/toast_body.rb +50 -0
  24. data/lib/ui_bibz/ui/core/notifications/components/toast_header.rb +62 -0
  25. data/lib/ui_bibz/ui/core/notifications/spinner.rb +89 -0
  26. data/lib/ui_bibz/ui/core/notifications/toast.rb +97 -0
  27. data/lib/ui_bibz/ui/extensions/core/component/popover_extension.rb +16 -5
  28. data/lib/ui_bibz.rb +3 -0
  29. data/test/simple_form_test.rb +7 -7
  30. data/test/ui/core/component_test.rb +1 -0
  31. data/test/ui/core/forms/buttons/button_group_test.rb +3 -3
  32. data/test/ui/core/forms/buttons/button_test.rb +44 -9
  33. data/test/ui/core/forms/choices/checkbox_field_test.rb +1 -1
  34. data/test/ui/core/forms/selects/dropdown_select_field_test.rb +10 -10
  35. data/test/ui/core/forms/selects/select_field_test.rb +2 -2
  36. data/test/ui/core/forms/surrounds/surround_field_test.rb +2 -2
  37. data/test/ui/core/navigations/link_test.rb +26 -0
  38. data/test/ui/core/navigations/navbar_test.rb +1 -1
  39. data/test/ui/core/navigations/toolbar_test.rb +2 -2
  40. data/test/ui/core/notifications/spinner_test.rb +33 -0
  41. data/test/ui/core/notifications/toast_test.rb +15 -0
  42. data/test/ui/ux/containers/panel_test.rb +4 -4
  43. data/ui_bibz.gemspec +1 -1
  44. data/vendor/assets/javascripts/bootstrap-select.js.map +1 -1
  45. data/vendor/assets/javascripts/bootstrap-select.min.js +3 -3
  46. data/vendor/assets/stylesheets/bootstrap-select.css.map +1 -1
  47. data/vendor/assets/stylesheets/bootstrap-select.min.css +3 -3
  48. metadata +19 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab10496daf32afaaca5fd078a9a2620f630fad4da2ea00f5ae8f24aa8ae0826c
4
- data.tar.gz: b9292524cdb88cf85094134984f77b950683615b74c235e0ee212990bb20897c
3
+ metadata.gz: 1bb30ee2a67229de4844d20f26278dd14780ea2b6d385cf2694a40410120cccf
4
+ data.tar.gz: 258345dcfd10af021551eedbdddd844b93a6f8854bd82cfdacb18c4b4e341b79
5
5
  SHA512:
6
- metadata.gz: ac16a93775ca52b4a4bcc96cceda6e199063134ae3496b851de5355d4b3cac4d7a4088fb7d748525b330cc54cf93745ee83012179dd210871e98f6c86c9f1135
7
- data.tar.gz: 6e68566da4afe3ba625e962c968d1aff7df297695441d7de08a413c73b96ffddf580ff9e66f7d903b57cd0dd38e8c90f7d6269761b79a82354e7ce48c21377c8
6
+ metadata.gz: 0cbddb81ee89849fafbc96197d7a769e711592ed506e6332701138d129bb9c742c959acb78391ffa93c4c4be67acc642bbf709da40c1de4b3322a1d3174a6088
7
+ data.tar.gz: a42596aa4b47ed030cfec591164dbddd0a8f8e53b754b69cc66b49ac04eb085b7c4d80661305c673225c4f7a28fdb01878ba6258267d1b62d396f058d3d08a2d
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ui_bibz (2.2.2)
5
- bootstrap (= 4.2.1)
4
+ ui_bibz (2.3.0)
5
+ bootstrap (= 4.3.1)
6
6
  haml
7
7
  haml-rails
8
8
  jquery-rails (>= 3.1.0)
@@ -61,7 +61,7 @@ GEM
61
61
  autoprefixer-rails (9.4.7)
62
62
  execjs
63
63
  awesome_print (1.8.0)
64
- bootstrap (4.2.1)
64
+ bootstrap (4.3.1)
65
65
  autoprefixer-rails (>= 9.1.0)
66
66
  popper_js (>= 1.14.3, < 2)
67
67
  sassc-rails (>= 2.0.0)
@@ -216,7 +216,7 @@ DEPENDENCIES
216
216
  minitest
217
217
  simple_form
218
218
  simplecov
219
- sqlite3
219
+ sqlite3 (= 1.3.13)
220
220
  ui_bibz!
221
221
 
222
222
  BUNDLED WITH
@@ -13,11 +13,7 @@
13
13
  $('.ui-bibz-connect').inputConnected()
14
14
 
15
15
  selectPicker: ->
16
- $('select.dropdown-select-field').selectpicker
17
- iconBase: 'fa'
18
- tickIcon: 'fa-check'
19
- #style: 'btn-secondary'
20
- showTick: false
16
+ $('select.dropdown-select-field').selectpicker()
21
17
 
22
18
  switch: ->
23
19
  $('input.switch-field').bootstrapSwitch({ size: 'large' })
@@ -8,6 +8,8 @@
8
8
  @popover()
9
9
  @notify()
10
10
  @fileInputBrowser()
11
+ @toast()
12
+ @collapse()
11
13
 
12
14
  nav: ->
13
15
  #$('.nav-tabs .nav-item .nav-link').tab('show')
@@ -48,3 +50,9 @@
48
50
  else if (!el.is(':checked'))
49
51
  el.prop('readonly', true)
50
52
  el.prop('indeterminate', true)
53
+
54
+ toast: ->
55
+ $('.toast').toast()
56
+
57
+ collapse: ->
58
+ $('.collapse').collapse()
@@ -70,7 +70,7 @@ $.fn.selectpicker.Constructor.BootstrapVersion = '4'
70
70
  $(document).on 'turbolinks:load', ->
71
71
  me.initial() # catch event for turbolinks and fix in ready() function
72
72
  else
73
- $ ->
73
+ $(document).ready ->
74
74
  me.initial()
75
75
  return false
76
76
 
@@ -71,3 +71,8 @@
71
71
  .dropdown-toggle::after
72
72
  content: none
73
73
 
74
+ // fix button bug
75
+ .bootstrap-select .dropdown-toggle:after
76
+ margin-top: 0.5rem
77
+ margin-bottom: 0.5rem
78
+
@@ -23,5 +23,12 @@
23
23
  .fab
24
24
  line-height: 0.7 !important
25
25
 
26
- span:not(.input-group-addon) .glyph
26
+ span:not(.input-group-addon, .btn) .glyph
27
27
  margin-top: -0.1rem
28
+
29
+ .input-group-btn span svg
30
+ margin: 0.25rem
31
+
32
+ .toast .toast-header img
33
+ width: 20px
34
+ height: 20px
@@ -21,7 +21,7 @@ module WillPaginate
21
21
  def to_html
22
22
  list_items = pagination.map do |item|
23
23
  case item
24
- when Fixnum
24
+ when Integer
25
25
  page_number(item)
26
26
  else
27
27
  send(item)
@@ -15,6 +15,15 @@ module UiBibz::Helpers::Ui::Core::BoxesHelper
15
15
  end
16
16
  end
17
17
 
18
+ # Card Accordion
19
+ #
20
+ # +options+ (Hash)
21
+ # +html_options+ (Hash)
22
+ #
23
+ def ui_card_accordion content = nil, options = nil, html_options = nil, &block
24
+ UiBibz::Ui::Core::Boxes::CardAccordion.new(content, options, html_options).tap(&block).render
25
+ end
26
+
18
27
  # Card Group Component
19
28
  #
20
29
  # +options+ (Hash)
@@ -34,6 +34,23 @@ module UiBibz::Helpers::Ui::Core::NotificationsHelper
34
34
  end
35
35
  end
36
36
 
37
+ # Toast Component
38
+ #
39
+ # +options+ (Hash)
40
+ # +html_options+ (Hash)
41
+ def ui_toast content = nil, options = nil, html_options = nil, &block
42
+ UiBibz::Ui::Core::Notifications::Toast.new(content, options, html_options).tap(&block).render
43
+ end
44
+
45
+ # Spinner Component
46
+ #
47
+ # +options+ (Hash)
48
+ # +html_options+ (Hash)
49
+ #
50
+ def ui_spinner content = nil, options = nil, html_options = nil, &block
51
+ UiBibz::Ui::Core::Notifications::Spinner.new(content, options, html_options, &block).render
52
+ end
53
+
37
54
  private
38
55
 
39
56
  def is_tap content, options
data/lib/ui_bibz/infos.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  module UiBibz
2
2
  NAME = "Ui Bibz"
3
- VERSION = "2.2.2"
3
+ VERSION = "2.3.0"
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"
7
7
  FONTAWESOME_VERSION = "5.7.0"
8
- BOOTSTRAP_VERSION = "4.2.1"
8
+ BOOTSTRAP_VERSION = "4.3.1"
9
9
  end
@@ -17,7 +17,7 @@ module UiBibz::Ui
17
17
  end
18
18
 
19
19
  def generate_id name = nil
20
- "#{ name || 'id' }-#{ Random.new_seed }"
20
+ "#{ name || 'id' }-#{ Random.rand(99999) }"
21
21
  end
22
22
  end
23
23
  end
@@ -108,8 +108,10 @@ module UiBibz::Ui::Core::Boxes
108
108
  def body content = nil, options = nil, html_options = nil, &block
109
109
  options, content = inherit_options(content, options, block)
110
110
  if is_tap(content, options)
111
+ content = (content || {}).merge(collapse: options.try(:[], :collapse), parent_collapse: @options[:parent_collapse] )
111
112
  @items << UiBibz::Ui::Core::Boxes::Components::CardBody.new(content, options, html_options).tap(&block).render
112
113
  else
114
+ options = (options || {}).merge(collapse: options.try(:[], :collapse), parent_collapse: @options[:parent_collapse] )
113
115
  @items << UiBibz::Ui::Core::Boxes::Components::CardBody.new(content, options, html_options, &block).render
114
116
  end
115
117
  end
@@ -0,0 +1,65 @@
1
+ module UiBibz::Ui::Core::Boxes
2
+
3
+ # Create a card accordion
4
+ #
5
+ # ==== Attributes
6
+ #
7
+ # * +content+ - Content of element
8
+ # * +options+ - Options of element
9
+ # * +html_options+ - Html Options of element
10
+ #
11
+ # ==== Options
12
+ #
13
+ # You can add HTML attributes using the +html_options+.
14
+ # You can pass arguments in options attribute:
15
+ #
16
+ # ==== Signatures
17
+ #
18
+ # UiBibz::Ui::Core::Boxes::CardAccordion.new(content, options = nil, html_options = nil)
19
+ #
20
+ # UiBibz::Ui::Core::Boxes::CardAccordion.new(options = nil, html_options = nil) do |cg|
21
+ # cg.card content, options, html_options, &block
22
+ # end
23
+ #
24
+ # ==== Examples
25
+ #
26
+ # UiBibz::Ui::Core::Boxes::CardAccordion.new do |cg|
27
+ # cg.card 'Exemple 1'
28
+ # cg.card 'Exemple 2'
29
+ # cg.card 'Exemple 3'
30
+ # end.render
31
+ #
32
+ class CardAccordion < UiBibz::Ui::Core::Component
33
+
34
+ # See UiBibz::Ui::Core::Component.initialize
35
+ def initialize content = nil, options = nil, html_options = nil, &block
36
+ super
37
+ @items = []
38
+ end
39
+
40
+ # Render html tag
41
+ def pre_render
42
+ content_tag :div, @items.join.html_safe, html_options
43
+ end
44
+
45
+ def card content = nil, options = nil, html_options = nil, &block
46
+ content = (content || {}).merge({ parent_collapse: id })
47
+ @items << UiBibz::Ui::Core::Boxes::Card.new(content, options, html_options).tap(&block).render
48
+ end
49
+
50
+ private
51
+
52
+ def id
53
+ @id ||= generate_id("card-accordion-id")
54
+ end
55
+
56
+ def component_html_classes
57
+ "accordion"
58
+ end
59
+
60
+ def component_html_options
61
+ { id: id }
62
+ end
63
+
64
+ end
65
+ end
@@ -42,7 +42,13 @@ module UiBibz::Ui::Core::Boxes::Components
42
42
 
43
43
  # Render html tag
44
44
  def pre_render
45
- content_tag :div, @items.join.html_safe, html_options
45
+ if options[:collapse]
46
+ content_tag :div, class: join_classes("collapse", show), id: options[:collapse], "data-parent": "##{ options[:parent_collapse] }" do
47
+ content_tag :div, @items.join.html_safe, html_options
48
+ end
49
+ else
50
+ content_tag :div, @items.join.html_safe, html_options
51
+ end
46
52
  end
47
53
 
48
54
  def title content = nil, options = nil, html_options = nil, &block
@@ -67,5 +73,10 @@ module UiBibz::Ui::Core::Boxes::Components
67
73
  "text-#{ @options[:status] }" if @options[:outline]
68
74
  end
69
75
 
76
+ def show
77
+ ap @options[:show]
78
+ "show" if @options[:show]
79
+ end
80
+
70
81
  end
71
82
  end
@@ -104,11 +104,18 @@ module UiBibz::Ui::Core
104
104
  # Override this method to add html data
105
105
  def component_html_data
106
106
  # To stimulusjs
107
- add_html_data :target, html_options.try(:[], :data).try(:[], :target) || options.try(:delete, :target)
108
- add_html_data :controller, html_options.try(:[], :data).try(:[], :controller) || options.try(:delete, :controller)
109
- add_html_data :action, html_options.try(:[], :data).try(:[], :action) || options.try(:delete, :action)
107
+ data_target = html_options.try(:[], :data).try(:[], :target) || options.try(:delete, :target)
108
+ add_html_data(:target, data_target) unless data_target.nil?
109
+
110
+ data_controller = html_options.try(:[], :data).try(:[], :controller) || options.try(:delete, :controller)
111
+ add_html_data(:controller, data_controller) unless data_controller.nil?
112
+
113
+ data_action = html_options.try(:[], :data).try(:[], :action) || options.try(:delete, :action)
114
+ add_html_data(:action, data_action) unless data_action.nil?
115
+
110
116
  # To turbolinks
111
- add_html_data :turbolinks, html_options.try(:[], :data).try(:[], :turbolinks) || options.try(:delete, :turbolinks)
117
+ data_turbolinks = html_options.try(:[], :data).try(:[], :turbolinks) || options.try(:delete, :turbolinks)
118
+ add_html_data(:turbolinks, data_turbolinks) unless data_turbolinks.nil?
112
119
  end
113
120
 
114
121
  # Override this method to add html Options
@@ -163,6 +170,7 @@ module UiBibz::Ui::Core
163
170
  def initialize_component_html_data
164
171
  component_html_data
165
172
  popover_data_html
173
+ tooltip_data_html
166
174
  end
167
175
 
168
176
  def initialize_component_html_options
@@ -65,6 +65,7 @@ module UiBibz::Ui::Core::Forms::Buttons
65
65
 
66
66
  def button_html_tag
67
67
  content_tag :button, html_options do
68
+ concat spinner_html unless options[:spinner].nil?
68
69
  concat glyph_and_content_html(options[:text].nil? ? @content : '')
69
70
  concat badge_html unless options[:badge].nil?
70
71
  end
@@ -77,18 +78,20 @@ module UiBibz::Ui::Core::Forms::Buttons
77
78
  def component_html_options
78
79
  opts = super
79
80
  opts = opts.merge(toggle) unless options[:toggle].nil?
81
+ opts = opts.merge(collapse) unless options[:collapse].nil?
80
82
  opts = opts.merge(active_html_options) if options[:state] == :active
81
83
  opts = opts.merge({ disabled: 'disabled' }) if options[:state] == :disabled
82
84
  opts
83
85
  end
84
86
 
85
- def component_html_data
86
- super
87
- action
87
+ def collapse
88
+ attrs = { "data-toggle": "collapse", "data-target": "##{ options[:collapse] }" }
89
+ attrs = attrs.merge({ "aria-expanded": true }) if options[:active_collapse]
90
+ attrs
88
91
  end
89
92
 
90
93
  def status
91
- ["btn", outline, options[:status]].compact.join('-')
94
+ ["btn", outline, options[:status] || "secondary"].compact.join('-')
92
95
  end
93
96
 
94
97
  def outline
@@ -125,6 +128,13 @@ module UiBibz::Ui::Core::Forms::Buttons
125
128
  end
126
129
  end
127
130
 
131
+ def spinner_html
132
+ opts = { size: :sm, tag: :span, class: options[:text] == false ? nil : 'mr-2' }
133
+ opts = opts.merge(options[:spinner]) if options[:spinner].kind_of? Hash
134
+
135
+ UiBibz::Ui::Core::Notifications::Spinner.new(nil, opts).render
136
+ end
137
+
128
138
  # :lg, :sm or :xs
129
139
  def size
130
140
  "btn-#{ options[:size] }" if options[:size]
@@ -60,7 +60,6 @@ module UiBibz::Ui::Core::Forms::Choices
60
60
  private
61
61
 
62
62
  def checkbox_field_html_tag
63
- options[:action] = html_options[:data].delete(:action)
64
63
  content_tag(:div, html_options.except(:id, "data-action")) do
65
64
  concat hidden_field_tag content, '0', id: "#{ content }-hidden"
66
65
  concat check_box_tag content, options[:value] || '1', options[:checked] || html_options[:checked], checkbox_html_options
@@ -26,6 +26,7 @@ module UiBibz::Ui::Core::Forms::Dropdowns
26
26
  # * +name+ - String
27
27
  # * +size+ - Integer
28
28
  # * +type+ - Symbol
29
+ # * +html_button+ - Hash
29
30
  #
30
31
  # ==== Signatures
31
32
  #
@@ -119,10 +120,11 @@ module UiBibz::Ui::Core::Forms::Dropdowns
119
120
  end
120
121
 
121
122
  def button_html
123
+ html_button = options[:html_button] || {}
122
124
  if options[:tag] == :a
123
- content_tag dropdown_tag, button_content, class: join_classes("btn", button_status, state, size, "dropdown-toggle"), href: '#', role: 'button', "data-toggle" => 'dropdown', "aria-haspopup" => true, "aria-expanded" => false, "id" => id
125
+ content_tag dropdown_tag, button_content, { class: join_classes("btn", button_status, state, size, "dropdown-toggle"), href: '#', role: 'button', "data-toggle" => 'dropdown', "aria-haspopup" => true, "aria-expanded" => false, "id" => id }.merge(html_button)
124
126
  else
125
- content_tag dropdown_tag, button_content, class: join_classes("btn", button_status, state, size, "dropdown-toggle"), type: 'button', "data-toggle" => 'dropdown', "aria-haspopup" => true, "aria-expanded" => false, "id" => id
127
+ content_tag dropdown_tag, button_content, { class: join_classes("btn", button_status, state, size, "dropdown-toggle"), type: 'button', "data-toggle" => 'dropdown', "aria-haspopup" => true, "aria-expanded" => false, "id" => id }.merge(html_button)
126
128
  end
127
129
  end
128
130
 
@@ -75,16 +75,17 @@ module UiBibz::Ui::Core::Forms::Selects
75
75
  private
76
76
 
77
77
  def component_html_options
78
- super.merge({
79
- multiple: false,
80
- disabled: options[:state] == :disabled,
81
- include_blank: options[:include_blank],
82
- prompt: options[:prompt]
83
- })
78
+ super.merge({}.tap do |h|
79
+ h[:multiple] = true if options[:multiple]
80
+ h[:disabled] = options[:state] == :disabled
81
+ h[:include_blank] = options[:include_blank]
82
+ h[:prompt] = options[:prompt]
83
+ h[:title] = options[:placeholder] unless options[:placeholder].nil?
84
+ end)
84
85
  end
85
86
 
86
87
  def component_html_classes
87
- super << ['dropdown-select-field', show_tick, show_menu_arrow, dropup]
88
+ super << ['dropdown-select-field', show_tick, dropup]
88
89
  end
89
90
 
90
91
  def component_html_data
@@ -114,7 +115,7 @@ module UiBibz::Ui::Core::Forms::Selects
114
115
  end
115
116
 
116
117
  def style
117
- add_html_data('style', "btn-#{ options[:status]}") if options[:style]
118
+ add_html_data('style', "btn-#{ options[:status] || :secondary }")
118
119
  end
119
120
 
120
121
  def menu_size
@@ -139,10 +140,6 @@ module UiBibz::Ui::Core::Forms::Selects
139
140
  'show-tick' if options[:show_tick]
140
141
  end
141
142
 
142
- def show_menu_arrow
143
- 'show-menu-arrow' if options[:show_menu_arrow]
144
- end
145
-
146
143
  def dropup
147
144
  'dropup' if options[:dropup]
148
145
  end
@@ -18,15 +18,8 @@ module UiBibz::Ui::Core::Forms::Selects
18
18
  # * +status+ - status of élement with symbol value:
19
19
  # (+:primary+, +:secondary+, +:info+, +:warning+, +:danger+, +:link+)
20
20
  # * +option_tags+ - Array, Object [required]
21
- # * +searchable+ - Boolean
22
- # * +max_options+ - Integer
23
- # * +selected_text_format+ - String
24
- # * +menu_size+ - Integer
25
- # * +header+ - String
26
- # * +actions_box+ - Boolean
27
- # * +show_tick+ - Boolean
28
- # * +show_menu_arrow+ - Boolean
29
- # * +dropup+ - Boolean
21
+ # * +size+
22
+ # (+:xs+, +:sm+, +:lg+)
30
23
  # * +append+ - String, Html
31
24
  # * +prepend+ - String, Html
32
25
  # * +connect+ - Hash
@@ -55,11 +48,11 @@ module UiBibz::Ui::Core::Forms::Selects
55
48
  #
56
49
  # ==== Examples
57
50
  #
58
- # UiBibz::Ui::Core::Forms::Selects::SelectField.new('fruits', { option_tags: list_of_fruits, searchable: true }, { class: 'test' })
51
+ # UiBibz::Ui::Core::Forms::Selects::SelectField.new('fruits', { option_tags: list_of_fruits }, { class: 'test' }).render
59
52
  #
60
- # UiBibz::Ui::Core::Forms::Selects::SelectField.new({ option_tags: list_of_fruits, actions_box: true }, { class: 'test' }) do
53
+ # UiBibz::Ui::Core::Forms::Selects::SelectField.new({ option_tags: list_of_fruits }, { class: 'test' }) do
61
54
  # 'fruits'
62
- # end
55
+ # end.render
63
56
  #
64
57
  # ==== Helper
65
58
  #
@@ -75,7 +68,7 @@ module UiBibz::Ui::Core::Forms::Selects
75
68
  private
76
69
 
77
70
  def component_html_classes
78
- super << ["select-field", "form-control", size]
71
+ super << ["select-field", "form-control", "custom-select", size]
79
72
  end
80
73
 
81
74
  def component_options
@@ -83,7 +76,7 @@ module UiBibz::Ui::Core::Forms::Selects
83
76
  end
84
77
 
85
78
  def size
86
- "form-control-#{ options[:size] }" unless options[:size].nil?
79
+ "custom-select-#{ options[:size] }" unless options[:size].nil?
87
80
  end
88
81
 
89
82
  end
@@ -52,6 +52,18 @@ module UiBibz::Ui::Core::Navigations
52
52
 
53
53
  private
54
54
 
55
+ def component_html_options
56
+ opts = super
57
+ opts = opts.merge(collapse) unless options[:collapse].nil?
58
+ opts
59
+ end
60
+
61
+ def collapse
62
+ attrs = { role: "button", "data-toggle": "collapse", "data-target": "##{ options[:collapse] }" }
63
+ attrs = attrs.merge({ "aria-expanded": true }) if options[:active_collapse]
64
+ attrs
65
+ end
66
+
55
67
  def text
56
68
  @options[:text].nil? ? true : @options[:text]
57
69
  end
@@ -0,0 +1,50 @@
1
+ module UiBibz::Ui::Core::Notifications::Components
2
+
3
+ # Create a alert body
4
+ #
5
+ # ==== Attributes
6
+ #
7
+ # * +content+ - Content of element
8
+ # * +options+ - Options of element
9
+ # * +html_options+ - Html Options of element
10
+ #
11
+ # ==== Options
12
+ #
13
+ # You can add HTML attributes using the +html_options+.
14
+ # You can pass arguments in options attribute:
15
+ #
16
+ # ==== Signatures
17
+ #
18
+ # UiBibz::Ui::Core::Notifications::ToastBody.new(content, options = nil, html_options = nil)
19
+ #
20
+ # UiBibz::Ui::Core::Notifications::ToastBody.new(options = nil, html_options = nil) do
21
+ # content
22
+ # end
23
+ #
24
+ # ==== Examples
25
+ #
26
+ # UiBibz::Ui::Core::Notifications::ToastBody.new.render
27
+ #
28
+ # UiBibz::Ui::Core::Notifications::ToastBody.new do
29
+ # 'Exemple'
30
+ # end.render
31
+ #
32
+ class ToastBody < UiBibz::Ui::Core::Component
33
+
34
+ # See UiBibz::Ui::Core::Component.initialize
35
+ def initialize content = nil, options = nil, html_options = nil, &block
36
+ super
37
+ end
38
+
39
+ def pre_render
40
+ content_tag :div, content, html_options
41
+ end
42
+
43
+ private
44
+
45
+ def component_html_classes
46
+ "toast-body"
47
+ end
48
+
49
+ end
50
+ end
@@ -0,0 +1,62 @@
1
+ module UiBibz::Ui::Core::Notifications::Components
2
+
3
+ # Create a alert body
4
+ #
5
+ # ==== Attributes
6
+ #
7
+ # * +content+ - Content of element
8
+ # * +options+ - Options of element
9
+ # * +html_options+ - Html Options of element
10
+ #
11
+ # ==== Options
12
+ #
13
+ # You can add HTML attributes using the +html_options+.
14
+ # You can pass arguments in options attribute:
15
+ #
16
+ # ==== Signatures
17
+ #
18
+ # UiBibz::Ui::Core::Notifications::ToastHeader.new(content, options = nil, html_options = nil)
19
+ #
20
+ # UiBibz::Ui::Core::Notifications::ToastHeader.new(options = nil, html_options = nil) do
21
+ # content
22
+ # end
23
+ #
24
+ # ==== Examples
25
+ #
26
+ # UiBibz::Ui::Core::Notifications::ToastHeader.new.render
27
+ #
28
+ # UiBibz::Ui::Core::Notifications::ToastHeader.new do
29
+ # 'Exemple'
30
+ # end.render
31
+ #
32
+ class ToastHeader < UiBibz::Ui::Core::Component
33
+
34
+ # See UiBibz::Ui::Core::Component.initialize
35
+ def initialize content = nil, options = nil, html_options = nil, &block
36
+ super
37
+ end
38
+
39
+ def pre_render
40
+ content_tag :div, html_options do
41
+ concat UiBibz::Ui::Core::Icons::Glyph.new(options[:glyph], class: 'mr-2').render unless options[:glyph].nil?
42
+ concat image_tag(options[:img], class: 'rounded mr-2') unless options[:img].nil?
43
+ concat content_tag(:strong, content, class: 'mr-auto')
44
+ concat content_tag(:small, options[:time], class: 'text-muted') unless options[:time].nil?
45
+ concat close_button
46
+ end
47
+ end
48
+
49
+ private
50
+
51
+ def close_button
52
+ content_tag :button, class: 'ml-2 mb-1 close', "data-dismiss": "toast", "aria-label": "Close" do
53
+ content_tag(:span, "×", "aria-hidden": true).html_safe
54
+ end
55
+ end
56
+
57
+ def component_html_classes
58
+ "toast-header"
59
+ end
60
+
61
+ end
62
+ end