ui_bibz 3.0.12 → 4.0.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (295) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +3 -3
  3. data/.github/workflows/linter.yml +13 -12
  4. data/.overcommit.yml +6 -0
  5. data/.rubocop.yml +6 -0
  6. data/.ruby-version +1 -1
  7. data/Gemfile +19 -12
  8. data/Gemfile.lock +178 -138
  9. data/app/assets/config/ui_bibz.js +12 -0
  10. data/app/assets/javascripts/forms/formula.js +82 -0
  11. data/app/assets/javascripts/forms/input-connected.js +132 -0
  12. data/app/assets/javascripts/forms/jquery.multi-select-extend.js +52 -0
  13. data/app/assets/javascripts/forms.js +160 -0
  14. data/app/assets/javascripts/interfaces.js +56 -0
  15. data/app/assets/javascripts/tables.js +49 -0
  16. data/app/assets/javascripts/ui_bibz_js.js +37 -0
  17. data/app/assets/stylesheets/navigations/_nav.sass +2 -0
  18. data/app/assets/stylesheets/navigations/_navbar.sass +12 -0
  19. data/app/assets/stylesheets/navigations/_progress_bar.sass +2 -0
  20. data/app/assets/stylesheets/navigations/_toolbar.sass +3 -0
  21. data/app/assets/stylesheets/sass/_boxes.sass +1 -0
  22. data/app/assets/stylesheets/sass/_containers.sass +2 -0
  23. data/app/assets/stylesheets/sass/_fixes.sass +2 -0
  24. data/app/assets/stylesheets/sass/_forms.sass +8 -0
  25. data/app/assets/stylesheets/sass/_navigations.sass +4 -0
  26. data/app/assets/stylesheets/sass/_notifications.sass +4 -0
  27. data/app/assets/stylesheets/sass/_tables.sass +2 -0
  28. data/app/assets/stylesheets/sass/_variables_mixins_functions.sass +3 -0
  29. data/app/assets/stylesheets/sass/boxes/_card.sass +4 -0
  30. data/app/assets/stylesheets/sass/containers/_panel.scss +330 -0
  31. data/app/assets/stylesheets/sass/forms/_bootstrap_select.sass +5 -0
  32. data/app/assets/stylesheets/sass/forms/_button.sass +3 -0
  33. data/app/assets/stylesheets/sass/forms/_date_picker.sass +3 -0
  34. data/app/assets/stylesheets/sass/forms/_form_check.sass +10 -0
  35. data/app/assets/stylesheets/sass/forms/_formula_field.sass +17 -0
  36. data/app/assets/stylesheets/sass/forms/_multiselect.sass +44 -0
  37. data/app/assets/stylesheets/sass/forms/_range.sass +44 -0
  38. data/app/assets/stylesheets/sass/forms/_slider.sass +136 -0
  39. data/app/assets/stylesheets/sass/forms/_surround_field.sass +25 -0
  40. data/app/assets/stylesheets/sass/notifications/_badge.sass +5 -0
  41. data/app/assets/stylesheets/sass/notifications/_glyph.sass +3 -0
  42. data/app/assets/stylesheets/sass/notifications/_star.sass +2 -0
  43. data/app/assets/stylesheets/sass/notifications/_toast.sass +3 -0
  44. data/app/assets/stylesheets/sass/tables/_table.sass +39 -0
  45. data/app/assets/stylesheets/sass/tables/_table_card.sass +39 -0
  46. data/app/assets/stylesheets/ui_bibz.sass +26 -0
  47. data/bin/test +3 -5
  48. data/config/importmap.rb +19 -0
  49. data/config/initializers/assets.rb +5 -0
  50. data/config/initializers/will_paginate.rb +1 -3
  51. data/lib/ui_bibz/builders/data_html_options_builder.rb +118 -0
  52. data/lib/ui_bibz/builders/html_classes_builder.rb +89 -0
  53. data/lib/ui_bibz/builders/html_options_builder.rb +22 -0
  54. data/lib/ui_bibz/concerns/models/searchable.rb +1 -1
  55. data/lib/ui_bibz/factory_methods/component_initialize_factory_method.rb +33 -0
  56. data/lib/ui_bibz/helpers/ui/core/boxes_helper.rb +12 -12
  57. data/lib/ui_bibz/helpers/ui/core/forms_helper.rb +50 -50
  58. data/lib/ui_bibz/helpers/ui/core/icons_helper.rb +6 -6
  59. data/lib/ui_bibz/helpers/ui/core/layouts_helper.rb +2 -2
  60. data/lib/ui_bibz/helpers/ui/core/lists_helper.rb +2 -2
  61. data/lib/ui_bibz/helpers/ui/core/navigations_helper.rb +12 -12
  62. data/lib/ui_bibz/helpers/ui/core/notifications_helper.rb +4 -4
  63. data/lib/ui_bibz/helpers/ui/core/windows_helper.rb +10 -2
  64. data/lib/ui_bibz/helpers/ui/ux_helper.rb +2 -2
  65. data/lib/ui_bibz/helpers/utils_helper.rb +2 -2
  66. data/lib/ui_bibz/infos.rb +3 -3
  67. data/lib/ui_bibz/inputs/ui_bibz_form/ui_bibz_form_builder.rb +12 -12
  68. data/lib/ui_bibz/inputs/ui_bibz_inputs/collection_input.rb +1 -1
  69. data/lib/ui_bibz/rails/engine.rb +21 -4
  70. data/lib/ui_bibz/strategies/component_initialize_abstract_strategy.rb +27 -0
  71. data/lib/ui_bibz/strategies/component_initialize_block_strategy.rb +31 -0
  72. data/lib/ui_bibz/strategies/component_initialize_hash_strategy.rb +18 -0
  73. data/lib/ui_bibz/strategies/component_initialize_standard_strategy.rb +18 -0
  74. data/lib/ui_bibz/ui/concerns/card_itemable_concern.rb +4 -4
  75. data/lib/ui_bibz/ui/concerns/notification_concern.rb +1 -1
  76. data/lib/ui_bibz/ui/core/boxes/card.rb +1 -1
  77. data/lib/ui_bibz/ui/core/boxes/card_accordion.rb +4 -4
  78. data/lib/ui_bibz/ui/core/boxes/card_column.rb +1 -1
  79. data/lib/ui_bibz/ui/core/boxes/card_deck.rb +1 -1
  80. data/lib/ui_bibz/ui/core/boxes/card_grid.rb +0 -3
  81. data/lib/ui_bibz/ui/core/boxes/card_group.rb +1 -1
  82. data/lib/ui_bibz/ui/core/boxes/components/card_body.rb +9 -9
  83. data/lib/ui_bibz/ui/core/boxes/components/card_col.rb +2 -2
  84. data/lib/ui_bibz/ui/core/boxes/components/card_list_group.rb +1 -1
  85. data/lib/ui_bibz/ui/core/boxes/components/card_row.rb +1 -1
  86. data/lib/ui_bibz/ui/core/component.rb +13 -62
  87. data/lib/ui_bibz/ui/core/forms/buttons/button.rb +3 -1
  88. data/lib/ui_bibz/ui/core/forms/buttons/button_group.rb +11 -11
  89. data/lib/ui_bibz/ui/core/forms/choices/box_switch_field.rb +7 -7
  90. data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +2 -2
  91. data/lib/ui_bibz/ui/core/forms/choices/choice_group.rb +5 -6
  92. data/lib/ui_bibz/ui/core/forms/choices/components/choice.rb +1 -1
  93. data/lib/ui_bibz/ui/core/forms/dates/date_picker_field.rb +15 -15
  94. data/lib/ui_bibz/ui/core/forms/dropdowns/components/dropdown_link.rb +1 -1
  95. data/lib/ui_bibz/ui/core/forms/dropdowns/dropdown.rb +5 -5
  96. data/lib/ui_bibz/ui/core/forms/numbers/slider_field.rb +1 -1
  97. data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +10 -10
  98. data/lib/ui_bibz/ui/core/forms/selects/multi_column_field.rb +2 -2
  99. data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +32 -32
  100. data/lib/ui_bibz/ui/core/forms/textareas/markdown_editor_field.rb +7 -8
  101. data/lib/ui_bibz/ui/core/icons/components/glyph_text.rb +1 -1
  102. data/lib/ui_bibz/ui/core/icons/glyph.rb +4 -3
  103. data/lib/ui_bibz/ui/core/layouts/row.rb +2 -2
  104. data/lib/ui_bibz/ui/core/lists/components/list.rb +4 -4
  105. data/lib/ui_bibz/ui/core/lists/list_group.rb +1 -1
  106. data/lib/ui_bibz/ui/core/navigations/breadcrumb.rb +6 -4
  107. data/lib/ui_bibz/ui/core/navigations/components/nav_link_span.rb +1 -2
  108. data/lib/ui_bibz/ui/core/navigations/components/navbar_form.rb +6 -5
  109. data/lib/ui_bibz/ui/core/navigations/components/toolbar_form.rb +2 -2
  110. data/lib/ui_bibz/ui/core/navigations/nav.rb +10 -6
  111. data/lib/ui_bibz/ui/core/navigations/navbar.rb +21 -19
  112. data/lib/ui_bibz/ui/core/navigations/pagination.rb +3 -3
  113. data/lib/ui_bibz/ui/core/navigations/toolbar.rb +5 -5
  114. data/lib/ui_bibz/ui/core/notifications/alert.rb +4 -5
  115. data/lib/ui_bibz/ui/core/notifications/badge.rb +6 -2
  116. data/lib/ui_bibz/ui/core/notifications/components/toast_header.rb +1 -1
  117. data/lib/ui_bibz/ui/core/notifications/progress_bar.rb +3 -3
  118. data/lib/ui_bibz/ui/core/notifications/toast.rb +8 -9
  119. data/lib/ui_bibz/ui/core/windows/components/offcanvas_body.rb +47 -0
  120. data/lib/ui_bibz/ui/core/windows/components/offcanvas_header.rb +54 -0
  121. data/lib/ui_bibz/ui/core/windows/modal.rb +9 -9
  122. data/lib/ui_bibz/ui/core/windows/offcanvas.rb +84 -0
  123. data/lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb +4 -20
  124. data/lib/ui_bibz/ui/extensions/core/component/klass_extension.rb +11 -19
  125. data/lib/ui_bibz/ui/extensions/core/forms/connect_extension.rb +1 -1
  126. data/lib/ui_bibz/ui/ux/containers/components/panel_column.rb +3 -3
  127. data/lib/ui_bibz/ui/ux/containers/components/panel_deck.rb +3 -3
  128. data/lib/ui_bibz/ui/ux/containers/components/panel_group.rb +3 -3
  129. data/lib/ui_bibz/ui/ux/containers/components/panel_header.rb +4 -4
  130. data/lib/ui_bibz/ui/ux/containers/panel.rb +13 -13
  131. data/lib/ui_bibz/ui/ux/tables/components/actions.rb +4 -4
  132. data/lib/ui_bibz/ui/ux/tables/components/column.rb +1 -1
  133. data/lib/ui_bibz/ui/ux/tables/components/columns.rb +2 -2
  134. data/lib/ui_bibz/ui/ux/tables/extensions/sortable.rb +1 -1
  135. data/lib/ui_bibz/ui/ux/tables/table.rb +5 -5
  136. data/lib/ui_bibz/ui/ux/tables/table_card.rb +6 -6
  137. data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +1 -1
  138. data/lib/ui_bibz/utils/breakdown_class_name_generator.rb +3 -3
  139. data/lib/ui_bibz/utils/screwdriver.rb +1 -1
  140. data/lib/ui_bibz/view_objects/glyph_component_view_object.rb +38 -0
  141. data/lib/ui_bibz.rb +25 -0
  142. data/test/builders/data_html_classes_builder_test.rb +37 -0
  143. data/test/builders/html_classes_builder_test.rb +76 -0
  144. data/test/dummy/Rakefile +1 -1
  145. data/test/dummy/app/assets/stylesheets/application.css +1 -15
  146. data/test/dummy/app/channels/application_cable/channel.rb +6 -0
  147. data/test/dummy/app/channels/application_cable/connection.rb +6 -0
  148. data/test/dummy/app/jobs/application_job.rb +9 -0
  149. data/test/dummy/app/mailers/application_mailer.rb +6 -0
  150. data/test/dummy/app/views/layouts/application.html.erb +10 -12
  151. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  152. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  153. data/test/dummy/bin/rails +3 -3
  154. data/test/dummy/bin/rake +2 -2
  155. data/test/dummy/bin/setup +12 -12
  156. data/test/dummy/config/application.rb +13 -17
  157. data/test/dummy/config/boot.rb +3 -3
  158. data/test/dummy/config/database.yml +2 -2
  159. data/test/dummy/config/environment.rb +1 -1
  160. data/test/dummy/config/environments/development.rb +21 -16
  161. data/test/dummy/config/environments/production.rb +16 -41
  162. data/test/dummy/config/environments/test.rb +19 -8
  163. data/test/dummy/config/importmap.rb +11 -0
  164. data/test/dummy/config/initializers/content_security_policy.rb +21 -24
  165. data/test/dummy/config/initializers/filter_parameter_logging.rb +6 -2
  166. data/test/dummy/config/initializers/inflections.rb +4 -4
  167. data/test/dummy/config/initializers/permissions_policy.rb +12 -0
  168. data/test/dummy/config/locales/en.yml +13 -3
  169. data/test/dummy/config/puma.rb +7 -2
  170. data/test/dummy/config/storage.yml +5 -5
  171. data/test/dummy/config.ru +2 -1
  172. data/test/simple_form_test.rb +24 -24
  173. data/test/ui/core/boxes/card_test.rb +2 -1
  174. data/test/ui/core/component_test.rb +2 -2
  175. data/test/ui/core/forms/buttons/button_group_test.rb +1 -1
  176. data/test/ui/core/forms/buttons/button_link_test.rb +1 -1
  177. data/test/ui/core/forms/buttons/button_refresh_test.rb +1 -1
  178. data/test/ui/core/forms/buttons/button_test.rb +2 -2
  179. data/test/ui/core/forms/choices/box_switch_field_test.rb +10 -10
  180. data/test/ui/core/forms/choices/checkbox_field_test.rb +1 -1
  181. data/test/ui/core/forms/choices/choice_group_test.rb +1 -1
  182. data/test/ui/core/forms/dropdowns/dropdown_test.rb +1 -1
  183. data/test/ui/core/forms/numbers/formula_field_test.rb +1 -1
  184. data/test/ui/core/forms/selects/dropdown_select_field_test.rb +2 -2
  185. data/test/ui/core/forms/selects/select_field_test.rb +1 -1
  186. data/test/ui/core/forms/surrounds/surround_field_test.rb +4 -4
  187. data/test/ui/core/forms/texts/auto_complete_field_test.rb +2 -2
  188. data/test/ui/core/icons/glyph_test.rb +8 -4
  189. data/test/ui/core/icons/star_test.rb +12 -6
  190. data/test/ui/core/navigations/breadcrumb_test.rb +1 -1
  191. data/test/ui/core/navigations/link_test.rb +1 -1
  192. data/test/ui/core/navigations/nav_test.rb +11 -0
  193. data/test/ui/core/notifications/alert_test.rb +1 -1
  194. data/test/ui/core/notifications/badge_test.rb +3 -3
  195. data/test/ui/core/notifications/popover_test.rb +4 -4
  196. data/test/ui/core/notifications/spinner_test.rb +1 -1
  197. data/test/ui/core/notifications/toast_test.rb +1 -1
  198. data/test/ui/core/notifications/tooltip_test.rb +4 -4
  199. data/test/ui/core/windows/offcanvas_test.rb +27 -0
  200. data/test/ui/ux/containers/panel_test.rb +1 -1
  201. data/test/ui/ux/tables/table_test.rb +3 -3
  202. data/test/view_objects/glyph_component_view_object_test.rb +17 -0
  203. data/ui_bibz.gemspec +6 -20
  204. data/vendor/assets/fonts/fontawesome/fa-brands-400.ttf +0 -0
  205. data/vendor/assets/fonts/fontawesome/fa-brands-400.woff2 +0 -0
  206. data/vendor/assets/fonts/fontawesome/fa-regular-400.ttf +0 -0
  207. data/vendor/assets/fonts/fontawesome/fa-regular-400.woff2 +0 -0
  208. data/vendor/assets/fonts/fontawesome/fa-solid-900.ttf +0 -0
  209. data/vendor/assets/fonts/fontawesome/fa-solid-900.woff2 +0 -0
  210. data/vendor/assets/fonts/fontawesome/fa-v4compatibility.ttf +0 -0
  211. data/vendor/assets/fonts/fontawesome/fa-v4compatibility.woff2 +0 -0
  212. data/vendor/assets/javascripts/bootstrap-markdown.js +1 -1555
  213. data/vendor/assets/javascripts/bootstrap-multiselect.min.js +40 -1176
  214. data/vendor/assets/javascripts/bootstrap-switch.min.js +9 -21
  215. data/vendor/assets/javascripts/bs-custom-file-input.min.js +0 -1
  216. data/vendor/assets/javascripts/fontawesome/all.js +5977 -0
  217. data/vendor/assets/javascripts/fontawesome/all.min.js +6 -0
  218. data/vendor/assets/javascripts/fontawesome/brands.js +749 -0
  219. data/vendor/assets/javascripts/fontawesome/brands.min.js +6 -0
  220. data/vendor/assets/javascripts/fontawesome/conflict-detection.js +1138 -0
  221. data/vendor/assets/javascripts/fontawesome/conflict-detection.min.js +6 -0
  222. data/vendor/assets/javascripts/fontawesome/fontawesome.js +3126 -0
  223. data/vendor/assets/javascripts/fontawesome/fontawesome.min.js +6 -0
  224. data/vendor/assets/javascripts/fontawesome/regular.js +445 -0
  225. data/vendor/assets/javascripts/fontawesome/regular.min.js +6 -0
  226. data/vendor/assets/javascripts/fontawesome/solid.js +1672 -0
  227. data/vendor/assets/javascripts/fontawesome/solid.min.js +6 -0
  228. data/vendor/assets/javascripts/fontawesome/v4-shims.js +225 -0
  229. data/vendor/assets/javascripts/fontawesome/v4-shims.min.js +6 -0
  230. data/vendor/assets/javascripts/fuzzysort.js +562 -0
  231. data/vendor/assets/javascripts/jquery-3.7.0.min.js +2 -0
  232. data/vendor/assets/javascripts/jquery.multi-select.min.js +725 -1
  233. data/vendor/assets/stylesheets/bootstrap-multiselect.sass +115 -0
  234. data/vendor/assets/stylesheets/bootstrap-switch.scss +211 -0
  235. data/vendor/assets/stylesheets/fontawesome/_animated.scss +142 -9
  236. data/vendor/assets/stylesheets/fontawesome/_bordered-pulled.scss +13 -13
  237. data/vendor/assets/stylesheets/fontawesome/_core.scss +28 -6
  238. data/vendor/assets/stylesheets/fontawesome/_fixed-width.scss +2 -1
  239. data/vendor/assets/stylesheets/fontawesome/_functions.scss +57 -0
  240. data/vendor/assets/stylesheets/fontawesome/_icons.scss +7 -1438
  241. data/vendor/assets/stylesheets/fontawesome/_list.scss +4 -4
  242. data/vendor/assets/stylesheets/fontawesome/_mixins.scss +53 -34
  243. data/vendor/assets/stylesheets/fontawesome/_rotated-flipped.scss +25 -18
  244. data/vendor/assets/stylesheets/fontawesome/_screen-reader.scss +12 -3
  245. data/vendor/assets/stylesheets/fontawesome/_shims.scss +640 -664
  246. data/vendor/assets/stylesheets/fontawesome/_sizing.scss +16 -0
  247. data/vendor/assets/stylesheets/fontawesome/_stacked.scss +5 -4
  248. data/vendor/assets/stylesheets/fontawesome/_variables.scss +4896 -1393
  249. data/vendor/assets/stylesheets/fontawesome/brands.scss +17 -10
  250. data/vendor/assets/stylesheets/fontawesome/fontawesome.scss +7 -2
  251. data/vendor/assets/stylesheets/fontawesome/regular.scss +13 -10
  252. data/vendor/assets/stylesheets/fontawesome/solid.scss +13 -11
  253. data/vendor/assets/stylesheets/fontawesome/v4-shims.scss +6 -1
  254. data/vendor/assets/stylesheets/multi-select.css +92 -0
  255. metadata +120 -348
  256. data/.gitlab-ci.yml +0 -17
  257. data/.travis.yml +0 -24
  258. data/lib/ui_bibz/ui/extensions/core/component/popover_extension.rb +0 -70
  259. data/structure.md +0 -68
  260. data/test/dummy/README.rdoc +0 -28
  261. data/test/dummy/app/assets/javascripts/application.js +0 -13
  262. data/test/dummy/app/javascripts/packs/index.js +0 -3
  263. data/test/dummy/config/initializers/application_controller_renderer.rb +0 -9
  264. data/test/dummy/config/initializers/assets.rb +0 -14
  265. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -8
  266. data/test/dummy/config/initializers/cookies_serializer.rb +0 -7
  267. data/test/dummy/config/initializers/mime_types.rb +0 -5
  268. data/test/dummy/config/initializers/session_store.rb +0 -5
  269. data/test/dummy/config/initializers/ui_bibz.rb +0 -5
  270. data/test/dummy/config/initializers/wrap_parameters.rb +0 -16
  271. data/test/dummy/config/secrets.yml +0 -22
  272. data/test/dummy/config/spring.rb +0 -8
  273. data/test/dummy/test/models/user_test.rb +0 -9
  274. data/vendor/assets/fonts/fa-brands-400.eot +0 -0
  275. data/vendor/assets/fonts/fa-brands-400.svg +0 -3570
  276. data/vendor/assets/fonts/fa-brands-400.ttf +0 -0
  277. data/vendor/assets/fonts/fa-brands-400.woff +0 -0
  278. data/vendor/assets/fonts/fa-brands-400.woff2 +0 -0
  279. data/vendor/assets/fonts/fa-regular-400.eot +0 -0
  280. data/vendor/assets/fonts/fa-regular-400.svg +0 -803
  281. data/vendor/assets/fonts/fa-regular-400.ttf +0 -0
  282. data/vendor/assets/fonts/fa-regular-400.woff +0 -0
  283. data/vendor/assets/fonts/fa-regular-400.woff2 +0 -0
  284. data/vendor/assets/fonts/fa-solid-900.eot +0 -0
  285. data/vendor/assets/fonts/fa-solid-900.svg +0 -4938
  286. data/vendor/assets/fonts/fa-solid-900.ttf +0 -0
  287. data/vendor/assets/fonts/fa-solid-900.woff +0 -0
  288. data/vendor/assets/fonts/fa-solid-900.woff2 +0 -0
  289. data/vendor/assets/javascripts/all.js +0 -4441
  290. data/vendor/assets/javascripts/all.min.js +0 -5
  291. data/vendor/assets/stylesheets/all.min.css +0 -5
  292. data/vendor/assets/stylesheets/fontawesome/_larger.scss +0 -23
  293. data/vendor/assets/stylesheets/svg-with-js.css +0 -5
  294. /data/{test/dummy/app/mailers/.keep → app/assets/stylesheets/sass/forms/_dropdown.sass} +0 -0
  295. /data/{test/dummy/app/views/users/index.html.erb → app/assets/stylesheets/sass/forms/_input_refresh_button.sass} +0 -0
@@ -23,13 +23,13 @@ module UiBibz::Utils
23
23
  end
24
24
  kl << write_classes(nil, @options)
25
25
 
26
- kl.delete_if(&:blank?)
26
+ kl.compact_blank!
27
27
  end
28
28
 
29
29
  private
30
30
 
31
31
  def col_options?
32
- (@options.keys.map(&:to_sym) & PARAMETERS).present?
32
+ @options.keys.map(&:to_sym).intersect?(PARAMETERS)
33
33
  end
34
34
 
35
35
  # md: 8 or md: { num: 3}, xs: { num: 4 }
@@ -41,7 +41,7 @@ module UiBibz::Utils
41
41
  send(k, size, v) if POSITIONING.include?(k.to_sym)
42
42
  end.join(' ')
43
43
  else
44
- send('num', size, opts)
44
+ send(:num, size, opts)
45
45
  end
46
46
  end
47
47
 
@@ -7,7 +7,7 @@ module UiBibz::Utils
7
7
 
8
8
  class << self
9
9
  def join_classes(*classes)
10
- klasses = Array(classes).flatten.filter_map(&:to_s).uniq.reject(&:blank?)
10
+ klasses = Array(classes).flatten.filter_map(&:to_s).uniq.compact_blank
11
11
  klasses.empty? ? nil : klasses
12
12
  end
13
13
 
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UiBibz
4
+ module ViewObjects
5
+ class GlyphComponentViewObject
6
+ attr_accessor :options, :content
7
+
8
+ def initialize(options, content = nil)
9
+ @options = options
10
+ @content = content
11
+ end
12
+
13
+ def render
14
+ UiBibz::Ui::Core::Icons::Glyph.new(glyph_options[:name], mute_glyph_option).render if glyph_options[:name].present?
15
+ end
16
+
17
+ private
18
+
19
+ def glyph_options
20
+ if options[:glyph].is_a?(Hash)
21
+ options[:glyph]
22
+ elsif options[:glyph]
23
+ { name: options[:glyph] }
24
+ else
25
+ {}
26
+ end
27
+ end
28
+
29
+ def mute_glyph_option
30
+ glyph_options.tap do |h|
31
+ h[:text] = options[:text]
32
+ h[:label] = options[:label] || content
33
+ h[:shortcut] = options[:shortcut] unless options[:shortcut].nil?
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
data/lib/ui_bibz.rb CHANGED
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'ui_bibz/railtie'
4
+
3
5
  require 'action_view'
4
6
  require 'will_paginate'
5
7
  require 'will-paginate-i18n'
8
+ require 'bootstrap/engine'
6
9
 
7
10
  # require "zeitwerk"
8
11
  # loader = Zeitwerk::Loader.for_gem
@@ -70,6 +73,27 @@ module UiBibz
70
73
  autoload :BreakdownClassNameGenerator, 'ui_bibz/utils/breakdown_class_name_generator'
71
74
  end
72
75
 
76
+ module FactoryMethods
77
+ autoload :ComponentInitializeFactoryMethod, 'ui_bibz/factory_methods/component_initialize_factory_method'
78
+ end
79
+
80
+ module Strategies
81
+ autoload :ComponentInitializeAbstractStrategy, 'ui_bibz/strategies/component_initialize_abstract_strategy'
82
+ autoload :ComponentInitializeStandardStrategy, 'ui_bibz/strategies/component_initialize_standard_strategy'
83
+ autoload :ComponentInitializeBlockStrategy, 'ui_bibz/strategies/component_initialize_block_strategy'
84
+ autoload :ComponentInitializeHashStrategy, 'ui_bibz/strategies/component_initialize_hash_strategy'
85
+ end
86
+
87
+ module Builders
88
+ autoload :DataHtmlOptionsBuilder, 'ui_bibz/builders/data_html_options_builder'
89
+ autoload :HtmlClassesBuilder, 'ui_bibz/builders/html_classes_builder'
90
+ autoload :HtmlOptionsBuilder, 'ui_bibz/builders/html_options_builder'
91
+ end
92
+
93
+ module ViewObjects
94
+ autoload :GlyphComponentViewObject, 'ui_bibz/view_objects/glyph_component_view_object'
95
+ end
96
+
73
97
  module Ui
74
98
  # Base
75
99
  autoload :Base, 'ui_bibz/ui/base'
@@ -191,6 +215,7 @@ module UiBibz
191
215
 
192
216
  module Windows
193
217
  autoload :Modal, 'ui_bibz/ui/core/windows/modal'
218
+ autoload :Offcanvas, 'ui_bibz/ui/core/windows/offcanvas'
194
219
  end
195
220
 
196
221
  # Other section
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'test_helper'
4
+
5
+ class DataHtmlOptionsBuilderTest < ActiveSupport::TestCase
6
+ def setup
7
+ @html_class_builder = UiBibz::Builders::DataHtmlOptionsBuilder.new({}, {})
8
+ end
9
+
10
+ test 'add key' do
11
+ @html_class_builder.add 'test'
12
+ expected = { data: { "test" => true } }
13
+
14
+ assert_equal expected, @html_class_builder.output
15
+ end
16
+
17
+ test 'add key and value' do
18
+ @html_class_builder.add 'test', value: 'test'
19
+ expected = { data: { "test" => 'test' } }
20
+
21
+ assert_equal expected, @html_class_builder.output
22
+ end
23
+
24
+ test 'add key with no value' do
25
+ @html_class_builder.add 'test', value: nil
26
+ expected = {}
27
+
28
+ assert_equal expected, @html_class_builder.output
29
+ end
30
+
31
+ test 'add key with value at false' do
32
+ @html_class_builder.add 'test', value: false
33
+ expected = { data: { "test" => false } }
34
+
35
+ assert_equal expected, @html_class_builder.output
36
+ end
37
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'test_helper'
4
+
5
+ class HtmlClassesBuilderTest < ActiveSupport::TestCase
6
+ def setup
7
+ @html_class_builder = UiBibz::Builders::HtmlClassesBuilder.new
8
+ end
9
+
10
+ test 'add class' do
11
+ @html_class_builder.add 'test'
12
+
13
+ assert_equal 'test', @html_class_builder.to_s
14
+ end
15
+
16
+ test 'remove class' do
17
+ @html_class_builder.add 'test'
18
+ @html_class_builder.remove 'test'
19
+
20
+ assert_nil @html_class_builder.output
21
+ end
22
+
23
+ test 'to_s uniq' do
24
+ @html_class_builder.add 'test'
25
+ @html_class_builder.add 'test'
26
+
27
+ assert_equal 'test', @html_class_builder.to_s
28
+ end
29
+
30
+ test 'return an array of string' do
31
+ @html_class_builder.add 'test'
32
+ @html_class_builder.add 'test2'
33
+
34
+ assert_equal %w[test test2], @html_class_builder.to_a
35
+ end
36
+
37
+ test 'create status class' do
38
+ @html_class_builder.add_composed 'test-%s', :success
39
+
40
+ assert_equal 'test-success', @html_class_builder.to_s
41
+ end
42
+
43
+ test 'remove all duplicate classes' do
44
+ @html_class_builder.add 'test'
45
+ @html_class_builder.add %w[test test2]
46
+ @html_class_builder.add 'test', 'test3'
47
+ @html_class_builder.add 'test test4'
48
+
49
+ assert_equal 'test test2 test3 test4', @html_class_builder.to_s
50
+ end
51
+
52
+ test 'add composed class' do
53
+ @html_class_builder.add 'test'
54
+ @html_class_builder.add_composed 'test-%s', :success
55
+
56
+ assert_equal 'test test-success', @html_class_builder.to_s
57
+ end
58
+
59
+ test 'output' do
60
+ @html_class_builder.add ''
61
+
62
+ assert_nil @html_class_builder.output
63
+ end
64
+
65
+ test 'join_classes' do
66
+ actual = UiBibz::Builders::HtmlClassesBuilder.join_classes 'test', 'test2'
67
+
68
+ assert_equal %w[test test2], actual
69
+ end
70
+
71
+ test 'exclude_classes' do
72
+ actual = UiBibz::Builders::HtmlClassesBuilder.exclude_classes 'test test2', 'test2'
73
+
74
+ assert_equal ['test'], actual
75
+ end
76
+ end
data/test/dummy/Rakefile CHANGED
@@ -3,6 +3,6 @@
3
3
  # Add your own tasks in files placed in lib/tasks ending in .rake,
4
4
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
5
5
 
6
- require_relative 'config/application'
6
+ require_relative "config/application"
7
7
 
8
8
  Rails.application.load_tasks
@@ -1,15 +1 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
1
+ /* Application styles */
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationCable
4
+ class Channel < ActionCable::Channel::Base
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationCable
4
+ class Connection < ActionCable::Connection::Base
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationJob < ActiveJob::Base
4
+ # Automatically retry jobs that encountered a deadlock
5
+ # retry_on ActiveRecord::Deadlocked
6
+
7
+ # Most jobs are safe to ignore if the underlying records are no longer available
8
+ # discard_on ActiveJob::DeserializationError
9
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationMailer < ActionMailer::Base
4
+ default from: "from@example.com"
5
+ layout "mailer"
6
+ end
@@ -1,17 +1,15 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
- <! -- <%= javascript_include_tag 'application', 'data-turbolinks-track' =>
7
- true %> -->
8
- <%= javascript_pack_tag 'application' %>
9
- <%= stylesheet_pack_tag 'application' %>
10
- <%= csrf_meta_tags %>
11
- </head>
12
- <body>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <%= csrf_meta_tags %>
7
+ <%= csp_meta_tag %>
13
8
 
14
- <%= yield %>
9
+ <%= stylesheet_link_tag "application" %>
10
+ </head>
15
11
 
16
- </body>
12
+ <body>
13
+ <%= yield %>
14
+ </body>
17
15
  </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
data/test/dummy/bin/rails CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- APP_PATH = File.expand_path('../config/application', __dir__)
5
- require_relative '../config/boot'
6
- require 'rails/commands'
4
+ APP_PATH = File.expand_path("../config/application", __dir__)
5
+ require_relative "../config/boot"
6
+ require "rails/commands"
data/test/dummy/bin/rake CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative '../config/boot'
5
- require 'rake'
4
+ require_relative "../config/boot"
5
+ require "rake"
6
6
  Rake.application.run
data/test/dummy/bin/setup CHANGED
@@ -1,35 +1,35 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'fileutils'
4
+ require "fileutils"
5
5
 
6
6
  # path to your application root.
7
- APP_ROOT = File.expand_path('..', __dir__)
7
+ APP_ROOT = File.expand_path("..", __dir__)
8
8
 
9
9
  def system!(*args)
10
10
  system(*args) || abort("\n== Command #{args} failed ==")
11
11
  end
12
12
 
13
13
  FileUtils.chdir APP_ROOT do
14
- # This script is a way to setup or update your development environment automatically.
15
- # This script is idempotent, so that you can run it at anytime and get an expectable outcome.
14
+ # This script is a way to set up or update your development environment automatically.
15
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
16
16
  # Add necessary setup steps to this file.
17
17
 
18
- puts '== Installing dependencies =='
19
- system! 'gem install bundler --conservative'
20
- system('bundle check') || system!('bundle install')
18
+ puts "== Installing dependencies =="
19
+ system! "gem install bundler --conservative"
20
+ system("bundle check") || system!("bundle install")
21
21
 
22
22
  # puts "\n== Copying sample files =="
23
- # unless File.exist?('config/database.yml')
24
- # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
23
+ # unless File.exist?("config/database.yml")
24
+ # FileUtils.cp "config/database.yml.sample", "config/database.yml"
25
25
  # end
26
26
 
27
27
  puts "\n== Preparing database =="
28
- system! 'bin/rails db:prepare'
28
+ system! "bin/rails db:prepare"
29
29
 
30
30
  puts "\n== Removing old logs and tempfiles =="
31
- system! 'bin/rails log:clear tmp:clear'
31
+ system! "bin/rails log:clear tmp:clear"
32
32
 
33
33
  puts "\n== Restarting application server =="
34
- system! 'bin/rails restart'
34
+ system! "bin/rails restart"
35
35
  end
@@ -1,28 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require File.expand_path('boot', __dir__)
3
+ require_relative "boot"
4
4
 
5
- require 'rails/all'
5
+ require "rails/all"
6
6
 
7
+ # Require the gems listed in Gemfile, including any gems
8
+ # you've limited to :test, :development, or :production.
7
9
  Bundler.require(*Rails.groups)
8
- require 'ui_bibz'
10
+ require "ui_bibz"
9
11
 
10
12
  module Dummy
11
13
  class Application < Rails::Application
12
- config.load_defaults 6.0
13
- # Settings in config/environments/* take precedence over those specified here.
14
- # Application configuration should go into files in config/initializers
15
- # -- all .rb files in that directory are automatically loaded.
14
+ config.load_defaults Rails::VERSION::STRING.to_f
16
15
 
17
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
18
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
19
- # config.time_zone = 'Central Time (US & Canada)'
20
-
21
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
22
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
23
- # config.i18n.default_locale = :de
24
-
25
- # Do not swallow errors in after_commit/after_rollback callbacks.
26
- # config.active_record.raise_in_transactional_callbacks = true
16
+ # Configuration for the application, engines, and railties goes here.
17
+ #
18
+ # These settings can be overridden in specific environments using the files
19
+ # in config/environments, which are processed later.
20
+ #
21
+ # config.time_zone = "Central Time (US & Canada)"
22
+ # config.eager_load_paths << Rails.root.join("extras")
27
23
  end
28
24
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Set up gems listed in the Gemfile.
4
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
4
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
5
5
 
6
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
7
- $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
6
+ require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
7
+ $LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
@@ -1,8 +1,8 @@
1
- # SQLite version 3.x
1
+ # SQLite. Versions 3.8.0 and up are supported.
2
2
  # gem install sqlite3
3
3
  #
4
4
  # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
5
+ # gem "sqlite3"
6
6
  #
7
7
  default: &default
8
8
  adapter: sqlite3
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Load the Rails application.
4
- require_relative 'application'
4
+ require_relative "application"
5
5
 
6
6
  # Initialize the Rails application.
7
7
  Rails.application.initialize!
@@ -1,10 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_support/core_ext/integer/time"
4
+
3
5
  Rails.application.configure do
4
6
  # Settings specified here will take precedence over those in config/application.rb.
5
7
 
6
- # In the development environment your application's code is reloaded on
7
- # every request. This slows down response time but is perfect for development
8
+ # In the development environment your application's code is reloaded any time
9
+ # it changes. This slows down response time but is perfect for development
8
10
  # since you don't have to restart the web server when you make code changes.
9
11
  config.cache_classes = false
10
12
 
@@ -14,15 +16,18 @@ Rails.application.configure do
14
16
  # Show full error reports.
15
17
  config.consider_all_requests_local = true
16
18
 
19
+ # Enable server timing
20
+ config.server_timing = true
21
+
17
22
  # Enable/disable caching. By default caching is disabled.
18
23
  # Run rails dev:cache to toggle caching.
19
- if Rails.root.join('tmp/caching-dev.txt').exist?
24
+ if Rails.root.join("tmp/caching-dev.txt").exist?
20
25
  config.action_controller.perform_caching = true
21
26
  config.action_controller.enable_fragment_cache_logging = true
22
27
 
23
28
  config.cache_store = :memory_store
24
29
  config.public_file_server.headers = {
25
- 'Cache-Control' => "public, max-age=#{2.days.to_i}"
30
+ "Cache-Control" => "public, max-age=#{2.days.to_i}"
26
31
  }
27
32
  else
28
33
  config.action_controller.perform_caching = false
@@ -41,24 +46,24 @@ Rails.application.configure do
41
46
  # Print deprecation notices to the Rails logger.
42
47
  config.active_support.deprecation = :log
43
48
 
49
+ # Raise exceptions for disallowed deprecations.
50
+ config.active_support.disallowed_deprecation = :raise
51
+
52
+ # Tell Active Support which deprecation messages to disallow.
53
+ config.active_support.disallowed_deprecation_warnings = []
54
+
44
55
  # Raise an error on page load if there are pending migrations.
45
56
  config.active_record.migration_error = :page_load
46
57
 
47
58
  # Highlight code that triggered database queries in logs.
48
59
  config.active_record.verbose_query_logs = true
49
60
 
50
- # Debug mode disables concatenation and preprocessing of assets.
51
- # This option may cause significant delays in view rendering with a large
52
- # number of complex assets.
53
- config.assets.debug = true
54
-
55
- # Suppress logger output for asset requests.
56
- config.assets.quiet = true
57
-
58
61
  # Raises error for missing translations.
59
- # config.action_view.raise_on_missing_translations = true
62
+ # config.i18n.raise_on_missing_translations = true
63
+
64
+ # Annotate rendered view with file names.
65
+ # config.action_view.annotate_rendered_view_with_filenames = true
60
66
 
61
- # Use an evented file watcher to asynchronously detect changes in source code,
62
- # routes, locales, etc. This feature depends on the listen gem.
63
- # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
67
+ # Uncomment if you wish to allow Action Cable access from any origin.
68
+ # config.action_cable.disable_request_forgery_protection = true
64
69
  end