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.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +3 -3
- data/.github/workflows/linter.yml +13 -12
- data/.overcommit.yml +6 -0
- data/.rubocop.yml +6 -0
- data/.ruby-version +1 -1
- data/Gemfile +19 -12
- data/Gemfile.lock +178 -138
- data/app/assets/config/ui_bibz.js +12 -0
- data/app/assets/javascripts/forms/formula.js +82 -0
- data/app/assets/javascripts/forms/input-connected.js +132 -0
- data/app/assets/javascripts/forms/jquery.multi-select-extend.js +52 -0
- data/app/assets/javascripts/forms.js +160 -0
- data/app/assets/javascripts/interfaces.js +56 -0
- data/app/assets/javascripts/tables.js +49 -0
- data/app/assets/javascripts/ui_bibz_js.js +37 -0
- data/app/assets/stylesheets/navigations/_nav.sass +2 -0
- data/app/assets/stylesheets/navigations/_navbar.sass +12 -0
- data/app/assets/stylesheets/navigations/_progress_bar.sass +2 -0
- data/app/assets/stylesheets/navigations/_toolbar.sass +3 -0
- data/app/assets/stylesheets/sass/_boxes.sass +1 -0
- data/app/assets/stylesheets/sass/_containers.sass +2 -0
- data/app/assets/stylesheets/sass/_fixes.sass +2 -0
- data/app/assets/stylesheets/sass/_forms.sass +8 -0
- data/app/assets/stylesheets/sass/_navigations.sass +4 -0
- data/app/assets/stylesheets/sass/_notifications.sass +4 -0
- data/app/assets/stylesheets/sass/_tables.sass +2 -0
- data/app/assets/stylesheets/sass/_variables_mixins_functions.sass +3 -0
- data/app/assets/stylesheets/sass/boxes/_card.sass +4 -0
- data/app/assets/stylesheets/sass/containers/_panel.scss +330 -0
- data/app/assets/stylesheets/sass/forms/_bootstrap_select.sass +5 -0
- data/app/assets/stylesheets/sass/forms/_button.sass +3 -0
- data/app/assets/stylesheets/sass/forms/_date_picker.sass +3 -0
- data/app/assets/stylesheets/sass/forms/_form_check.sass +10 -0
- data/app/assets/stylesheets/sass/forms/_formula_field.sass +17 -0
- data/app/assets/stylesheets/sass/forms/_multiselect.sass +44 -0
- data/app/assets/stylesheets/sass/forms/_range.sass +44 -0
- data/app/assets/stylesheets/sass/forms/_slider.sass +136 -0
- data/app/assets/stylesheets/sass/forms/_surround_field.sass +25 -0
- data/app/assets/stylesheets/sass/notifications/_badge.sass +5 -0
- data/app/assets/stylesheets/sass/notifications/_glyph.sass +3 -0
- data/app/assets/stylesheets/sass/notifications/_star.sass +2 -0
- data/app/assets/stylesheets/sass/notifications/_toast.sass +3 -0
- data/app/assets/stylesheets/sass/tables/_table.sass +39 -0
- data/app/assets/stylesheets/sass/tables/_table_card.sass +39 -0
- data/app/assets/stylesheets/ui_bibz.sass +26 -0
- data/bin/test +3 -5
- data/config/importmap.rb +19 -0
- data/config/initializers/assets.rb +5 -0
- data/config/initializers/will_paginate.rb +1 -3
- data/lib/ui_bibz/builders/data_html_options_builder.rb +118 -0
- data/lib/ui_bibz/builders/html_classes_builder.rb +89 -0
- data/lib/ui_bibz/builders/html_options_builder.rb +22 -0
- data/lib/ui_bibz/concerns/models/searchable.rb +1 -1
- data/lib/ui_bibz/factory_methods/component_initialize_factory_method.rb +33 -0
- data/lib/ui_bibz/helpers/ui/core/boxes_helper.rb +12 -12
- data/lib/ui_bibz/helpers/ui/core/forms_helper.rb +50 -50
- data/lib/ui_bibz/helpers/ui/core/icons_helper.rb +6 -6
- data/lib/ui_bibz/helpers/ui/core/layouts_helper.rb +2 -2
- data/lib/ui_bibz/helpers/ui/core/lists_helper.rb +2 -2
- data/lib/ui_bibz/helpers/ui/core/navigations_helper.rb +12 -12
- data/lib/ui_bibz/helpers/ui/core/notifications_helper.rb +4 -4
- data/lib/ui_bibz/helpers/ui/core/windows_helper.rb +10 -2
- data/lib/ui_bibz/helpers/ui/ux_helper.rb +2 -2
- data/lib/ui_bibz/helpers/utils_helper.rb +2 -2
- data/lib/ui_bibz/infos.rb +3 -3
- data/lib/ui_bibz/inputs/ui_bibz_form/ui_bibz_form_builder.rb +12 -12
- data/lib/ui_bibz/inputs/ui_bibz_inputs/collection_input.rb +1 -1
- data/lib/ui_bibz/rails/engine.rb +21 -4
- data/lib/ui_bibz/strategies/component_initialize_abstract_strategy.rb +27 -0
- data/lib/ui_bibz/strategies/component_initialize_block_strategy.rb +31 -0
- data/lib/ui_bibz/strategies/component_initialize_hash_strategy.rb +18 -0
- data/lib/ui_bibz/strategies/component_initialize_standard_strategy.rb +18 -0
- data/lib/ui_bibz/ui/concerns/card_itemable_concern.rb +4 -4
- data/lib/ui_bibz/ui/concerns/notification_concern.rb +1 -1
- data/lib/ui_bibz/ui/core/boxes/card.rb +1 -1
- data/lib/ui_bibz/ui/core/boxes/card_accordion.rb +4 -4
- data/lib/ui_bibz/ui/core/boxes/card_column.rb +1 -1
- data/lib/ui_bibz/ui/core/boxes/card_deck.rb +1 -1
- data/lib/ui_bibz/ui/core/boxes/card_grid.rb +0 -3
- data/lib/ui_bibz/ui/core/boxes/card_group.rb +1 -1
- data/lib/ui_bibz/ui/core/boxes/components/card_body.rb +9 -9
- data/lib/ui_bibz/ui/core/boxes/components/card_col.rb +2 -2
- data/lib/ui_bibz/ui/core/boxes/components/card_list_group.rb +1 -1
- data/lib/ui_bibz/ui/core/boxes/components/card_row.rb +1 -1
- data/lib/ui_bibz/ui/core/component.rb +13 -62
- data/lib/ui_bibz/ui/core/forms/buttons/button.rb +3 -1
- data/lib/ui_bibz/ui/core/forms/buttons/button_group.rb +11 -11
- data/lib/ui_bibz/ui/core/forms/choices/box_switch_field.rb +7 -7
- data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +2 -2
- data/lib/ui_bibz/ui/core/forms/choices/choice_group.rb +5 -6
- data/lib/ui_bibz/ui/core/forms/choices/components/choice.rb +1 -1
- data/lib/ui_bibz/ui/core/forms/dates/date_picker_field.rb +15 -15
- data/lib/ui_bibz/ui/core/forms/dropdowns/components/dropdown_link.rb +1 -1
- data/lib/ui_bibz/ui/core/forms/dropdowns/dropdown.rb +5 -5
- data/lib/ui_bibz/ui/core/forms/numbers/slider_field.rb +1 -1
- data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +10 -10
- data/lib/ui_bibz/ui/core/forms/selects/multi_column_field.rb +2 -2
- data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +32 -32
- data/lib/ui_bibz/ui/core/forms/textareas/markdown_editor_field.rb +7 -8
- data/lib/ui_bibz/ui/core/icons/components/glyph_text.rb +1 -1
- data/lib/ui_bibz/ui/core/icons/glyph.rb +4 -3
- data/lib/ui_bibz/ui/core/layouts/row.rb +2 -2
- data/lib/ui_bibz/ui/core/lists/components/list.rb +4 -4
- data/lib/ui_bibz/ui/core/lists/list_group.rb +1 -1
- data/lib/ui_bibz/ui/core/navigations/breadcrumb.rb +6 -4
- data/lib/ui_bibz/ui/core/navigations/components/nav_link_span.rb +1 -2
- data/lib/ui_bibz/ui/core/navigations/components/navbar_form.rb +6 -5
- data/lib/ui_bibz/ui/core/navigations/components/toolbar_form.rb +2 -2
- data/lib/ui_bibz/ui/core/navigations/nav.rb +10 -6
- data/lib/ui_bibz/ui/core/navigations/navbar.rb +21 -19
- data/lib/ui_bibz/ui/core/navigations/pagination.rb +3 -3
- data/lib/ui_bibz/ui/core/navigations/toolbar.rb +5 -5
- data/lib/ui_bibz/ui/core/notifications/alert.rb +4 -5
- data/lib/ui_bibz/ui/core/notifications/badge.rb +6 -2
- data/lib/ui_bibz/ui/core/notifications/components/toast_header.rb +1 -1
- data/lib/ui_bibz/ui/core/notifications/progress_bar.rb +3 -3
- data/lib/ui_bibz/ui/core/notifications/toast.rb +8 -9
- data/lib/ui_bibz/ui/core/windows/components/offcanvas_body.rb +47 -0
- data/lib/ui_bibz/ui/core/windows/components/offcanvas_header.rb +54 -0
- data/lib/ui_bibz/ui/core/windows/modal.rb +9 -9
- data/lib/ui_bibz/ui/core/windows/offcanvas.rb +84 -0
- data/lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb +4 -20
- data/lib/ui_bibz/ui/extensions/core/component/klass_extension.rb +11 -19
- data/lib/ui_bibz/ui/extensions/core/forms/connect_extension.rb +1 -1
- data/lib/ui_bibz/ui/ux/containers/components/panel_column.rb +3 -3
- data/lib/ui_bibz/ui/ux/containers/components/panel_deck.rb +3 -3
- data/lib/ui_bibz/ui/ux/containers/components/panel_group.rb +3 -3
- data/lib/ui_bibz/ui/ux/containers/components/panel_header.rb +4 -4
- data/lib/ui_bibz/ui/ux/containers/panel.rb +13 -13
- data/lib/ui_bibz/ui/ux/tables/components/actions.rb +4 -4
- data/lib/ui_bibz/ui/ux/tables/components/column.rb +1 -1
- data/lib/ui_bibz/ui/ux/tables/components/columns.rb +2 -2
- data/lib/ui_bibz/ui/ux/tables/extensions/sortable.rb +1 -1
- data/lib/ui_bibz/ui/ux/tables/table.rb +5 -5
- data/lib/ui_bibz/ui/ux/tables/table_card.rb +6 -6
- data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +1 -1
- data/lib/ui_bibz/utils/breakdown_class_name_generator.rb +3 -3
- data/lib/ui_bibz/utils/screwdriver.rb +1 -1
- data/lib/ui_bibz/view_objects/glyph_component_view_object.rb +38 -0
- data/lib/ui_bibz.rb +25 -0
- data/test/builders/data_html_classes_builder_test.rb +37 -0
- data/test/builders/html_classes_builder_test.rb +76 -0
- data/test/dummy/Rakefile +1 -1
- data/test/dummy/app/assets/stylesheets/application.css +1 -15
- data/test/dummy/app/channels/application_cable/channel.rb +6 -0
- data/test/dummy/app/channels/application_cable/connection.rb +6 -0
- data/test/dummy/app/jobs/application_job.rb +9 -0
- data/test/dummy/app/mailers/application_mailer.rb +6 -0
- data/test/dummy/app/views/layouts/application.html.erb +10 -12
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/rails +3 -3
- data/test/dummy/bin/rake +2 -2
- data/test/dummy/bin/setup +12 -12
- data/test/dummy/config/application.rb +13 -17
- data/test/dummy/config/boot.rb +3 -3
- data/test/dummy/config/database.yml +2 -2
- data/test/dummy/config/environment.rb +1 -1
- data/test/dummy/config/environments/development.rb +21 -16
- data/test/dummy/config/environments/production.rb +16 -41
- data/test/dummy/config/environments/test.rb +19 -8
- data/test/dummy/config/importmap.rb +11 -0
- data/test/dummy/config/initializers/content_security_policy.rb +21 -24
- data/test/dummy/config/initializers/filter_parameter_logging.rb +6 -2
- data/test/dummy/config/initializers/inflections.rb +4 -4
- data/test/dummy/config/initializers/permissions_policy.rb +12 -0
- data/test/dummy/config/locales/en.yml +13 -3
- data/test/dummy/config/puma.rb +7 -2
- data/test/dummy/config/storage.yml +5 -5
- data/test/dummy/config.ru +2 -1
- data/test/simple_form_test.rb +24 -24
- data/test/ui/core/boxes/card_test.rb +2 -1
- data/test/ui/core/component_test.rb +2 -2
- data/test/ui/core/forms/buttons/button_group_test.rb +1 -1
- data/test/ui/core/forms/buttons/button_link_test.rb +1 -1
- data/test/ui/core/forms/buttons/button_refresh_test.rb +1 -1
- data/test/ui/core/forms/buttons/button_test.rb +2 -2
- data/test/ui/core/forms/choices/box_switch_field_test.rb +10 -10
- data/test/ui/core/forms/choices/checkbox_field_test.rb +1 -1
- data/test/ui/core/forms/choices/choice_group_test.rb +1 -1
- data/test/ui/core/forms/dropdowns/dropdown_test.rb +1 -1
- data/test/ui/core/forms/numbers/formula_field_test.rb +1 -1
- data/test/ui/core/forms/selects/dropdown_select_field_test.rb +2 -2
- data/test/ui/core/forms/selects/select_field_test.rb +1 -1
- data/test/ui/core/forms/surrounds/surround_field_test.rb +4 -4
- data/test/ui/core/forms/texts/auto_complete_field_test.rb +2 -2
- data/test/ui/core/icons/glyph_test.rb +8 -4
- data/test/ui/core/icons/star_test.rb +12 -6
- data/test/ui/core/navigations/breadcrumb_test.rb +1 -1
- data/test/ui/core/navigations/link_test.rb +1 -1
- data/test/ui/core/navigations/nav_test.rb +11 -0
- data/test/ui/core/notifications/alert_test.rb +1 -1
- data/test/ui/core/notifications/badge_test.rb +3 -3
- data/test/ui/core/notifications/popover_test.rb +4 -4
- data/test/ui/core/notifications/spinner_test.rb +1 -1
- data/test/ui/core/notifications/toast_test.rb +1 -1
- data/test/ui/core/notifications/tooltip_test.rb +4 -4
- data/test/ui/core/windows/offcanvas_test.rb +27 -0
- data/test/ui/ux/containers/panel_test.rb +1 -1
- data/test/ui/ux/tables/table_test.rb +3 -3
- data/test/view_objects/glyph_component_view_object_test.rb +17 -0
- data/ui_bibz.gemspec +6 -20
- data/vendor/assets/fonts/fontawesome/fa-brands-400.ttf +0 -0
- data/vendor/assets/fonts/fontawesome/fa-brands-400.woff2 +0 -0
- data/vendor/assets/fonts/fontawesome/fa-regular-400.ttf +0 -0
- data/vendor/assets/fonts/fontawesome/fa-regular-400.woff2 +0 -0
- data/vendor/assets/fonts/fontawesome/fa-solid-900.ttf +0 -0
- data/vendor/assets/fonts/fontawesome/fa-solid-900.woff2 +0 -0
- data/vendor/assets/fonts/fontawesome/fa-v4compatibility.ttf +0 -0
- data/vendor/assets/fonts/fontawesome/fa-v4compatibility.woff2 +0 -0
- data/vendor/assets/javascripts/bootstrap-markdown.js +1 -1555
- data/vendor/assets/javascripts/bootstrap-multiselect.min.js +40 -1176
- data/vendor/assets/javascripts/bootstrap-switch.min.js +9 -21
- data/vendor/assets/javascripts/bs-custom-file-input.min.js +0 -1
- data/vendor/assets/javascripts/fontawesome/all.js +5977 -0
- data/vendor/assets/javascripts/fontawesome/all.min.js +6 -0
- data/vendor/assets/javascripts/fontawesome/brands.js +749 -0
- data/vendor/assets/javascripts/fontawesome/brands.min.js +6 -0
- data/vendor/assets/javascripts/fontawesome/conflict-detection.js +1138 -0
- data/vendor/assets/javascripts/fontawesome/conflict-detection.min.js +6 -0
- data/vendor/assets/javascripts/fontawesome/fontawesome.js +3126 -0
- data/vendor/assets/javascripts/fontawesome/fontawesome.min.js +6 -0
- data/vendor/assets/javascripts/fontawesome/regular.js +445 -0
- data/vendor/assets/javascripts/fontawesome/regular.min.js +6 -0
- data/vendor/assets/javascripts/fontawesome/solid.js +1672 -0
- data/vendor/assets/javascripts/fontawesome/solid.min.js +6 -0
- data/vendor/assets/javascripts/fontawesome/v4-shims.js +225 -0
- data/vendor/assets/javascripts/fontawesome/v4-shims.min.js +6 -0
- data/vendor/assets/javascripts/fuzzysort.js +562 -0
- data/vendor/assets/javascripts/jquery-3.7.0.min.js +2 -0
- data/vendor/assets/javascripts/jquery.multi-select.min.js +725 -1
- data/vendor/assets/stylesheets/bootstrap-multiselect.sass +115 -0
- data/vendor/assets/stylesheets/bootstrap-switch.scss +211 -0
- data/vendor/assets/stylesheets/fontawesome/_animated.scss +142 -9
- data/vendor/assets/stylesheets/fontawesome/_bordered-pulled.scss +13 -13
- data/vendor/assets/stylesheets/fontawesome/_core.scss +28 -6
- data/vendor/assets/stylesheets/fontawesome/_fixed-width.scss +2 -1
- data/vendor/assets/stylesheets/fontawesome/_functions.scss +57 -0
- data/vendor/assets/stylesheets/fontawesome/_icons.scss +7 -1438
- data/vendor/assets/stylesheets/fontawesome/_list.scss +4 -4
- data/vendor/assets/stylesheets/fontawesome/_mixins.scss +53 -34
- data/vendor/assets/stylesheets/fontawesome/_rotated-flipped.scss +25 -18
- data/vendor/assets/stylesheets/fontawesome/_screen-reader.scss +12 -3
- data/vendor/assets/stylesheets/fontawesome/_shims.scss +640 -664
- data/vendor/assets/stylesheets/fontawesome/_sizing.scss +16 -0
- data/vendor/assets/stylesheets/fontawesome/_stacked.scss +5 -4
- data/vendor/assets/stylesheets/fontawesome/_variables.scss +4896 -1393
- data/vendor/assets/stylesheets/fontawesome/brands.scss +17 -10
- data/vendor/assets/stylesheets/fontawesome/fontawesome.scss +7 -2
- data/vendor/assets/stylesheets/fontawesome/regular.scss +13 -10
- data/vendor/assets/stylesheets/fontawesome/solid.scss +13 -11
- data/vendor/assets/stylesheets/fontawesome/v4-shims.scss +6 -1
- data/vendor/assets/stylesheets/multi-select.css +92 -0
- metadata +120 -348
- data/.gitlab-ci.yml +0 -17
- data/.travis.yml +0 -24
- data/lib/ui_bibz/ui/extensions/core/component/popover_extension.rb +0 -70
- data/structure.md +0 -68
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/app/assets/javascripts/application.js +0 -13
- data/test/dummy/app/javascripts/packs/index.js +0 -3
- data/test/dummy/config/initializers/application_controller_renderer.rb +0 -9
- data/test/dummy/config/initializers/assets.rb +0 -14
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -8
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -7
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/session_store.rb +0 -5
- data/test/dummy/config/initializers/ui_bibz.rb +0 -5
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -16
- data/test/dummy/config/secrets.yml +0 -22
- data/test/dummy/config/spring.rb +0 -8
- data/test/dummy/test/models/user_test.rb +0 -9
- data/vendor/assets/fonts/fa-brands-400.eot +0 -0
- data/vendor/assets/fonts/fa-brands-400.svg +0 -3570
- data/vendor/assets/fonts/fa-brands-400.ttf +0 -0
- data/vendor/assets/fonts/fa-brands-400.woff +0 -0
- data/vendor/assets/fonts/fa-brands-400.woff2 +0 -0
- data/vendor/assets/fonts/fa-regular-400.eot +0 -0
- data/vendor/assets/fonts/fa-regular-400.svg +0 -803
- data/vendor/assets/fonts/fa-regular-400.ttf +0 -0
- data/vendor/assets/fonts/fa-regular-400.woff +0 -0
- data/vendor/assets/fonts/fa-regular-400.woff2 +0 -0
- data/vendor/assets/fonts/fa-solid-900.eot +0 -0
- data/vendor/assets/fonts/fa-solid-900.svg +0 -4938
- data/vendor/assets/fonts/fa-solid-900.ttf +0 -0
- data/vendor/assets/fonts/fa-solid-900.woff +0 -0
- data/vendor/assets/fonts/fa-solid-900.woff2 +0 -0
- data/vendor/assets/javascripts/all.js +0 -4441
- data/vendor/assets/javascripts/all.min.js +0 -5
- data/vendor/assets/stylesheets/all.min.css +0 -5
- data/vendor/assets/stylesheets/fontawesome/_larger.scss +0 -23
- data/vendor/assets/stylesheets/svg-with-js.css +0 -5
- /data/{test/dummy/app/mailers/.keep → app/assets/stylesheets/sass/forms/_dropdown.sass} +0 -0
- /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.
|
26
|
+
kl.compact_blank!
|
27
27
|
end
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
31
|
def col_options?
|
32
|
-
|
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(
|
44
|
+
send(:num, size, opts)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -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
|
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,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
|
@@ -1,17 +1,15 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
<head>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
-
<%=
|
9
|
+
<%= stylesheet_link_tag "application" %>
|
10
|
+
</head>
|
15
11
|
|
16
|
-
|
12
|
+
<body>
|
13
|
+
<%= yield %>
|
14
|
+
</body>
|
17
15
|
</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(
|
5
|
-
require_relative
|
6
|
-
require
|
4
|
+
APP_PATH = File.expand_path("../config/application", __dir__)
|
5
|
+
require_relative "../config/boot"
|
6
|
+
require "rails/commands"
|
data/test/dummy/bin/rake
CHANGED
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
|
4
|
+
require "fileutils"
|
5
5
|
|
6
6
|
# path to your application root.
|
7
|
-
APP_ROOT = File.expand_path(
|
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
|
15
|
-
# This script is idempotent, so that you can run it at
|
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
|
19
|
-
system!
|
20
|
-
system(
|
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?(
|
24
|
-
# FileUtils.cp
|
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!
|
28
|
+
system! "bin/rails db:prepare"
|
29
29
|
|
30
30
|
puts "\n== Removing old logs and tempfiles =="
|
31
|
-
system!
|
31
|
+
system! "bin/rails log:clear tmp:clear"
|
32
32
|
|
33
33
|
puts "\n== Restarting application server =="
|
34
|
-
system!
|
34
|
+
system! "bin/rails restart"
|
35
35
|
end
|
@@ -1,28 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "boot"
|
4
4
|
|
5
|
-
require
|
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
|
10
|
+
require "ui_bibz"
|
9
11
|
|
10
12
|
module Dummy
|
11
13
|
class Application < Rails::Application
|
12
|
-
config.load_defaults
|
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
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
|
21
|
-
#
|
22
|
-
# config.
|
23
|
-
# config.
|
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
|
data/test/dummy/config/boot.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Set up gems listed in the Gemfile.
|
4
|
-
ENV[
|
4
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
|
5
5
|
|
6
|
-
require
|
7
|
-
$LOAD_PATH.unshift File.expand_path(
|
6
|
+
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
|
7
|
+
$LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
|
@@ -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
|
7
|
-
#
|
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(
|
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
|
-
|
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.
|
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
|
-
#
|
62
|
-
#
|
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
|