ui_bibz 2.0.0.beta2.6 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -7
  3. data/Gemfile.lock +63 -63
  4. data/app/assets/javascripts/interface.coffee +6 -1
  5. data/app/assets/javascripts/ui_bibz.coffee +1 -0
  6. data/app/assets/stylesheets/_custom_variables.sass +20 -0
  7. data/app/assets/stylesheets/_panel.scss +314 -0
  8. data/app/assets/stylesheets/boxes.sass +5 -0
  9. data/app/assets/stylesheets/containers.sass +2 -0
  10. data/app/assets/stylesheets/fix-bootstrap-4.sass +4 -0
  11. data/app/assets/stylesheets/fix-dropdown-select.sass +1 -0
  12. data/app/assets/stylesheets/fix_addon.sass +187 -0
  13. data/app/assets/stylesheets/forms.sass +60 -0
  14. data/app/assets/stylesheets/navigations.sass +11 -0
  15. data/app/assets/stylesheets/notifications.sass +10 -0
  16. data/app/assets/stylesheets/{table.sass → tables.sass} +0 -0
  17. data/app/assets/stylesheets/ui_bibz.sass +11 -91
  18. data/config/initializers/ui_bibz.rb +6 -4
  19. data/lib/ui_bibz.rb +5 -0
  20. data/lib/ui_bibz/helpers/ui/ux_helper.rb +4 -0
  21. data/lib/ui_bibz/inputs/ui_bibz_form/ui_bibz_form_builder.rb +38 -0
  22. data/{app → lib/ui_bibz}/inputs/ui_bibz_inputs/auto_complete_field_input.rb +0 -0
  23. data/{app → lib/ui_bibz}/inputs/ui_bibz_inputs/base_input.rb +0 -0
  24. data/{app → lib/ui_bibz}/inputs/ui_bibz_inputs/collection_input.rb +15 -11
  25. data/{app → lib/ui_bibz}/inputs/ui_bibz_inputs/string_input.rb +0 -0
  26. data/{app → lib/ui_bibz}/inputs/ui_bibz_inputs/ui_auto_complete_field_input.rb +0 -0
  27. data/{app → lib/ui_bibz}/inputs/ui_bibz_inputs/ui_choice_group_input.rb +0 -0
  28. data/{app → lib/ui_bibz}/inputs/ui_bibz_inputs/ui_date_picker_field_input.rb +0 -0
  29. data/{app → lib/ui_bibz}/inputs/ui_bibz_inputs/ui_dropdown_select_field_input.rb +0 -0
  30. data/{app → lib/ui_bibz}/inputs/ui_bibz_inputs/ui_formula_field_input.rb +0 -0
  31. data/{app → lib/ui_bibz}/inputs/ui_bibz_inputs/ui_markdown_editor_field_input.rb +0 -0
  32. data/{app → lib/ui_bibz}/inputs/ui_bibz_inputs/ui_multi_column_field_input.rb +0 -0
  33. data/{app → lib/ui_bibz}/inputs/ui_bibz_inputs/ui_multi_select_field_input.rb +0 -0
  34. data/lib/ui_bibz/inputs/ui_bibz_inputs/ui_number_field_input.rb +10 -0
  35. data/{app → lib/ui_bibz}/inputs/ui_bibz_inputs/ui_radio_field_input.rb +0 -0
  36. data/{app → lib/ui_bibz}/inputs/ui_bibz_inputs/ui_select_field_input.rb +0 -0
  37. data/{app → lib/ui_bibz}/inputs/ui_bibz_inputs/ui_switch_field_input.rb +0 -0
  38. data/{app → lib/ui_bibz}/inputs/ui_bibz_inputs/ui_text_field_input.rb +0 -0
  39. data/lib/ui_bibz/rails/engine.rb +3 -9
  40. data/lib/ui_bibz/ui/core/boxes/card.rb +1 -1
  41. data/lib/ui_bibz/ui/core/boxes/card_column.rb +1 -1
  42. data/lib/ui_bibz/ui/core/boxes/card_deck.rb +1 -1
  43. data/lib/ui_bibz/ui/core/boxes/card_group.rb +1 -1
  44. data/lib/ui_bibz/ui/core/boxes/components/body/card_body_link.rb +1 -1
  45. data/lib/ui_bibz/ui/core/boxes/components/body/card_body_text.rb +1 -1
  46. data/lib/ui_bibz/ui/core/boxes/components/body/card_body_title.rb +1 -1
  47. data/lib/ui_bibz/ui/core/boxes/components/card_body.rb +1 -1
  48. data/lib/ui_bibz/ui/core/boxes/components/card_footer.rb +1 -1
  49. data/lib/ui_bibz/ui/core/boxes/components/card_header.rb +1 -1
  50. data/lib/ui_bibz/ui/core/boxes/components/card_image.rb +1 -1
  51. data/lib/ui_bibz/ui/core/boxes/jumbotron.rb +1 -1
  52. data/lib/ui_bibz/ui/core/component.rb +34 -3
  53. data/lib/ui_bibz/ui/core/forms/buttons/button.rb +11 -7
  54. data/lib/ui_bibz/ui/core/forms/buttons/button_group.rb +5 -1
  55. data/lib/ui_bibz/ui/core/forms/buttons/button_link.rb +1 -1
  56. data/lib/ui_bibz/ui/core/forms/buttons/button_refresh.rb +2 -2
  57. data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +1 -1
  58. data/lib/ui_bibz/ui/core/forms/choices/components/choice.rb +1 -1
  59. data/lib/ui_bibz/ui/core/forms/choices/radio_field.rb +1 -1
  60. data/lib/ui_bibz/ui/core/forms/choices/switch_field.rb +1 -1
  61. data/lib/ui_bibz/ui/core/forms/dates/date_picker_field.rb +1 -1
  62. data/lib/ui_bibz/ui/core/forms/dropdowns/components/dropdown_header.rb +1 -1
  63. data/lib/ui_bibz/ui/core/forms/dropdowns/components/dropdown_link.rb +1 -1
  64. data/lib/ui_bibz/ui/core/forms/dropdowns/dropdown.rb +1 -1
  65. data/lib/ui_bibz/ui/core/forms/dropdowns/split_dropdown.rb +1 -1
  66. data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +7 -2
  67. data/lib/ui_bibz/ui/core/forms/numbers/number_field.rb +63 -0
  68. data/lib/ui_bibz/ui/core/forms/selects/abstract_select.rb +1 -1
  69. data/lib/ui_bibz/ui/core/forms/selects/select_field.rb +5 -1
  70. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_addon.rb +1 -1
  71. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button.rb +1 -1
  72. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_link.rb +1 -1
  73. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_refresh.rb +1 -1
  74. data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +1 -1
  75. data/lib/ui_bibz/ui/core/forms/textareas/markdown_editor_field.rb +1 -1
  76. data/lib/ui_bibz/ui/core/forms/texts/text_field.rb +7 -3
  77. data/lib/ui_bibz/ui/core/icons/glyph.rb +10 -2
  78. data/lib/ui_bibz/ui/core/icons/star.rb +1 -1
  79. data/lib/ui_bibz/ui/core/layouts/col.rb +1 -1
  80. data/lib/ui_bibz/ui/core/layouts/container.rb +1 -1
  81. data/lib/ui_bibz/ui/core/layouts/row.rb +1 -1
  82. data/lib/ui_bibz/ui/core/lists/components/list.rb +1 -1
  83. data/lib/ui_bibz/ui/core/lists/components/list/list_body.rb +1 -1
  84. data/lib/ui_bibz/ui/core/lists/components/list/list_header.rb +1 -1
  85. data/lib/ui_bibz/ui/core/lists/list_group.rb +1 -1
  86. data/lib/ui_bibz/ui/core/navigations/breadcrumb.rb +1 -1
  87. data/lib/ui_bibz/ui/core/navigations/components/breadcrumb_link.rb +3 -3
  88. data/lib/ui_bibz/ui/core/navigations/components/nav_dropdown.rb +1 -1
  89. data/lib/ui_bibz/ui/core/navigations/components/nav_link.rb +1 -1
  90. data/lib/ui_bibz/ui/core/navigations/components/nav_link_link.rb +1 -1
  91. data/lib/ui_bibz/ui/core/navigations/components/nav_link_list.rb +1 -1
  92. data/lib/ui_bibz/ui/core/navigations/components/nav_text.rb +1 -1
  93. data/lib/ui_bibz/ui/core/navigations/components/navbar_brand.rb +1 -1
  94. data/lib/ui_bibz/ui/core/navigations/components/navbar_form.rb +19 -17
  95. data/lib/ui_bibz/ui/core/navigations/components/navbar_text.rb +1 -1
  96. data/lib/ui_bibz/ui/core/navigations/components/pagination_link.rb +1 -1
  97. data/lib/ui_bibz/ui/core/navigations/link.rb +8 -2
  98. data/lib/ui_bibz/ui/core/navigations/nav.rb +1 -1
  99. data/lib/ui_bibz/ui/core/navigations/navbar.rb +10 -5
  100. data/lib/ui_bibz/ui/core/navigations/pagination.rb +1 -1
  101. data/lib/ui_bibz/ui/core/navigations/toolbar.rb +5 -8
  102. data/lib/ui_bibz/ui/core/notifications/alert.rb +1 -1
  103. data/lib/ui_bibz/ui/core/notifications/badge.rb +1 -1
  104. data/lib/ui_bibz/ui/core/notifications/components/alert_body.rb +1 -1
  105. data/lib/ui_bibz/ui/core/notifications/components/alert_header.rb +1 -1
  106. data/lib/ui_bibz/ui/core/notifications/components/bar.rb +1 -1
  107. data/lib/ui_bibz/ui/core/notifications/progress_bar.rb +1 -1
  108. data/lib/ui_bibz/ui/core/windows/components/modal_body.rb +1 -1
  109. data/lib/ui_bibz/ui/core/windows/components/modal_footer.rb +1 -1
  110. data/lib/ui_bibz/ui/core/windows/components/modal_header.rb +1 -1
  111. data/lib/ui_bibz/ui/core/windows/modal.rb +1 -1
  112. data/lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb +22 -4
  113. data/lib/ui_bibz/ui/ux/containers/components/panel_body.rb +51 -0
  114. data/lib/ui_bibz/ui/ux/containers/components/panel_column.rb +48 -0
  115. data/lib/ui_bibz/ui/ux/containers/components/panel_deck.rb +50 -0
  116. data/lib/ui_bibz/ui/ux/containers/components/panel_footer.rb +52 -0
  117. data/lib/ui_bibz/ui/ux/containers/components/panel_group.rb +46 -0
  118. data/lib/ui_bibz/ui/ux/containers/components/panel_header.rb +61 -0
  119. data/lib/ui_bibz/ui/ux/containers/components/panel_toolbar.rb +38 -0
  120. data/lib/ui_bibz/ui/ux/containers/panel.rb +104 -0
  121. data/lib/ui_bibz/ui/ux/tables/components/thead.rb +1 -1
  122. data/lib/ui_bibz/ui/ux/tables/table.rb +1 -1
  123. data/lib/ui_bibz/ui/ux/tables/table_card.rb +1 -1
  124. data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +1 -1
  125. data/lib/ui_bibz/utils/internationalization.rb +3 -0
  126. data/lib/ui_bibz/version.rb +1 -1
  127. data/test/factories/user.rb +1 -1
  128. data/test/simple_form_test.rb +2 -2
  129. data/test/support/factory_bot.rb +9 -0
  130. data/test/test_helper.rb +0 -1
  131. data/test/ui/core/boxes/card_test.rb +1 -1
  132. data/test/ui/core/component_test.rb +8 -1
  133. data/test/ui/core/forms/buttons/button_group_test.rb +1 -1
  134. data/test/ui/core/forms/buttons/button_link_test.rb +1 -1
  135. data/test/ui/core/forms/buttons/button_refresh_test.rb +1 -1
  136. data/test/ui/core/forms/buttons/button_test.rb +2 -2
  137. data/test/ui/core/forms/choices/choice_group_test.rb +1 -1
  138. data/test/ui/core/forms/dropdowns/dropdown_test.rb +1 -1
  139. data/test/ui/core/forms/numbers/formula_field_test.rb +1 -1
  140. data/test/ui/core/forms/selects/dropdown_select_field_test.rb +1 -1
  141. data/test/ui/core/forms/selects/multi_select_field_test.rb +1 -1
  142. data/test/ui/core/forms/selects/select_field_test.rb +1 -1
  143. data/test/ui/core/forms/surrounds/surround_field_test.rb +3 -3
  144. data/test/ui/core/forms/texts/auto_complete_field_test.rb +2 -2
  145. data/test/ui/core/forms/texts/text_field_test.rb +1 -1
  146. data/test/ui/core/icons/glyph_test.rb +6 -4
  147. data/test/ui/core/icons/star_test.rb +6 -6
  148. data/test/ui/core/navigations/breadcrumb_test.rb +1 -1
  149. data/test/ui/core/navigations/navbar_test.rb +1 -1
  150. data/test/ui/core/notifications/alert_test.rb +1 -1
  151. data/test/ui/core/notifications/badge_test.rb +2 -2
  152. data/test/ui/ux/containers/panel_test.rb +143 -0
  153. data/test/ui/ux/tables/table_test.rb +3 -3
  154. data/ui_bibz.gemspec +3 -12
  155. data/vendor/assets/javascripts/bootstrap-markdown.js +12 -12
  156. data/vendor/assets/javascripts/jquery-ui.min.js +6 -0
  157. data/vendor/assets/stylesheets/jquery-ui.min.css +6 -0
  158. metadata +63 -27
  159. data/app/inputs/ui_bibz_form/ui_bibz_form_builder.rb +0 -36
  160. data/test/support/factory_girl.rb +0 -6
@@ -61,4 +61,8 @@ module UiBibz::Helpers::Ui::UxHelper
61
61
  end
62
62
  end
63
63
 
64
+ def ui_panel content = nil, options = nil, html_options = nil, &block
65
+ UiBibz::Ui::Ux::Containers::Panel.new(content, options, html_options).tap(&block).render
66
+ end
67
+
64
68
  end
@@ -0,0 +1,38 @@
1
+ module UiBibzForm
2
+ if defined?(SimpleForm)
3
+ class UiBibzFormBuilder < SimpleForm::FormBuilder
4
+ include ActionView::Helpers::TagHelper
5
+ include ActionView::Helpers::TextHelper
6
+ include UiBibz::Utils
7
+
8
+ attr_accessor :output_buffer
9
+
10
+ def ui_surround_field content = nil, opts = nil, html_options = nil, &block
11
+ content = (options || {}).merge(content || {})
12
+ content = content.merge(template: @template, form: self)
13
+
14
+ input_classes = UiBibz::Utils::Screwdriver.join_classes('form-group', 'surround_field', options[:input_html].try(:[], :class))
15
+ wrapper_html = (options[:input_html] || {}).merge({ class: input_classes })
16
+
17
+ content_tag :div, wrapper_html do
18
+ concat content_tag(:label, content[:label]) unless content[:label].nil?
19
+ concat UiBibz::Ui::Core::Forms::Surrounds::SurroundField.new(content, opts, html_options).tap(&block).render
20
+ end
21
+ end
22
+
23
+ def ui_button_group content = nil, opts = nil, html_options = nil, &block
24
+ content = (options || {}).merge(content || {})
25
+ content = content.merge(template: @template, form: self)
26
+
27
+ input_classes = UiBibz::Utils::Screwdriver.join_classes('button_group', options[:input_html].try(:[], :class))
28
+ wrapper_html = (options[:input_html] || {}).merge({ class: input_classes })
29
+
30
+ content_tag :div, wrapper_html do
31
+ concat content_tag(:label, content[:label]) unless content[:label].nil?
32
+ concat UiBibz::Ui::Core::Forms::Buttons::ButtonGroup.new(content, opts, html_options).tap(&block).render
33
+ end
34
+ end
35
+
36
+ end
37
+ end
38
+ end
@@ -17,17 +17,21 @@ module UiBibzInputs
17
17
  def new_options
18
18
  label_method, value_method = detect_collection_methods
19
19
 
20
- if options[:grouped] == true
21
- options.merge({ option_tags: option_groups_from_collection_for_select(
22
- grouped_collection,
23
- group_method, group_label_method,
24
- value_method, label_method,
25
- new_value
26
- )})
20
+ if options[:option_tags].nil?
21
+ if options[:grouped] == true
22
+ options.merge({ option_tags: option_groups_from_collection_for_select(
23
+ grouped_collection,
24
+ group_method, group_label_method,
25
+ value_method, label_method,
26
+ new_value
27
+ )})
28
+ else
29
+ options.merge({ option_tags: options_from_collection_for_select(
30
+ collection, value_method, label_method, new_value
31
+ )})
32
+ end
27
33
  else
28
- options.merge({ option_tags: options_from_collection_for_select(
29
- collection, value_method, label_method, new_value
30
- )})
34
+ options
31
35
  end
32
36
  end
33
37
 
@@ -51,7 +55,7 @@ module UiBibzInputs
51
55
  end
52
56
 
53
57
  def input_attribute_name
54
- "#{ @builder.object.class.to_s.underscore }[#{ attribute_name }]"
58
+ "#{ @builder.object.class.to_s.parameterize.underscore }[#{ attribute_name }]"
55
59
  end
56
60
 
57
61
  def collection
@@ -0,0 +1,10 @@
1
+ module UiBibzInputs
2
+ class UiNumberFieldInput < UiTextFieldInput
3
+ include UiBibz::Ui::Core::Forms::Numbers
4
+
5
+ def input(wrapper_options)
6
+ UiBibz::Ui::Core::Forms::Numbers::NumberField.new(input_attribute_name, options, input_html_options).render
7
+ end
8
+
9
+ end
10
+ end
@@ -4,15 +4,7 @@ require 'jquery-rails'
4
4
  require 'popper_js'
5
5
  require 'bootstrap'
6
6
  require "font-awesome-sass"
7
-
8
- # Javascript requires
9
- #require 'rails-assets-tether'
10
- #require 'rails-assets-bootstrap-datepicker'
11
- #require 'rails-assets-bootstrap-select'
12
- #
13
- # not compatible with boostrap 4
14
- #require 'rails-assets-bootstrap-switch'
15
- #require 'rails-assets-bootstrap-multiselect'
7
+ require 'simple_form' if system('gem list -i simple_form')
16
8
 
17
9
  module UiBibz
18
10
  module Rails
@@ -26,6 +18,8 @@ module UiBibz
26
18
  ActionView::Base.send :include, UiBibz::Helpers::Ui::UxHelper
27
19
  end
28
20
 
21
+ config.autoload_paths += Dir["#{config.root}/lib/ui_bibz/inputs/**/"] if defined?(::SimpleForm)
22
+
29
23
  end
30
24
  end
31
25
  end
@@ -127,7 +127,7 @@ module UiBibz::Ui::Core::Boxes
127
127
  end
128
128
 
129
129
  # Render html tag
130
- def render
130
+ def pre_render
131
131
  content_tag :div, html_structure, html_options
132
132
  end
133
133
 
@@ -38,7 +38,7 @@ module UiBibz::Ui::Core::Boxes
38
38
  end
39
39
 
40
40
  # Render html tag
41
- def render
41
+ def pre_render
42
42
  content_tag :div, @items.join.html_safe, html_options
43
43
  end
44
44
 
@@ -38,7 +38,7 @@ module UiBibz::Ui::Core::Boxes
38
38
  end
39
39
 
40
40
  # Render html tag
41
- def render
41
+ def pre_render
42
42
  content_tag :div, html_options do
43
43
  content_tag :div, @items.join.html_safe, class: 'card-deck'
44
44
  end
@@ -38,7 +38,7 @@ module UiBibz::Ui::Core::Boxes
38
38
  end
39
39
 
40
40
  # Render html tag
41
- def render
41
+ def pre_render
42
42
  content_tag :div, @items.join.html_safe, html_options
43
43
  end
44
44
 
@@ -37,7 +37,7 @@ module UiBibz::Ui::Core::Boxes::Components::Body
37
37
  end
38
38
 
39
39
  # Render html tag
40
- def render
40
+ def pre_render
41
41
  link_to content, options[:url], html_options
42
42
  end
43
43
 
@@ -37,7 +37,7 @@ module UiBibz::Ui::Core::Boxes::Components::Body
37
37
  end
38
38
 
39
39
  # Render html tag
40
- def render
40
+ def pre_render
41
41
  content_tag :p, content.html_safe, html_options
42
42
  end
43
43
 
@@ -37,7 +37,7 @@ module UiBibz::Ui::Core::Boxes::Components::Body
37
37
  end
38
38
 
39
39
  # Render html tag
40
- def render
40
+ def pre_render
41
41
  content_tag :h4, content, html_options
42
42
  end
43
43
 
@@ -41,7 +41,7 @@ module UiBibz::Ui::Core::Boxes::Components
41
41
  end
42
42
 
43
43
  # Render html tag
44
- def render
44
+ def pre_render
45
45
  content_tag :div, @items.join.html_safe, html_options
46
46
  end
47
47
 
@@ -37,7 +37,7 @@ module UiBibz::Ui::Core::Boxes::Components
37
37
  end
38
38
 
39
39
  # Render html tag
40
- def render
40
+ def pre_render
41
41
  content_tag :div, glyph_and_content_html, html_options
42
42
  end
43
43
 
@@ -37,7 +37,7 @@ module UiBibz::Ui::Core::Boxes::Components
37
37
  end
38
38
 
39
39
  # Render html tag
40
- def render
40
+ def pre_render
41
41
  content_tag :div, glyph_and_content_html, html_options
42
42
  end
43
43
 
@@ -39,7 +39,7 @@ module UiBibz::Ui::Core::Boxes::Components
39
39
  end
40
40
 
41
41
  # Render html tag
42
- def render
42
+ def pre_render
43
43
  #image_tag asset_path("assets/#{content}"), html_options
44
44
  image_tag content, html_options
45
45
  end
@@ -48,7 +48,7 @@ module UiBibz::Ui::Core::Boxes
48
48
  end
49
49
 
50
50
  # Render html tag
51
- def render
51
+ def pre_render
52
52
  content_tag :div, html_options do
53
53
  if fluid
54
54
  UiBibz::Ui::Core::Layouts::Container.new(content).render
@@ -52,8 +52,13 @@ module UiBibz::Ui::Core
52
52
  def initialize content = nil, options = nil, html_options = nil, &block
53
53
  if !block.nil?
54
54
  @html_options, @options = options, content
55
- context = eval("self", block.binding)
56
- @content = context.capture(&block)
55
+ read_cache = Rails.cache.read(@options.try(:[], :cache))
56
+ if read_cache.nil?
57
+ context = eval("self", block.binding)
58
+ @content = context.capture(&block)
59
+ else
60
+ @content = read_cache
61
+ end
57
62
  else
58
63
  if content.kind_of?(Hash)
59
64
  @html_options, @options = options, content
@@ -67,8 +72,13 @@ module UiBibz::Ui::Core
67
72
  init_component_html_options
68
73
  end
69
74
 
70
- # Render html tag
75
+ # Render html tag with or without cache
71
76
  def render
77
+ render_with_or_without_cache
78
+ end
79
+
80
+ # Render without cache
81
+ def pre_render
72
82
  glyph_and_content_html
73
83
  end
74
84
 
@@ -87,6 +97,12 @@ module UiBibz::Ui::Core
87
97
 
88
98
  # Override this method to add html data
89
99
  def component_html_data
100
+ # To stimulusjs
101
+ add_html_data :target, options.try(:delete, :target)
102
+ add_html_data :controller, options.try(:delete, :controller)
103
+ add_html_data :action, options.try(:delete, :action)
104
+ # To turbolinks
105
+ add_html_data :turbolinks, options.try(:delete, :turbolinks)
90
106
  end
91
107
 
92
108
  # Override this method to add html Options
@@ -115,6 +131,21 @@ module UiBibz::Ui::Core
115
131
 
116
132
  private
117
133
 
134
+ def render_with_or_without_cache
135
+ if options[:cache]
136
+ cache = Rails.cache
137
+ read_cache = cache.read(options[:cache])
138
+ if read_cache
139
+ read_cache
140
+ else
141
+ cache.write(options[:cache], pre_render)
142
+ pre_render
143
+ end
144
+ else
145
+ pre_render
146
+ end
147
+ end
148
+
118
149
  def init_options
119
150
  @options = component_options.merge(@options)
120
151
  end
@@ -57,7 +57,7 @@ module UiBibz::Ui::Core::Forms::Buttons
57
57
  end
58
58
 
59
59
  # Render html tag
60
- def render
60
+ def pre_render
61
61
  button_html_tag
62
62
  end
63
63
 
@@ -65,7 +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 glyph_and_content_html(options[:text].nil? ? @content : ' ')
68
+ concat glyph_and_content_html(options[:text].nil? ? @content : '')
69
69
  concat badge_html unless options[:badge].nil?
70
70
  end
71
71
  end
@@ -78,11 +78,15 @@ module UiBibz::Ui::Core::Forms::Buttons
78
78
  opts = super
79
79
  opts = opts.merge(toggle) unless options[:toggle].nil?
80
80
  opts = opts.merge(active_html_options) if options[:state] == :active
81
- opts = opts.merge(html_title) if options[:text] == false
82
81
  opts = opts.merge({ disabled: 'disabled' }) if options[:state] == :disabled
83
82
  opts
84
83
  end
85
84
 
85
+ def component_html_data
86
+ super
87
+ action
88
+ end
89
+
86
90
  def status
87
91
  ["btn", outline, options[:status]].compact.join('-')
88
92
  end
@@ -91,10 +95,6 @@ module UiBibz::Ui::Core::Forms::Buttons
91
95
  "outline" unless options[:outline].nil?
92
96
  end
93
97
 
94
- def html_title
95
- { title: content }
96
- end
97
-
98
98
  def toggle
99
99
  { "data-toggle" => 'button', "aria-pressed" => false, "autocomplete" => "off" }
100
100
  end
@@ -111,6 +111,10 @@ module UiBibz::Ui::Core::Forms::Buttons
111
111
  "without-text" unless options[:text].nil?
112
112
  end
113
113
 
114
+ def action
115
+ add_html_data('action', options[:action]) unless options[:action].nil?
116
+ end
117
+
114
118
  def badge_html
115
119
  if options[:badge].kind_of? Hash
116
120
  options[:badge][:status] = options[:badge][:status] || options[:status] || :secondary
@@ -51,7 +51,7 @@ module UiBibz::Ui::Core::Forms::Buttons
51
51
  end
52
52
 
53
53
  # Render html tag
54
- def render
54
+ def pre_render
55
55
  content_tag :div, @items.join.html_safe, html_options
56
56
  end
57
57
 
@@ -86,6 +86,10 @@ module UiBibz::Ui::Core::Forms::Buttons
86
86
  @items << @options[:form].input(attribute_name, options.merge({ label: false, wrapper: false }), &block)
87
87
  end
88
88
 
89
+ def html content = nil, options = nil, html_options = nil, &block
90
+ @items << UiBibz::Ui::Core::Component.new(content, options, html_options, &block).render
91
+ end
92
+
89
93
  private
90
94
 
91
95
  def component_html_classes
@@ -59,7 +59,7 @@ module UiBibz::Ui::Core::Forms::Buttons
59
59
  end
60
60
 
61
61
  # Render html tag
62
- def render
62
+ def pre_render
63
63
  button_link_html_tag
64
64
  end
65
65
 
@@ -56,7 +56,7 @@ module UiBibz::Ui::Core::Forms::Buttons
56
56
  super
57
57
  end
58
58
 
59
- def render
59
+ def pre_render
60
60
  button_refresh_html_tag
61
61
  end
62
62
 
@@ -68,7 +68,7 @@ module UiBibz::Ui::Core::Forms::Buttons
68
68
 
69
69
  def component_options
70
70
  options[:connect] = cnt_opts
71
- super.merge({ glyph: 'refresh', status: options[:status] })
71
+ super.merge({ glyph: 'sync-alt', status: options[:status] })
72
72
  end
73
73
 
74
74
  def component_html_classes