ui_bibz 1.2.5.3 → 2.0.0.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Gemfile +1 -0
  4. data/Gemfile.lock +10 -7
  5. data/README.md +8 -1042
  6. data/app/assets/javascripts/multi_column.coffee +45 -0
  7. data/app/assets/javascripts/{ui_bibz.js.coffee → ui_bibz.coffee} +16 -3
  8. data/app/assets/stylesheets/fix-bootstrap-4.sass +2 -0
  9. data/app/assets/stylesheets/ui_bibz.sass +22 -9
  10. data/app/inputs/custom_inputs/date_picker_input.rb +10 -0
  11. data/app/inputs/custom_inputs/date_picker_input_old.rb +61 -0
  12. data/app/inputs/custom_inputs/multi_column_input.rb +18 -0
  13. data/app/inputs/custom_inputs/multi_select_input.rb +15 -0
  14. data/app/inputs/custom_inputs/surround_input.rb +10 -0
  15. data/doc/UiBibz.html +2 -2
  16. data/doc/UiBibz/Concerns.html +1 -1
  17. data/doc/UiBibz/Concerns/Models.html +1 -1
  18. data/doc/UiBibz/Concerns/Models/Searchable.html +1 -1
  19. data/doc/UiBibz/Concerns/Models/Searchable/ClassMethods.html +5 -5
  20. data/doc/UiBibz/Helpers.html +1 -1
  21. data/doc/UiBibz/Helpers/MetaHelper.html +1 -1
  22. data/doc/UiBibz/Helpers/UiCoreHelper.html +1 -1
  23. data/doc/UiBibz/Helpers/UiUxHelper.html +1 -1
  24. data/doc/UiBibz/Helpers/UtilsHelper.html +1 -1
  25. data/doc/UiBibz/Rails.html +1 -1
  26. data/doc/UiBibz/Rails/Engine.html +1 -1
  27. data/doc/UiBibz/Ui.html +1 -1
  28. data/doc/UiBibz/Ui/Base.html +1 -1
  29. data/doc/UiBibz/Ui/Core.html +1 -1
  30. data/doc/UiBibz/Ui/Core/Alert.html +1 -1
  31. data/doc/UiBibz/Ui/Core/Bar.html +1 -1
  32. data/doc/UiBibz/Ui/Core/Breadcrumb.html +1 -1
  33. data/doc/UiBibz/Ui/Core/BreadcrumbLink.html +1 -1
  34. data/doc/UiBibz/Ui/Core/Button.html +1 -1
  35. data/doc/UiBibz/Ui/Core/ButtonDropdown.html +1 -1
  36. data/doc/UiBibz/Ui/Core/ButtonGroup.html +1 -1
  37. data/doc/UiBibz/Ui/Core/ButtonLink.html +1 -1
  38. data/doc/UiBibz/Ui/Core/ButtonSplitDropdown.html +1 -1
  39. data/doc/UiBibz/Ui/Core/Col.html +1 -1
  40. data/doc/UiBibz/Ui/Core/Component.html +1 -1
  41. data/doc/UiBibz/Ui/Core/Dropdown.html +1 -1
  42. data/doc/UiBibz/Ui/Core/DropdownDivider.html +1 -1
  43. data/doc/UiBibz/Ui/Core/DropdownHeader.html +1 -1
  44. data/doc/UiBibz/Ui/Core/DropdownLink.html +1 -1
  45. data/doc/UiBibz/Ui/Core/Glyph.html +1 -1
  46. data/doc/UiBibz/Ui/Core/Jumbotron.html +1 -1
  47. data/doc/UiBibz/Ui/Core/Label.html +1 -1
  48. data/doc/UiBibz/Ui/Core/List.html +1 -1
  49. data/doc/UiBibz/Ui/Core/ListGroup.html +1 -1
  50. data/doc/UiBibz/Ui/Core/Modal.html +1 -1
  51. data/doc/UiBibz/Ui/Core/ModalBody.html +1 -1
  52. data/doc/UiBibz/Ui/Core/ModalFooter.html +1 -1
  53. data/doc/UiBibz/Ui/Core/ModalHeader.html +1 -1
  54. data/doc/UiBibz/Ui/Core/Nav.html +1 -1
  55. data/doc/UiBibz/Ui/Core/NavDropdown.html +1 -1
  56. data/doc/UiBibz/Ui/Core/NavLink.html +1 -1
  57. data/doc/UiBibz/Ui/Core/Navbar.html +1 -1
  58. data/doc/UiBibz/Ui/Core/NavbarForm.html +1 -1
  59. data/doc/UiBibz/Ui/Core/NavbarNav.html +1 -1
  60. data/doc/UiBibz/Ui/Core/NavbarText.html +1 -1
  61. data/doc/UiBibz/Ui/Core/Panel.html +1 -1
  62. data/doc/UiBibz/Ui/Core/ProgressBar.html +1 -1
  63. data/doc/UiBibz/Ui/Core/Row.html +1 -1
  64. data/doc/UiBibz/Ui/Core/Stars.html +1 -1
  65. data/doc/UiBibz/Ui/Ux.html +1 -1
  66. data/doc/UiBibz/Ui/Ux/Actionable.html +1 -1
  67. data/doc/UiBibz/Ui/Ux/Actions.html +1 -1
  68. data/doc/UiBibz/Ui/Ux/Column.html +1 -1
  69. data/doc/UiBibz/Ui/Ux/Columns.html +1 -1
  70. data/doc/UiBibz/Ui/Ux/Grid.html +1 -1
  71. data/doc/UiBibz/Ui/Ux/Paginable.html +1 -1
  72. data/doc/UiBibz/Ui/Ux/Searchable.html +1 -1
  73. data/doc/UiBibz/Ui/Ux/Sortable.html +1 -1
  74. data/doc/UiBibz/Ui/Ux/Store.html +18 -70
  75. data/doc/UiBibz/Ui/Ux/Table.html +1 -1
  76. data/doc/UiBibz/Ui/Ux/TablePagination.html +1 -1
  77. data/doc/UiBibz/Ui/Ux/TablePaginationPerPage.html +1 -1
  78. data/doc/UiBibz/Ui/Ux/TablePanel.html +1 -1
  79. data/doc/UiBibz/Ui/Ux/TableSearchField.html +1 -1
  80. data/doc/UiBibz/Utils.html +1 -1
  81. data/doc/UiBibz/Utils/Internationalization.html +1 -1
  82. data/doc/_index.html +1 -1
  83. data/doc/file.README.html +47 -51
  84. data/doc/index.html +47 -51
  85. data/doc/method_list.html +69 -75
  86. data/doc/top-level-namespace.html +1 -1
  87. data/lib/ui_bibz.rb +14 -7
  88. data/lib/ui_bibz/helpers/ui_core_helper.rb +46 -11
  89. data/lib/ui_bibz/helpers/ui_ux_helper.rb +7 -3
  90. data/lib/ui_bibz/rails/engine.rb +2 -2
  91. data/lib/ui_bibz/ui/base.rb +5 -0
  92. data/lib/ui_bibz/ui/core/alert.rb +15 -6
  93. data/lib/ui_bibz/ui/core/breadcrumb/breadcrumb.rb +37 -2
  94. data/lib/ui_bibz/ui/core/breadcrumb/components/breadcrumb_link.rb +3 -3
  95. data/lib/ui_bibz/ui/core/button/button.rb +39 -6
  96. data/lib/ui_bibz/ui/core/button/button_choice.rb +104 -0
  97. data/lib/ui_bibz/ui/core/button/button_dropdown.rb +15 -2
  98. data/lib/ui_bibz/ui/core/button/button_group.rb +17 -5
  99. data/lib/ui_bibz/ui/core/button/button_link.rb +8 -11
  100. data/lib/ui_bibz/ui/core/button/button_split_dropdown.rb +15 -5
  101. data/lib/ui_bibz/ui/core/card/card.rb +158 -0
  102. data/lib/ui_bibz/ui/core/card/card_column.rb +60 -0
  103. data/lib/ui_bibz/ui/core/card/card_deck.rb +62 -0
  104. data/lib/ui_bibz/ui/core/card/card_group.rb +60 -0
  105. data/lib/ui_bibz/ui/core/card/components/block/card_block_link.rb +51 -0
  106. data/lib/ui_bibz/ui/core/card/components/block/card_block_text.rb +51 -0
  107. data/lib/ui_bibz/ui/core/card/components/block/card_block_title.rb +51 -0
  108. data/lib/ui_bibz/ui/core/card/components/card_block.rb +67 -0
  109. data/lib/ui_bibz/ui/core/card/components/card_footer.rb +55 -0
  110. data/lib/ui_bibz/ui/core/card/components/card_header.rb +51 -0
  111. data/lib/ui_bibz/ui/core/card/components/card_image.rb +57 -0
  112. data/lib/ui_bibz/ui/core/card/components/card_list_group.rb +47 -0
  113. data/lib/ui_bibz/ui/core/component.rb +78 -32
  114. data/lib/ui_bibz/ui/core/dropdown/components/dropdown_divider.rb +1 -1
  115. data/lib/ui_bibz/ui/core/dropdown/components/dropdown_header.rb +11 -1
  116. data/lib/ui_bibz/ui/core/dropdown/components/dropdown_link.rb +11 -4
  117. data/lib/ui_bibz/ui/core/dropdown/dropdown.rb +14 -6
  118. data/lib/ui_bibz/ui/core/glyph.rb +22 -4
  119. data/lib/ui_bibz/ui/core/input/date_picker_field.rb +125 -0
  120. data/lib/ui_bibz/ui/core/input/multi_column_field.rb +77 -0
  121. data/lib/ui_bibz/ui/core/input/multi_select_field.rb +89 -0
  122. data/lib/ui_bibz/ui/core/input/surround_field.rb +74 -0
  123. data/lib/ui_bibz/ui/core/jumbotron.rb +10 -6
  124. data/lib/ui_bibz/ui/core/label.rb +13 -3
  125. data/lib/ui_bibz/ui/core/{col.rb → layout/col.rb} +38 -18
  126. data/lib/ui_bibz/ui/core/layout/container.rb +65 -0
  127. data/lib/ui_bibz/ui/core/{row.rb → layout/row.rb} +7 -1
  128. data/lib/ui_bibz/ui/core/list/components/list.rb +26 -11
  129. data/lib/ui_bibz/ui/core/list/components/list_body.rb +36 -0
  130. data/lib/ui_bibz/ui/core/list/components/list_header.rb +36 -0
  131. data/lib/ui_bibz/ui/core/list/list_group.rb +7 -3
  132. data/lib/ui_bibz/ui/core/modal/components/modal_body.rb +7 -1
  133. data/lib/ui_bibz/ui/core/modal/components/modal_footer.rb +7 -1
  134. data/lib/ui_bibz/ui/core/modal/components/modal_header.rb +5 -2
  135. data/lib/ui_bibz/ui/core/modal/modal.rb +13 -2
  136. data/lib/ui_bibz/ui/core/nav/components/nav_dropdown.rb +6 -2
  137. data/lib/ui_bibz/ui/core/nav/components/nav_link.rb +7 -18
  138. data/lib/ui_bibz/ui/core/nav/components/nav_link_link.rb +45 -0
  139. data/lib/ui_bibz/ui/core/nav/components/nav_link_list.rb +35 -0
  140. data/lib/ui_bibz/ui/core/nav/components/navbar_brand.rb +40 -0
  141. data/lib/ui_bibz/ui/core/nav/components/navbar_form.rb +2 -2
  142. data/lib/ui_bibz/ui/core/nav/components/navbar_nav.rb +1 -1
  143. data/lib/ui_bibz/ui/core/nav/components/navbar_text.rb +6 -2
  144. data/lib/ui_bibz/ui/core/nav/nav.rb +22 -4
  145. data/lib/ui_bibz/ui/core/nav/navbar.rb +26 -17
  146. data/lib/ui_bibz/ui/core/progress.rb +98 -0
  147. data/lib/ui_bibz/ui/core/stars.rb +13 -5
  148. data/lib/ui_bibz/ui/ux/table/components/actions.rb +4 -0
  149. data/lib/ui_bibz/ui/ux/table/components/store.rb +4 -4
  150. data/lib/ui_bibz/ui/ux/table/extensions/actionable.rb +15 -13
  151. data/lib/ui_bibz/ui/ux/table/extensions/paginable.rb +7 -6
  152. data/lib/ui_bibz/ui/ux/table/extensions/searchable.rb +6 -5
  153. data/lib/ui_bibz/ui/ux/table/table.rb +14 -7
  154. data/lib/ui_bibz/ui/ux/table/{table_panel.rb → table_card.rb} +34 -36
  155. data/lib/ui_bibz/ui/ux/table/table_search_field.rb +19 -11
  156. data/lib/ui_bibz/version.rb +1 -1
  157. data/test/ui/breadcrumb_test.rb +25 -0
  158. data/test/ui/button_test.rb +44 -4
  159. data/test/ui/card_test.rb +106 -0
  160. data/test/ui/col_test.rb +22 -0
  161. data/test/ui/dropdown_test.rb +1 -1
  162. data/test/ui/inputs_test.rb +81 -0
  163. data/test/ui/list_group_test.rb +1 -1
  164. data/test/ui/nav_test.rb +4 -5
  165. data/test/ui/table_test.rb +11 -11
  166. data/test/ui_helper_test.rb +29 -18
  167. data/ui_bibz.gemspec +3 -3
  168. data/vendor/assets/images/switch.png +0 -0
  169. data/vendor/assets/javascripts/bootstrap-4.0.0-alpha.min.js +7 -0
  170. data/vendor/assets/javascripts/bootstrap-multiselect.min.js +1180 -0
  171. data/vendor/assets/javascripts/jquery.multi-select.min.js +1 -0
  172. data/vendor/assets/javascripts/jquery.quicksearch.min.js +1 -0
  173. data/vendor/assets/stylesheets/bootstrap-4.0.0-alpha.min.css +6 -0
  174. data/vendor/assets/stylesheets/bootstrap-datepicker3.min.css +1 -1
  175. data/vendor/assets/stylesheets/bootstrap-multiselect.min.css +1 -0
  176. data/vendor/assets/stylesheets/multi-select.min.css +1 -0
  177. metadata +70 -24
  178. data/.yardoc/checksums +0 -59
  179. data/.yardoc/object_types +0 -0
  180. data/.yardoc/objects/root.dat +0 -0
  181. data/.yardoc/proxy_types +0 -0
  182. data/lib/ui_bibz/helpers/meta_helper.rb +0 -32
  183. data/lib/ui_bibz/ui/core/panel.rb +0 -138
  184. data/lib/ui_bibz/ui/core/progress_bar/components/bar.rb +0 -105
  185. data/lib/ui_bibz/ui/core/progress_bar/progress_bar.rb +0 -94
  186. data/lib/ui_bibz/ui/ux/grid.rb +0 -121
  187. data/test/ui/grid_test.rb +0 -46
  188. data/test/ui/panel_test.rb +0 -52
@@ -1,105 +0,0 @@
1
- module UiBibz::Ui::Core
2
-
3
- # Create a NavLink
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+ - State of élement with symbol value:
18
- # (+:default+, +:primary+, +:info+, +:warning+, +:danger+)
19
- # * label - String (default: "percentage%")
20
- # * percentage_min - Integer (default: 0)
21
- # * percentage_max - Integer (default: 100)
22
- # * sr_only - Boolean to show label (default: false)
23
- # * type
24
- # (+:striped+, +:animated+)
25
- #
26
- # ==== Signatures
27
- #
28
- # UiBibz::Ui::Core::Bar.new(percentage, options = nil, html_options = nil)
29
- #
30
- # UiBibz::Ui::Core::Bar.new(options = nil, html_options = nil) do
31
- # percentage
32
- # end
33
- #
34
- # ==== Examples
35
- #
36
- # UiBibz::Ui::Core::Bar.new(10)
37
- # # or
38
- # UiBibz::Ui::Core::Bar.new(10, { state: :success, sr_only: true, label: 'Loading...' },{ class: 'test' }).render
39
- # # or
40
- # UiBibz::Ui::Core::Bar.new({ state: :primary }) do
41
- # 40
42
- # end.render
43
- #
44
- class Bar < Component
45
-
46
- # See UiBibz::Ui::Core::Component.initialize
47
- def initialize content = nil, options = nil, html_options = nil, &block
48
- super
49
- end
50
-
51
- # Render html tag
52
- def render
53
- content_tag :div, progressbar_inner_html, class_and_html_options(['progress-bar', type]).merge(bar_html_options)
54
- end
55
-
56
- private
57
-
58
- def bar_html_options
59
- {
60
- "role" => 'progressbar',
61
- "aria-valuenow" => percentage,
62
- "aria-valuemin" => percentage_min,
63
- "aria-valuemax" => percentage_max,
64
- "style" => "width: #{ percentage }%"
65
- }
66
- end
67
-
68
- def progressbar_inner_html
69
- sr_only ? content_tag(:span, label, class: 'sr-only') : label
70
- end
71
-
72
- def percentage
73
- @content || 0
74
- end
75
-
76
- def sr_only
77
- @options[:sr_only] || false
78
- end
79
-
80
- def percentage_min
81
- @options[:percentage_min] || 0
82
- end
83
-
84
- def percentage_max
85
- @options[:percentage_max] || 100
86
- end
87
-
88
- def label
89
- @options[:label].nil? ? "#{ percentage }%" : @options[:label]
90
- end
91
-
92
- def type
93
- if @options[:type] == :animated
94
- "progress-bar-striped active"
95
- elsif @options[:type]
96
- "progress-bar-#{ @options[:type] }"
97
- end
98
- end
99
-
100
- def state
101
- "progress-bar-#{ @options[:state] }" unless @options[:state].nil?
102
- end
103
-
104
- end
105
- end
@@ -1,94 +0,0 @@
1
- require 'ui_bibz/ui/core/progress_bar/components/bar'
2
- module UiBibz::Ui::Core
3
-
4
- # Create a progress bar
5
- #
6
- # This element is an extend of UiBibz::Ui::Core::Component.
7
- #
8
- # ==== Attributes
9
- #
10
- # * +content+ - Content of element
11
- # * +options+ - Options of element
12
- # * +html_options+ - Html Options of element
13
- #
14
- # ==== Options
15
- #
16
- # You can add HTML attributes using the +html_options+.
17
- # You can pass arguments in options attribute:
18
- # * +state+ - State of élement with symbol value:
19
- # (+:default+, +:primary+, +:info+, +:warning+, +:danger+)
20
- # * label - String (default: "percentage%")
21
- # * tap - Boolean (true: To add several bars)
22
- # * percentage_min - Integer (default: 0)
23
- # * percentage_max - Integer (default: 100)
24
- # * sr_only - Boolean to show label (default: false)
25
- # * type
26
- # (+:striped+, +:animated+)
27
- #
28
- #
29
- # ==== Signatures
30
- #
31
- # UiBibz::Ui::Core::ProgressBar.new(percentage, options = nil, html_options = nil)
32
- #
33
- # UiBibz::Ui::Core::ProgressBar.new(options = nil, html_options = nil) do
34
- # percentage
35
- # end
36
- #
37
- # UiBibz::Ui::Core::ProgressBar.new(tap: true).tap do |pb|
38
- # pb.bar percentage, options = nil, html_options = nil
39
- # pb.bar options = nil, html_options = nil do
40
- # percentage
41
- # end
42
- # end
43
- #
44
- # ==== Examples
45
- #
46
- # UiBibz::Ui::Core::ProgressBar.new(50)
47
- # # or
48
- # UiBibz::Ui::Core::ProgressBar.new(10, { state: :success, sr_only: false, label: 'Loading...' },{ class: 'test' }).render
49
- # # or
50
- # UiBibz::Ui::Core::ProgressBar.new(tap: true).tap |pb|
51
- # pb.bar 10, { state: :success, sr_only: false, label: 'Loading...' },{ class: 'test' }
52
- # pb.bar { state: :primary } do
53
- # 20
54
- # end
55
- # end.render
56
- #
57
- # ==== Helper
58
- #
59
- # progress_bar(integer, options = {}, html_options = {})
60
- #
61
- # progress_bar(options = { tap: true }, html_options = {}) do |pb|
62
- # pb.bar(integer, options = {}, html_options = {})
63
- # pb.bar(options = {}, html_options = {}) do
64
- # integer
65
- # end
66
- # end
67
- #
68
- class ProgressBar < Component
69
-
70
- # See UiBibz::Ui::Core::Component.initialize
71
- def initialize content = nil, options = nil, html_options = nil, &block
72
- super
73
- @bars = []
74
- end
75
-
76
- # Render html tag
77
- def render
78
- content_tag :div, content, class: 'progress'
79
- end
80
-
81
- # Add progressbar bar items
82
- # See UiBibz::Ui::Core::Bar
83
- def bar content = nil, options = nil, html_options = nil, &block
84
- @bars << Bar.new(content, options, html_options, &block).render
85
- end
86
-
87
- private
88
-
89
- def content
90
- @options[:tap] ? @bars.join().html_safe : Bar.new(@content, @options, @html_options).render
91
- end
92
-
93
- end
94
- end
@@ -1,121 +0,0 @@
1
- module UiBibz::Ui::Ux
2
-
3
- # Create a Grid
4
- #
5
- # This element is an extend of UiBibz::Ui::Ux::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
- #
18
- # ==== Signatures
19
- #
20
- # UiBibz::Ui::Ux::Grid.new().tap do |g|
21
- # ...
22
- # g.view content = nil, options = nil, html_options = nil, &block
23
- # ...
24
- # end
25
- #
26
- # ==== Exemples
27
- #
28
- # UiBibz::Ui::Ux::Grid.new().tap do |g|
29
- # g.view num: 5, position: :left do
30
- # 'left'
31
- # end
32
- # g.view position: :right do
33
- # 'right'
34
- # end
35
- # g.view({ position: :top}, { class: 'success'}) do
36
- # 'top'
37
- # end
38
- # g.view position: :center do
39
- # 'center'
40
- # end
41
- # g.view position: :bottom do
42
- # 'bottom'
43
- # end
44
- # end.render
45
- #
46
- # ==== Helper
47
- #
48
- # grid(options = { tap: true }, html_options = {}) do |g|
49
- # g.view(content, options = {}, html_options = {})
50
- # g.view(options = {}, html_options = {}) do
51
- # content
52
- # end
53
- # end
54
- #
55
- class Grid < UiBibz::Ui::Core::Component
56
-
57
- COL_NUM = 12
58
-
59
- def initialize content = nil, options = nil, html_options = nil, &block
60
- super
61
- @views = {}
62
- end
63
-
64
- # Add grid view items
65
- def view content = nil, options = nil, html_options = nil, &block
66
- o = content.kind_of?(Hash) ? content : options
67
- c = UiBibz::Ui::Core::Component.new content, options, html_options, &block
68
- h = Hash[o[:position], { component: c, num: o[:num]}]
69
- @views = @views.merge(h)
70
- end
71
-
72
- # Render html tag
73
- def render
74
- define_col_nums
75
- UiBibz::Ui::Core::Row.new(class: 'grid') do
76
- # top
77
- concat top_view unless @views[:top].nil?
78
- # left
79
- concat left_view unless @views[:left].nil?
80
- # center
81
- concat center_view unless @views[:center].nil?
82
- # right
83
- concat right_view unless @views[:right].nil?
84
- # bottom
85
- concat bottom_view unless @views[:bottom].nil?
86
- end.render
87
- end
88
-
89
- private
90
-
91
- def view_by_num c, num, item_class
92
- UiBibz::Ui::Core::Col.new(c.content, c.options.merge({ num: num }), c.class_and_html_options(['col', item_class])).render
93
- end
94
-
95
- def top_view
96
- view_by_num @views[:top][:component], COL_NUM, 'grid-top'
97
- end
98
-
99
- def bottom_view
100
- view_by_num @views[:bottom][:component], COL_NUM, 'grid-bottom'
101
- end
102
-
103
- def left_view
104
- view_by_num @views[:left][:component], @left_val, 'grid-left'
105
- end
106
-
107
- def center_view
108
- view_by_num @views[:center][:component], COL_NUM-@left_val-@right_val, 'grid-center'
109
- end
110
-
111
- def right_view
112
- view_by_num @views[:right][:component], @right_val, 'grid-right'
113
- end
114
-
115
- def define_col_nums
116
- @left_val = @views[:left].nil? ? 0 : (@views[:left][:num] || 1)
117
- @right_val = @views[:right].nil? ? 0 : (@views[:right][:num] || 1)
118
- end
119
-
120
- end
121
- end
data/test/ui/grid_test.rb DELETED
@@ -1,46 +0,0 @@
1
- require 'test_helper'
2
- include UiBibz::Helpers
3
- class GridTest < ActionView::TestCase
4
-
5
- test 'row' do
6
- actual = UiBibz::Ui::Core::Row.new() do
7
- 'test'
8
- end.render
9
- expected = "<div class=\"row\">test</div>"
10
-
11
- assert_equal expected, actual
12
- end
13
-
14
- test 'col with simple arg' do
15
- actual = UiBibz::Ui::Core::Col.new({ size: :lg, num: 1}) do
16
- 'test'
17
- end.render
18
- expected = "<div class=\"col-lg-1\">test</div>"
19
-
20
- assert_equal expected, actual
21
- end
22
-
23
- test 'col with multiple args' do
24
- actual = UiBibz::Ui::Core::Col.new([{ size: :lg, num: 1, offset: 2}, { num: 1 }], class: 'test') do
25
- 'test'
26
- end.render
27
- expected = "<div class=\"test col-lg-1 col-offset-2 col-md-1\">test</div>"
28
-
29
- assert_equal expected, actual
30
- end
31
-
32
- test 'grid' do
33
- actual = UiBibz::Ui::Ux::Grid.new().tap do |g|
34
- g.view position: :left do
35
- 'left'
36
- end
37
- g.view 'center', position: :center
38
- g.view 'right', position: :right
39
- g.view 'bottom', position: :bottom
40
- end.render
41
- expected = "<div class=\"grid row\"><div class=\"col grid-left col-md-1\">left</div><div class=\"col grid-center col-md-10\">center</div><div class=\"col grid-right col-md-1\">right</div><div class=\"col grid-bottom col-md-12\">bottom</div></div>"
42
-
43
- assert_equal expected, actual
44
- end
45
-
46
- end
@@ -1,52 +0,0 @@
1
- require 'test_helper'
2
- include UiBibz::Helpers
3
- class PanelTest < ActionView::TestCase
4
-
5
- setup do
6
- @content = 'Example'
7
- end
8
-
9
- test 'simple panel' do
10
- actual = UiBibz::Ui::Core::Panel.new(@content).render
11
- expected = "<div class=\"panel-default panel\"><div class=\"panel-body\">#{ @content }</div></div>"
12
-
13
- assert_equal expected, actual
14
- end
15
-
16
- test 'simple panel with block' do
17
- actual = UiBibz::Ui::Core::Panel.new do
18
- @content
19
- end.render
20
- expected = "<div class=\"panel-default panel\"><div class=\"panel-body\">#{ @content }</div></div>"
21
-
22
- assert_equal expected, actual
23
- end
24
-
25
- test 'simple panel with tap' do
26
- actual = UiBibz::Ui::Core::Panel.new().tap do |p|
27
- p.body @content
28
- end.render
29
- expected = "<div class=\"panel-default panel\"><div class=\"panel-body\">#{ @content }</div></div>"
30
-
31
- assert_equal expected, actual
32
- end
33
-
34
- test 'complex panel with tap' do
35
- actual = UiBibz::Ui::Core::Panel.new({state: :danger}, { class: 'example'}).tap do |p|
36
- p.header 'header', class: 'header-example'
37
- p.body class: 'body-example' do
38
- @content
39
- end
40
- p.footer do
41
- "footer"
42
- end
43
- end.render
44
- expected = "<div class=\"example panel-danger panel\">\
45
- <div class=\"header-example panel-heading\">header</div>\
46
- <div class=\"body-example panel-body\">#{ @content }</div>\
47
- <div class=\"panel-footer\">footer</div></div>"
48
-
49
- assert_equal expected, actual
50
- end
51
-
52
- end