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
@@ -49,7 +49,7 @@ module UiBibz::Ui::Core::Navigations
49
49
  end
50
50
 
51
51
  # Render html tag
52
- def render
52
+ def pre_render
53
53
  content_tag :li, html_options do
54
54
  concat link_html
55
55
  concat ul_html
@@ -46,7 +46,7 @@ module UiBibz::Ui::Core::Navigations
46
46
  end
47
47
 
48
48
  # Render html tag
49
- def render
49
+ def pre_render
50
50
  if options[:nav_type] == "nav-links"
51
51
  UiBibz::Ui::Core::Navigations::NavLinkLink.new(content, options, html_options).render
52
52
  else
@@ -25,7 +25,7 @@ module UiBibz::Ui::Core::Navigations
25
25
  end
26
26
 
27
27
  # Render html tag
28
- def render
28
+ def pre_render
29
29
  link_to options[:url], html_options do
30
30
  concat glyph_and_content_html
31
31
  concat tag_html if options[:tag]
@@ -21,7 +21,7 @@ module UiBibz::Ui::Core::Navigations
21
21
  end
22
22
 
23
23
  # Render html tag
24
- def render
24
+ def pre_render
25
25
  content_tag :li, content, html_options
26
26
  end
27
27
 
@@ -25,7 +25,7 @@ module UiBibz::Ui::Core::Navigations
25
25
  end
26
26
 
27
27
  # Render html tag
28
- def render
28
+ def pre_render
29
29
  options[:nav_type] == "nav-links" ? content_html : content_tag(:li, content_html, class: 'nav-item nav-text')
30
30
  end
31
31
 
@@ -22,7 +22,7 @@ module UiBibz::Ui::Core::Navigations
22
22
  end
23
23
 
24
24
  # Render html tag
25
- def render
25
+ def pre_render
26
26
  link_to content, brand_url, html_options
27
27
  end
28
28
 
@@ -41,34 +41,40 @@ module UiBibz::Ui::Core::Navigations
41
41
  #
42
42
  class NavbarForm < UiBibz::Ui::Base
43
43
  include Haml::Helpers
44
- include SimpleForm::ActionViewExtensions::FormHelper
44
+ include SimpleForm::ActionViewExtensions::FormHelper if defined?(SimpleForm)
45
45
  include UiBibz::Helpers::UtilsHelper
46
46
  include ActionView::Helpers#::FormHelper
47
47
 
48
+ attr_accessor :html_options
49
+
48
50
  def initialize model_or_url, options = {}, &block
49
51
  init_haml_helpers
50
- @options = options
52
+ @content = block
53
+ @model_or_url = model_or_url
54
+ @options = options
55
+ @html_options = !%i(form_for ui_form_for).include?(type) ? html_options_for_form(@model_or_url, new_option) : new_option
56
+ end
57
+
58
+ # Render html tag
59
+ def render
51
60
  case type
52
61
  when :form_for
53
- @form = form_for(model_or_url, new_option, &block)
62
+ @form = form_for(@model_or_url, html_options, &@content)
54
63
  when :ui_form_for
55
- @form = ui_form_for(model_or_url, new_option, &block)
64
+ begin
65
+ @form = ui_form_for(@model_or_url, html_options, &@content)
66
+ rescue
67
+ raise 'You must install simple form to use ui_form_for.'
68
+ end
56
69
  else
57
- #@form = form_tag(model_or_url, class: "navbar-form form-inline #{ position }", block)
58
- html_options = html_options_for_form(model_or_url, new_option)
59
- @form = form_tag_with_body(html_options, capture(&block))
70
+ @form = form_tag_with_body(html_options, capture(&@content))
60
71
  end
61
72
  end
62
73
 
63
- # Render html tag
64
- def render
65
- @form
66
- end
67
-
68
74
  private
69
75
 
70
76
  def new_option
71
- (@options || {}).merge({ class: "navbar-form form-inline #{ position } my-2 my-lg-0" })
77
+ (@options || {}).merge({ class: UiBibz::Utils::Screwdriver.join_classes("navbar-form", "form-inline", "my-lg-0", "my-2", @options[:class]) })
72
78
  end
73
79
 
74
80
  def protect_against_forgery?
@@ -83,9 +89,5 @@ module UiBibz::Ui::Core::Navigations
83
89
  @options[:type] || :form_for
84
90
  end
85
91
 
86
- def position
87
- "pull-#{ @options[:position] }" unless @options[:position].nil?
88
- end
89
-
90
92
  end
91
93
  end
@@ -39,7 +39,7 @@ module UiBibz::Ui::Core::Navigations
39
39
  end
40
40
 
41
41
  # Render html tag
42
- def render
42
+ def pre_render
43
43
  content_tag :span, content, html_options
44
44
  end
45
45
 
@@ -44,7 +44,7 @@ module UiBibz::Ui::Core::Navigations
44
44
  end
45
45
 
46
46
  # Render html tag
47
- def render
47
+ def pre_render
48
48
  content_tag :li, html_options do
49
49
  link_to content, options[:url], class: 'page-link'
50
50
  end
@@ -46,8 +46,14 @@ module UiBibz::Ui::Core::Navigations
46
46
  end
47
47
 
48
48
  # Render html tag
49
- def render
50
- link_to content, options[:url] || '#', html_options
49
+ def pre_render
50
+ link_to glyph_and_content_html, options[:url] || '#', html_options
51
+ end
52
+
53
+ private
54
+
55
+ def text
56
+ @options[:text].nil? ? true : @options[:text]
51
57
  end
52
58
 
53
59
  end
@@ -73,7 +73,7 @@ module UiBibz::Ui::Core::Navigations
73
73
  end
74
74
 
75
75
  # Render html tag
76
- def render
76
+ def pre_render
77
77
  content_tag tag, @items.map(&:render).join.html_safe, html_options
78
78
  end
79
79
 
@@ -77,7 +77,7 @@ module UiBibz::Ui::Core::Navigations
77
77
  end
78
78
 
79
79
  # Render html tag
80
- def render
80
+ def pre_render
81
81
  content_tag :nav, html_options do
82
82
  concat title if brand_position == :left
83
83
  concat navbar_toggle_button_html
@@ -90,26 +90,31 @@ module UiBibz::Ui::Core::Navigations
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::Navigations::NavbarNav.new(content, options, html_options).tap(&block).render
93
+ @items << UiBibz::Ui::Core::Navigations::NavbarNav.new(content, options, html_options).tap(&block)
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::Navigations::NavbarForm.new(model_or_url, options, &block).render
99
+ @items << UiBibz::Ui::Core::Navigations::NavbarForm.new(model_or_url, options, &block)
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::Navigations::NavbarText.new(content, options, html_options, &block).render
106
+ @items << UiBibz::Ui::Core::Navigations::NavbarText.new(content, options, html_options, &block)
107
107
  end
108
108
 
109
109
  def brand content = nil, options = nil, html_options = nil, &block
110
110
  @brand = UiBibz::Ui::Core::Navigations::NavbarBrand.new(content, options, html_options, &block).render
111
111
  end
112
112
 
113
+ def spacer num = "auto"
114
+ kls = " mr-#{ num }"
115
+ @items.last.html_options[:class].nil? ? @items.last.html_options[:class] = kls : @items.last.html_options[:class] << kls
116
+ end
117
+
113
118
  def id
114
119
  @id ||= generate_id("navbar-id")
115
120
  end
@@ -130,7 +135,7 @@ module UiBibz::Ui::Core::Navigations
130
135
 
131
136
  def body_html
132
137
  content_tag :div, class: "collapse navbar-collapse", id: id do
133
- concat @items.join.html_safe
138
+ concat @items.map(&:render).join.html_safe
134
139
  end
135
140
  end
136
141
 
@@ -60,7 +60,7 @@ module UiBibz::Ui::Core::Navigations
60
60
  end
61
61
 
62
62
  # Render html tag
63
- def render
63
+ def pre_render
64
64
  content_tag :nav do
65
65
  content_tag :ul, @items.join.html_safe, html_options
66
66
  end
@@ -58,17 +58,14 @@ module UiBibz::Ui::Core::Navigations
58
58
  end
59
59
 
60
60
  # Render html tag
61
- def render
61
+ def pre_render
62
62
  content_tag :div, @items.map(&:render).join.html_safe, html_options
63
63
  end
64
64
 
65
- def button_group content = nil, options = nil, html_options = nil, &block
66
- if block.nil?
67
- options = @options.merge(options || {})
68
- else
69
- content = @options.merge(content || {})
70
- end
71
- @items << UiBibz::Ui::Core::Forms::Buttons::ButtonGroup.new(content, options, html_options).tap(&block)
65
+ def button_group c = nil, o = nil, ho = nil, &block
66
+ c = @options.merge(c || {})
67
+ (c || {}).delete(:class)
68
+ @items << UiBibz::Ui::Core::Forms::Buttons::ButtonGroup.new(c, o, ho).tap(&block)
72
69
  end
73
70
 
74
71
  def spacer num = "auto"
@@ -56,7 +56,7 @@ module UiBibz::Ui::Core::Notifications
56
56
  end
57
57
 
58
58
  # Render html tag
59
- def render
59
+ def pre_render
60
60
  content_tag :div, html_options do
61
61
  concat @header
62
62
  concat @body unless @body.nil?
@@ -55,7 +55,7 @@ module UiBibz::Ui::Core::Notifications
55
55
  end
56
56
 
57
57
  # Render html tag
58
- def render
58
+ def pre_render
59
59
  content_tag :span, glyph_and_content_html, html_options
60
60
  end
61
61
 
@@ -36,7 +36,7 @@ module UiBibz::Ui::Core::Notifications::Components
36
36
  super
37
37
  end
38
38
 
39
- def render
39
+ def pre_render
40
40
  tag(:hr) + content_tag(:p, content, html_options)
41
41
  end
42
42
 
@@ -36,7 +36,7 @@ module UiBibz::Ui::Core::Notifications::Components
36
36
  super
37
37
  end
38
38
 
39
- def render
39
+ def pre_render
40
40
  if options[:tap]
41
41
  content_tag :h4, html_content, html_options
42
42
  else
@@ -48,7 +48,7 @@ module UiBibz::Ui::Core::Notifications::Components
48
48
  end
49
49
 
50
50
  # Render html tag
51
- def render
51
+ def pre_render
52
52
  content_tag :div, '', html_options
53
53
  end
54
54
 
@@ -62,7 +62,7 @@ module UiBibz::Ui::Core::Notifications
62
62
  end
63
63
 
64
64
  # Render html tag
65
- def render
65
+ def pre_render
66
66
  content_tag :div, bars.join.html_safe, html_options
67
67
  end
68
68
 
@@ -37,7 +37,7 @@ module UiBibz::Ui::Core::Windows::Components
37
37
  end
38
38
 
39
39
  # Render html tag
40
- def render
40
+ def pre_render
41
41
  content_tag :div, content, html_options
42
42
  end
43
43
 
@@ -37,7 +37,7 @@ module UiBibz::Ui::Core::Windows::Components
37
37
  end
38
38
 
39
39
  # Render html tag
40
- def render
40
+ def pre_render
41
41
  content_tag :div, content, html_options
42
42
  end
43
43
 
@@ -37,7 +37,7 @@ module UiBibz::Ui::Core::Windows::Components
37
37
  end
38
38
 
39
39
  # Render html tag
40
- def render
40
+ def pre_render
41
41
  content_tag :div, html_options do
42
42
  concat content_tag :h5, glyph_and_content_html, class: 'modal-title'
43
43
  concat close_button_html
@@ -60,7 +60,7 @@ module UiBibz::Ui::Core::Windows
60
60
  end
61
61
 
62
62
  # Render html tag
63
- def render
63
+ def pre_render
64
64
  content_tag :div, html_options do
65
65
  content_tag :div, class: "modal-dialog #{ size }", role: 'document' do
66
66
  content_tag :div, class: 'modal-content' do
@@ -2,18 +2,36 @@ module GlyphExtension
2
2
 
3
3
  # Render glyph and content html
4
4
  def glyph_and_content_html content_html = nil
5
- [glyph_with_space, content_html || content].compact.join.html_safe
5
+ [glyph_with_space, ct_html(content_html)].compact.join(' ').html_safe
6
+ end
7
+
8
+ def ct_html content_html
9
+ if options[:text].nil? || options[:text] == true
10
+ content_html || content
11
+ end
6
12
  end
7
13
 
8
14
  # Render glyph with space html
9
15
  def glyph_with_space
10
- "#{ glyph } " unless glyph.nil?
16
+ out = [glyph]
17
+ out << " " if options[:text] != false
18
+ out.join unless glyph.nil?
11
19
  end
12
20
 
13
21
  # Render glyph html
14
22
  def glyph
15
- glyph_info = options[:glyph] if options.kind_of?(Hash)
16
- UiBibz::Ui::Core::Icons::Glyph.new(glyph_info).render unless glyph_info.nil?
23
+ if options.kind_of?(Hash)
24
+ if options[:glyph].kind_of?(Hash)
25
+ glyph_name = options[:glyph].try(:[], :name)
26
+ glyph_opts = options[:glyph]
27
+ else
28
+ glyph_name = options[:glyph]
29
+ glyph_opts = {}
30
+ end
31
+ glyph_html_opts = options[:text].nil? ? {} : (options[:text] ? {} : { title: content })
32
+ end
33
+
34
+ UiBibz::Ui::Core::Icons::Glyph.new(glyph_name, glyph_opts, glyph_html_opts).render unless glyph_name.nil?
17
35
  end
18
36
 
19
37
  end
@@ -0,0 +1,51 @@
1
+ module UiBibz::Ui::Ux::Containers::Components
2
+
3
+ # Create a card 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::Boxes::PanelBody.new(content, options = nil, html_options = nil)
19
+ #
20
+ # UiBibz::Ui::Core::Boxes::PanelBody.new(options = nil, html_options = nil) do
21
+ # content
22
+ # end
23
+ #
24
+ # ==== Examples
25
+ #
26
+ # UiBibz::Ui::Core::Boxes::PanelBody.new.render
27
+ #
28
+ # UiBibz::Ui::Core::Boxes::PanelBody.new do
29
+ # 'Exemple'
30
+ # end.render
31
+ #
32
+ class PanelBody < 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
+ # Render html tag
40
+ def pre_render
41
+ content_tag :div, glyph_and_content_html, html_options
42
+ end
43
+
44
+ private
45
+
46
+ def component_html_classes
47
+ super << ["panel-body"]
48
+ end
49
+
50
+ end
51
+ end