trestle 0.9.9 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +26 -0
- data/.github/workflows/rspec.yml +37 -5
- data/.gitignore +3 -0
- data/Gemfile +14 -1
- data/README.md +3 -2
- data/app/assets/bundle/trestle/admin.css +23 -0
- data/app/assets/bundle/trestle/admin.js +83 -0
- data/app/assets/bundle/trestle/fa-brands-400.ttf +0 -0
- data/app/assets/bundle/trestle/fa-brands-400.woff2 +0 -0
- data/app/assets/bundle/trestle/fa-regular-400.ttf +0 -0
- data/app/assets/bundle/trestle/fa-regular-400.woff2 +0 -0
- data/app/assets/bundle/trestle/fa-solid-900.ttf +0 -0
- data/app/assets/bundle/trestle/fa-solid-900.woff2 +0 -0
- data/app/assets/bundle/trestle/locale/cs.js +110 -0
- data/app/assets/bundle/trestle/locale/de.js +116 -0
- data/app/assets/bundle/trestle/locale/en.js +329 -0
- data/app/assets/bundle/trestle/locale/es-MX.js +109 -0
- data/app/assets/bundle/trestle/locale/es.js +109 -0
- data/app/assets/bundle/trestle/locale/fr.js +111 -0
- data/app/assets/bundle/trestle/locale/ko.js +111 -0
- data/app/assets/bundle/trestle/locale/lv.js +109 -0
- data/app/assets/bundle/trestle/locale/nl.js +96 -0
- data/app/assets/bundle/trestle/locale/pl.js +99 -0
- data/app/assets/bundle/trestle/locale/pt-BR.js +98 -0
- data/app/assets/bundle/trestle/locale/vi.js +116 -0
- data/app/assets/bundle/trestle/locale/zh-CN.js +109 -0
- data/app/assets/bundle/trestle/photoswipe-063ce7be40e10b3e6848.digested.js +6 -0
- data/app/assets/sprockets/trestle/custom.css +1 -0
- data/app/assets/sprockets/trestle/icons/font-awesome.css.erb +32 -0
- data/app/assets/sprockets/trestle/manifest.js +4 -0
- data/app/assets/stylesheets/trestle/custom.css +6 -1
- data/app/controllers/concerns/trestle/controller/helpers.rb +2 -0
- data/app/controllers/concerns/trestle/controller/location.rb +1 -6
- data/app/controllers/concerns/trestle/controller/modal.rb +25 -0
- data/app/controllers/concerns/trestle/controller/turbo_stream.rb +12 -0
- data/app/controllers/concerns/trestle/resource/controller/actions.rb +39 -28
- data/app/controllers/concerns/trestle/resource/controller/redirection.rb +5 -5
- data/app/controllers/trestle/application_controller.rb +2 -1
- data/app/helpers/trestle/flash_helper.rb +10 -0
- data/app/helpers/trestle/form_helper.rb +3 -2
- data/app/helpers/trestle/format_helper.rb +2 -1
- data/app/helpers/trestle/i18n_helper.rb +46 -7
- data/app/helpers/trestle/modal_helper.rb +29 -0
- data/app/helpers/trestle/tab_helper.rb +1 -1
- data/app/helpers/trestle/turbo/frame_helper.rb +29 -0
- data/app/helpers/trestle/turbo/stream_helper.rb +9 -0
- data/app/helpers/trestle/turbo/tag_builder.rb +21 -0
- data/app/helpers/trestle/url_helper.rb +7 -4
- data/app/views/layouts/trestle/admin.html.erb +16 -18
- data/app/views/layouts/trestle/admin.turbo_stream.erb +4 -0
- data/app/views/layouts/trestle/modal.html.erb +5 -0
- data/app/views/trestle/_i18n.html.erb +12 -0
- data/app/views/trestle/_theme.html.erb +15 -0
- data/app/views/trestle/application/_header.html.erb +12 -10
- data/app/views/trestle/application/_layout.html.erb +6 -3
- data/app/views/trestle/application/_modal.html.erb +36 -0
- data/app/views/trestle/application/_tabs.html.erb +4 -4
- data/app/views/trestle/flash/_alert.html.erb +1 -1
- data/app/views/trestle/flash/_debug.html.erb +1 -1
- data/app/views/trestle/resource/_form.html.erb +5 -0
- data/app/views/trestle/resource/create.turbo_stream.erb +1 -0
- data/app/views/trestle/resource/destroy.turbo_stream.erb +1 -0
- data/app/views/trestle/resource/edit.html.erb +6 -2
- data/app/views/trestle/resource/index.html.erb +17 -10
- data/app/views/trestle/resource/new.html.erb +9 -2
- data/app/views/trestle/resource/show.html.erb +6 -2
- data/app/views/trestle/resource/update.turbo_stream.erb +1 -0
- data/app/views/trestle/shared/_sidebar.html.erb +10 -10
- data/frontend/css/components/_alerts.scss +41 -37
- data/frontend/css/components/_avatar.scss +12 -12
- data/frontend/css/components/_background.scss +8 -36
- data/frontend/css/components/_badges.scss +31 -0
- data/frontend/css/components/_breadcrumbs.scss +9 -30
- data/frontend/css/components/_buttons.scss +8 -7
- data/frontend/css/components/_datepicker.scss +15 -11
- data/frontend/css/components/_dropdown.scss +21 -9
- data/frontend/css/components/{_fields.scss → _forms.scss} +18 -5
- data/frontend/css/components/_grid.scss +29 -0
- data/frontend/css/components/_media-grid.scss +52 -44
- data/frontend/css/components/_modal.scss +37 -8
- data/frontend/css/components/_pagination.scss +5 -9
- data/frontend/css/components/_photoswipe.scss +8 -0
- data/frontend/css/components/_popover.scss +2 -1
- data/frontend/css/components/_scopes.scss +5 -11
- data/frontend/css/components/_select.scss +160 -31
- data/frontend/css/components/_sort.scss +1 -1
- data/frontend/css/components/_table.scss +61 -66
- data/frontend/css/components/_tabs.scss +20 -20
- data/frontend/css/components/_tags.scss +80 -15
- data/frontend/css/components/_toolbars.scss +18 -13
- data/frontend/css/components/_turbo.scss +3 -0
- data/frontend/css/core/_bootstrap.scss +46 -0
- data/frontend/css/core/_dependencies.scss +4 -3
- data/frontend/css/core/_functions.scss +31 -0
- data/frontend/css/core/_mixins.scss +2 -36
- data/frontend/css/core/_theme.scss +261 -0
- data/frontend/css/core/_typography.scss +16 -14
- data/frontend/css/icons/_fontawesome.scss +3 -15
- data/frontend/css/index.scss +15 -7
- data/frontend/css/layout/_base.scss +6 -4
- data/frontend/css/layout/_content-header.scss +71 -0
- data/frontend/css/layout/_footer.scss +5 -7
- data/frontend/css/layout/_header.scss +5 -3
- data/frontend/css/layout/_main-content.scss +107 -0
- data/frontend/css/layout/_navigation.scss +112 -50
- data/frontend/css/layout/_sidebar.scss +72 -36
- data/frontend/css/support/_sprockets.scss +2 -0
- data/frontend/css/support/_webpack.scss +2 -0
- data/frontend/css/variables/_bootstrap.scss +158 -55
- data/frontend/css/variables/_maps.scss +15 -0
- data/frontend/css/variables/_trestle.scss +70 -38
- data/frontend/js/controllers/application_controller.js +17 -0
- data/frontend/js/controllers/batch_action_controller.js +59 -0
- data/frontend/js/controllers/checkbox_select_controller.js +46 -0
- data/frontend/js/controllers/confirm_controller.js +115 -0
- data/frontend/js/controllers/confirm_delete_controller.js +11 -0
- data/frontend/js/controllers/datepicker_controller.js +12 -0
- data/frontend/js/controllers/datetimepicker_controller.js +13 -0
- data/frontend/js/controllers/deprecated/init_controller.js +9 -0
- data/frontend/js/controllers/flatpickr_controller.js +50 -0
- data/frontend/js/controllers/follow_url_controller.js +36 -0
- data/frontend/js/controllers/form_error_controller.js +24 -0
- data/frontend/js/controllers/form_loading_controller.js +50 -0
- data/frontend/js/controllers/gallery_controller.js +12 -0
- data/frontend/js/controllers/index.js +19 -0
- data/frontend/js/controllers/keyboard_submit_controller.js +25 -0
- data/frontend/js/controllers/lightbox_controller.js +158 -0
- data/frontend/js/controllers/mobile_sidebar_controller.js +30 -0
- data/frontend/js/controllers/modal_controller.js +36 -0
- data/frontend/js/controllers/modal_frame_controller.js +11 -0
- data/frontend/js/controllers/modal_trigger_controller.js +74 -0
- data/frontend/js/{components/navigation.js → controllers/navigation_controller.js} +14 -10
- data/frontend/js/controllers/navigation_tooltip_controller.js +32 -0
- data/frontend/js/controllers/popover_controller.js +87 -0
- data/frontend/js/controllers/reloadable_controller.js +34 -0
- data/frontend/js/controllers/select_controller.js +49 -0
- data/frontend/js/controllers/sidebar_controller.js +33 -0
- data/frontend/js/controllers/tab_errors_controller.js +45 -0
- data/frontend/js/controllers/tabs_controller.js +45 -0
- data/frontend/js/controllers/timepicker_controller.js +14 -0
- data/frontend/js/controllers/toggle_attr_controller.js +27 -0
- data/frontend/js/controllers/toggle_class_controller.js +27 -0
- data/frontend/js/controllers/tooltip_controller.js +13 -0
- data/frontend/js/controllers/wrapper_controller.js +43 -0
- data/frontend/js/core/backdrop.js +100 -0
- data/frontend/js/core/error_modal.js +65 -0
- data/frontend/js/core/fetch.js +32 -0
- data/frontend/js/core/i18n.js +24 -10
- data/frontend/js/core/modal.js +52 -0
- data/frontend/js/core/stream_actions.js +56 -0
- data/frontend/js/core/turbo_errors.js +9 -0
- data/frontend/js/{core → deprecated}/events.js +1 -8
- data/frontend/js/deprecated/tooltip.js +8 -0
- data/frontend/js/index.js +28 -40
- data/frontend/js/mixins/index.js +5 -0
- data/frontend/js/mixins/photoswipe.js +10 -0
- data/frontend/js/util/bootstrap.js +93 -0
- data/i18n/config.yml +14 -0
- data/i18n/environment.rb +8 -0
- data/i18n/export +3 -0
- data/i18n/template.erb +1 -0
- data/lib/generators/trestle/install/install_generator.rb +3 -8
- data/lib/generators/trestle/install/templates/trestle.rb.erb +5 -5
- data/lib/trestle/color.rb +113 -0
- data/lib/trestle/configuration.rb +16 -8
- data/lib/trestle/engine.rb +28 -20
- data/lib/trestle/form/fields/check_box_helpers.rb +7 -18
- data/lib/trestle/form/fields/collection_select.rb +1 -1
- data/lib/trestle/form/fields/color_field.rb +4 -0
- data/lib/trestle/form/fields/date_field.rb +4 -0
- data/lib/trestle/form/fields/date_picker.rb +10 -4
- data/lib/trestle/form/fields/date_select.rb +1 -1
- data/lib/trestle/form/fields/datetime_field.rb +4 -0
- data/lib/trestle/form/fields/datetime_select.rb +1 -1
- data/lib/trestle/form/fields/file_field.rb +3 -28
- data/lib/trestle/form/fields/form_control.rb +2 -2
- data/lib/trestle/form/fields/form_group.rb +1 -1
- data/lib/trestle/form/fields/grouped_collection_select.rb +1 -1
- data/lib/trestle/form/fields/radio_button_helpers.rb +5 -17
- data/lib/trestle/form/fields/range_field.rb +1 -5
- data/lib/trestle/form/fields/select.rb +17 -1
- data/lib/trestle/form/fields/time_field.rb +4 -0
- data/lib/trestle/form/fields/time_select.rb +1 -1
- data/lib/trestle/form/fields/time_zone_select.rb +1 -1
- data/lib/trestle/form/renderer.rb +4 -1
- data/lib/trestle/form.rb +16 -1
- data/lib/trestle/resource/toolbar.rb +18 -8
- data/lib/trestle/sprockets_compressor.rb +16 -0
- data/lib/trestle/table/actions_column.rb +2 -2
- data/lib/trestle/table/row.rb +2 -1
- data/lib/trestle/table/select_column.rb +3 -6
- data/lib/trestle/table.rb +6 -1
- data/lib/trestle/toolbar/context.rb +7 -4
- data/lib/trestle/toolbar/item.rb +1 -1
- data/lib/trestle/toolbar/menu.rb +11 -11
- data/lib/trestle/version.rb +1 -1
- data/lib/trestle.rb +2 -23
- data/package.json +31 -27
- data/trestle.gemspec +6 -11
- data/webpack.config.js +10 -10
- data/yarn.lock +1523 -1274
- metadata +177 -210
- data/app/assets/bundle/trestle/bundle.css +0 -12
- data/app/assets/bundle/trestle/bundle.js +0 -89
- data/app/assets/bundle/trestle/fa-brands-400.eot +0 -0
- data/app/assets/bundle/trestle/fa-brands-400.svg +0 -3717
- data/app/assets/bundle/trestle/fa-brands-400.woff +0 -0
- data/app/assets/bundle/trestle/fa-regular-400.eot +0 -0
- data/app/assets/bundle/trestle/fa-regular-400.svg +0 -801
- data/app/assets/bundle/trestle/fa-regular-400.woff +0 -0
- data/app/assets/bundle/trestle/fa-solid-900.eot +0 -0
- data/app/assets/bundle/trestle/fa-solid-900.svg +0 -5034
- data/app/assets/bundle/trestle/fa-solid-900.woff +0 -0
- data/app/assets/javascripts/trestle/admin.js +0 -3
- data/app/assets/javascripts/trestle/i18n.js.erb +0 -8
- data/app/assets/stylesheets/trestle/admin.css +0 -2
- data/app/assets/stylesheets/trestle/icons/_font-awesome.css.erb +0 -40
- data/app/controllers/concerns/trestle/controller/dialog.rb +0 -16
- data/app/views/trestle/application/_dialog.html.erb +0 -34
- data/frontend/css/components/_color-vars.scss +0 -10
- data/frontend/css/components/_custom-forms.scss +0 -35
- data/frontend/css/components/_magnific-popup.scss +0 -36
- data/frontend/css/components/_turbolinks.scss +0 -3
- data/frontend/css/layout/_content.scss +0 -169
- data/frontend/js/components/confirmation.js +0 -32
- data/frontend/js/components/datepicker.js +0 -69
- data/frontend/js/components/dialog.js +0 -149
- data/frontend/js/components/file.js +0 -7
- data/frontend/js/components/form.js +0 -100
- data/frontend/js/components/gallery.js +0 -33
- data/frontend/js/components/pagination.js +0 -51
- data/frontend/js/components/select.js +0 -18
- data/frontend/js/components/sidebar.js +0 -75
- data/frontend/js/components/table.js +0 -61
- data/frontend/js/components/tabs.js +0 -59
- data/frontend/js/components/tooltips.js +0 -25
- data/frontend/js/core/contexts.js +0 -17
- data/frontend/js/core/turbolinks.js +0 -3
- data/frontend/js/core/visit.js +0 -16
- data/frontend/theme/trestle/_theme.scss +0 -4
- data/frontend/theme/trestle/_variables.scss +0 -4
- data/frontend/theme/trestle/theme/_defaults.scss +0 -152
- data/frontend/theme/trestle/theme/_functions.scss +0 -44
- data/frontend/theme/trestle/theme/_variables.scss +0 -15
- data/frontend/theme/trestle/theme/bootstrap/_alert.scss +0 -19
- data/frontend/theme/trestle/theme/bootstrap/_badge.scss +0 -25
- data/frontend/theme/trestle/theme/bootstrap/_buttons.scss +0 -93
- data/frontend/theme/trestle/theme/bootstrap/_color-vars.scss +0 -11
- data/frontend/theme/trestle/theme/bootstrap/_custom-forms.scss +0 -93
- data/frontend/theme/trestle/theme/bootstrap/_dropdown.scss +0 -6
- data/frontend/theme/trestle/theme/bootstrap/_forms.scss +0 -6
- data/frontend/theme/trestle/theme/bootstrap/_links.scss +0 -7
- data/frontend/theme/trestle/theme/bootstrap/_list-group.scss +0 -31
- data/frontend/theme/trestle/theme/bootstrap/_nav.scss +0 -6
- data/frontend/theme/trestle/theme/bootstrap/_pagination.scss +0 -18
- data/frontend/theme/trestle/theme/bootstrap/_progress.scss +0 -3
- data/frontend/theme/trestle/theme/bootstrap/_tables.scss +0 -41
- data/frontend/theme/trestle/theme/bootstrap/_utilities.scss +0 -3
- data/frontend/theme/trestle/theme/bootstrap/utilities/_background.scss +0 -17
- data/frontend/theme/trestle/theme/bootstrap/utilities/_borders.scss +0 -5
- data/frontend/theme/trestle/theme/bootstrap/utilities/_text.scss +0 -18
- data/frontend/theme/trestle/theme/trestle/_background.scss +0 -61
- data/frontend/theme/trestle/theme/trestle/_datepicker.scss +0 -58
- data/frontend/theme/trestle/theme/trestle/_headers.scss +0 -4
- data/frontend/theme/trestle/theme/trestle/_navbar.scss +0 -15
- data/frontend/theme/trestle/theme/trestle/_navigation.scss +0 -5
- data/frontend/theme/trestle/theme/trestle/_select2.scss +0 -22
- data/frontend/theme/trestle/theme/trestle/_tags.scss +0 -12
- data/frontend/theme/trestle/theme/trestle/_turbolinks.scss +0 -3
- data/frontend/theme/trestle/theme.scss +0 -29
- data/lib/generators/trestle/install/templates/_theme.scss +0 -13
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ar-dz.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ar.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/at.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/az.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/be.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/bg.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/bn.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/bs.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/cat.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ckb.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/cs.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/cy.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/da.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/de.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/default.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/eo.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/es.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/et.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fa.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fi.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fo.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/fr.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ga.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/gr.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/he.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hi.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hr.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hu.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/hy.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/id.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/is.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/it.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ja.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ka.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/km.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ko.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/kz.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/lt.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/lv.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/mk.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/mn.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ms.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/my.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/nl.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/nn.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/no.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/pa.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/pl.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/pt.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ro.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/ru.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/si.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sk.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sl.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sq.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sr-cyr.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sr.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/sv.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/th.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/tr.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/uk.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/uz.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/uz_latn.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/vn.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/zh-tw.js +0 -0
- /data/app/assets/bundle/trestle/{flatpickr → locale/flatpickr}/zh.js +0 -0
- /data/app/assets/{stylesheets → sprockets}/trestle/_custom.css +0 -0
@@ -22,8 +22,19 @@ module Trestle
|
|
22
22
|
# Default timestamp precision
|
23
23
|
option :timestamp_precision, :minutes
|
24
24
|
|
25
|
-
# Theme
|
26
|
-
option :theme,
|
25
|
+
# Theme colors
|
26
|
+
option :theme, {}
|
27
|
+
|
28
|
+
def theme=(colors)
|
29
|
+
if [true, false].include?(colors)
|
30
|
+
Trestle.deprecator.warn("Passing a boolean to config.theme is deprecated. Please pass primary and secondary theme colors as a hash.")
|
31
|
+
else
|
32
|
+
original = fetch(:colors) || {}
|
33
|
+
colors = colors.transform_values { |color| Trestle::Color.parse(color) }
|
34
|
+
|
35
|
+
assign(:theme, original.merge(colors))
|
36
|
+
end
|
37
|
+
end
|
27
38
|
|
28
39
|
|
29
40
|
## Mounting Options
|
@@ -68,8 +79,8 @@ module Trestle
|
|
68
79
|
self.helper_module.module_eval(&block) if block_given?
|
69
80
|
end
|
70
81
|
|
71
|
-
# Enable or disable Turbolinks within the Trestle admin
|
72
|
-
|
82
|
+
# [DEPRECATED] Enable or disable Turbolinks within the Trestle admin
|
83
|
+
deprecated_option :turbolinks, "The config.turbolinks option is deprecated. Turbo is included and enabled by default within Trestle."
|
73
84
|
|
74
85
|
# List of parameters that should persist across requests when paginating or reordering
|
75
86
|
option :persistent_params, [:sort, :order, :scope]
|
@@ -94,10 +105,7 @@ module Trestle
|
|
94
105
|
end
|
95
106
|
|
96
107
|
# List of i18n keys to pass into the Trestle.i18n JavaScript object
|
97
|
-
option :javascript_i18n_keys, [
|
98
|
-
"trestle.confirmation.title", "trestle.confirmation.delete", "trestle.confirmation.cancel", "trestle.dialog.error",
|
99
|
-
"admin.buttons.ok", "admin.datepicker.formats.date", "admin.datepicker.formats.datetime", "admin.datepicker.formats.time"
|
100
|
-
]
|
108
|
+
option :javascript_i18n_keys, []
|
101
109
|
|
102
110
|
# List of load paths for where to find admin definitions
|
103
111
|
option :load_paths, [
|
data/lib/trestle/engine.rb
CHANGED
@@ -1,17 +1,18 @@
|
|
1
|
-
require "
|
1
|
+
require "turbo-rails"
|
2
2
|
|
3
3
|
module Trestle
|
4
4
|
class Engine < ::Rails::Engine
|
5
5
|
isolate_namespace Trestle
|
6
6
|
self.routes.default_scope = {}
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
initializer "trestle.sprockets" do |app|
|
9
|
+
# Sprockets manifest
|
10
|
+
config.assets.precompile << "trestle/manifest.js"
|
11
|
+
end if defined?(Sprockets)
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
13
|
+
initializer "trestle.propshaft" do |app|
|
14
|
+
app.config.assets.excluded_paths << Trestle::Engine.root.join("app/assets/sprockets")
|
15
|
+
end if defined?(Propshaft)
|
15
16
|
|
16
17
|
initializer "trestle.automount" do |app|
|
17
18
|
if Trestle.config.automount
|
@@ -21,25 +22,16 @@ module Trestle
|
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
25
|
+
initializer "trestle.deprecator" do |app|
|
26
|
+
app.deprecators[:trestle] = Trestle.deprecator if app.respond_to?(:deprecators)
|
27
|
+
end
|
28
|
+
|
24
29
|
initializer "trestle.draper" do |app|
|
25
30
|
if defined?(Draper)
|
26
31
|
Draper::CollectionDecorator.delegate :current_page, :total_pages, :limit_value, :entry_name, :total_count, :offset_value, :last_page?
|
27
32
|
end
|
28
33
|
end
|
29
34
|
|
30
|
-
initializer "trestle.theme" do |app|
|
31
|
-
# Enable theme compilation
|
32
|
-
if Trestle.config.theme
|
33
|
-
app.config.assets.paths << root.join("frontend/theme").to_s
|
34
|
-
app.config.assets.precompile << "trestle/theme.css"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
initializer "trestle.turbolinks" do |app|
|
39
|
-
# Optional turbolinks
|
40
|
-
app.config.assets.precompile << "turbolinks.js" if Trestle.config.turbolinks
|
41
|
-
end
|
42
|
-
|
43
35
|
config.to_prepare do
|
44
36
|
Engine.reset_helpers!
|
45
37
|
end
|
@@ -49,6 +41,22 @@ module Trestle
|
|
49
41
|
reloader.install(app) unless app.config.eager_load
|
50
42
|
end
|
51
43
|
|
44
|
+
# For compatibility with the `sassc-rails`` gem, register a custom compressor that excludes the
|
45
|
+
# Trestle admin stylesheets as a) they are already minimized and b) libsass is not compatible with
|
46
|
+
# some of the newer CSS syntax that is used.
|
47
|
+
#
|
48
|
+
# To avoid this being necessary, it is recommended that either
|
49
|
+
# 1) `sassc-rails` is removed from the Gemfile (if not required),
|
50
|
+
# 2) the `sassc-embedded` gem is added to the Gemfile, or
|
51
|
+
# 3) `sassc-rails` is replaced with `dartsass-sprockets`
|
52
|
+
config.assets.configure do |env|
|
53
|
+
if original_compressor = config.assets.css_compressor
|
54
|
+
require "trestle/sprockets_compressor"
|
55
|
+
original_compressor = Sprockets.compressors['text/css'][original_compressor] if original_compressor.is_a?(Symbol)
|
56
|
+
config.assets.css_compressor = Trestle::SprocketsCompressor.new(original_compressor)
|
57
|
+
end
|
58
|
+
end if defined?(SassC::Rails)
|
59
|
+
|
52
60
|
def reset_helpers!
|
53
61
|
@helpers = nil
|
54
62
|
end
|
@@ -2,10 +2,6 @@ module Trestle
|
|
2
2
|
class Form
|
3
3
|
module Fields
|
4
4
|
module CheckBoxHelpers
|
5
|
-
def custom?
|
6
|
-
options[:custom] != false
|
7
|
-
end
|
8
|
-
|
9
5
|
def switch?
|
10
6
|
options[:switch]
|
11
7
|
end
|
@@ -15,26 +11,19 @@ module Trestle
|
|
15
11
|
end
|
16
12
|
|
17
13
|
def default_wrapper_class
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
].compact
|
24
|
-
else
|
25
|
-
[
|
26
|
-
"form-check",
|
27
|
-
("form-check-inline" if inline?)
|
28
|
-
].compact
|
29
|
-
end
|
14
|
+
[
|
15
|
+
"form-check",
|
16
|
+
("form-switch" if switch?),
|
17
|
+
("form-check-inline" if inline?)
|
18
|
+
].compact
|
30
19
|
end
|
31
20
|
|
32
21
|
def input_class
|
33
|
-
|
22
|
+
["form-check-input"]
|
34
23
|
end
|
35
24
|
|
36
25
|
def label_class
|
37
|
-
|
26
|
+
["form-check-label"]
|
38
27
|
end
|
39
28
|
|
40
29
|
def defaults
|
@@ -16,7 +16,7 @@ module Trestle
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def default_html_options
|
19
|
-
Trestle::Options.new(class: ["form-
|
19
|
+
Trestle::Options.new(class: ["form-select"], disabled: disabled? || readonly?, data: { controller: "select" })
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -2,6 +2,10 @@ class Trestle::Form::Fields::ColorField < Trestle::Form::Fields::FormControl
|
|
2
2
|
def field
|
3
3
|
builder.raw_color_field(name, options)
|
4
4
|
end
|
5
|
+
|
6
|
+
def defaults
|
7
|
+
super.merge(class: ["form-control-color"])
|
8
|
+
end
|
5
9
|
end
|
6
10
|
|
7
11
|
Trestle::Form::Builder.register(:color_field, Trestle::Form::Fields::ColorField)
|
@@ -4,6 +4,10 @@ class Trestle::Form::Fields::DateField < Trestle::Form::Fields::FormControl
|
|
4
4
|
def field
|
5
5
|
builder.raw_date_field(name, options)
|
6
6
|
end
|
7
|
+
|
8
|
+
def controller
|
9
|
+
"datepicker"
|
10
|
+
end
|
7
11
|
end
|
8
12
|
|
9
13
|
Trestle::Form::Builder.register(:date_field, Trestle::Form::Fields::DateField)
|
@@ -4,13 +4,15 @@ module Trestle::Form::Fields::DatePicker
|
|
4
4
|
options[:prepend] ||= options.delete(:icon) { default_icon }
|
5
5
|
end
|
6
6
|
|
7
|
-
if enable_date_picker?
|
8
|
-
options.reverse_merge!(data: { picker: true, allow_clear: true })
|
9
|
-
end
|
10
|
-
|
11
7
|
super
|
12
8
|
end
|
13
9
|
|
10
|
+
def defaults
|
11
|
+
defaults = super
|
12
|
+
defaults.merge!(data: { controller: controller, allow_clear: true }) if enable_date_picker?
|
13
|
+
defaults
|
14
|
+
end
|
15
|
+
|
14
16
|
def default_icon
|
15
17
|
icon("fa fa-calendar")
|
16
18
|
end
|
@@ -18,4 +20,8 @@ module Trestle::Form::Fields::DatePicker
|
|
18
20
|
def enable_date_picker?
|
19
21
|
!disabled? && !readonly? && options[:picker] != false
|
20
22
|
end
|
23
|
+
|
24
|
+
def controller
|
25
|
+
"datepicker"
|
26
|
+
end
|
21
27
|
end
|
@@ -17,7 +17,7 @@ module Trestle
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def default_html_options
|
20
|
-
Trestle::Options.new(class: ["form-
|
20
|
+
Trestle::Options.new(class: ["form-select"], disabled: readonly?, data: { controller: "select" })
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -4,6 +4,10 @@ class Trestle::Form::Fields::DatetimeField < Trestle::Form::Fields::FormControl
|
|
4
4
|
def field
|
5
5
|
builder.raw_datetime_field(name, options)
|
6
6
|
end
|
7
|
+
|
8
|
+
def controller
|
9
|
+
"datetimepicker"
|
10
|
+
end
|
7
11
|
end
|
8
12
|
|
9
13
|
Trestle::Form::Builder.register(:datetime_field, Trestle::Form::Fields::DatetimeField)
|
@@ -17,7 +17,7 @@ module Trestle
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def default_html_options
|
20
|
-
Trestle::Options.new(class: ["form-
|
20
|
+
Trestle::Options.new(class: ["form-select"], disabled: readonly?, data: { controller: "select" })
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -1,31 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
class FileField < Field
|
5
|
-
def field
|
6
|
-
if custom?
|
7
|
-
content_tag(:div, class: "custom-file") do
|
8
|
-
concat builder.raw_file_field(name, options.merge(class: "custom-file-input"))
|
9
|
-
concat builder.label(name, choose_file_text, class: "custom-file-label", data: { browse: browse_text })
|
10
|
-
end
|
11
|
-
else
|
12
|
-
builder.raw_file_field(name, options)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def custom?
|
17
|
-
options[:custom] != false
|
18
|
-
end
|
19
|
-
|
20
|
-
def choose_file_text
|
21
|
-
I18n.t("trestle.file.choose_file", default: "Choose file...")
|
22
|
-
end
|
23
|
-
|
24
|
-
def browse_text
|
25
|
-
I18n.t("trestle.file.browse", default: "Browse")
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
1
|
+
class Trestle::Form::Fields::FileField < Trestle::Form::Fields::FormControl
|
2
|
+
def field
|
3
|
+
builder.raw_file_field(name, options)
|
29
4
|
end
|
30
5
|
end
|
31
6
|
|
@@ -13,9 +13,9 @@ module Trestle
|
|
13
13
|
def input_group
|
14
14
|
if @prepend || @append
|
15
15
|
content_tag(:div, class: "input-group") do
|
16
|
-
concat
|
16
|
+
concat input_group_addon(@prepend) if @prepend
|
17
17
|
concat yield
|
18
|
-
concat
|
18
|
+
concat input_group_addon(@append) if @append
|
19
19
|
end
|
20
20
|
else
|
21
21
|
yield
|
@@ -42,7 +42,7 @@ module Trestle
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def label
|
45
|
-
builder.label(name, options[:label], class: ["
|
45
|
+
builder.label(name, options[:label], class: ["form-label", ("visually-hidden" if options[:hide_label])].compact)
|
46
46
|
end
|
47
47
|
|
48
48
|
def defaults
|
@@ -16,7 +16,7 @@ module Trestle
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def default_html_options
|
19
|
-
Trestle::Options.new(class: ["form-
|
19
|
+
Trestle::Options.new(class: ["form-select"], disabled: disabled? || readonly?, data: { controller: "select" })
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -2,35 +2,23 @@ module Trestle
|
|
2
2
|
class Form
|
3
3
|
module Fields
|
4
4
|
module RadioButtonHelpers
|
5
|
-
def custom?
|
6
|
-
options[:custom] != false
|
7
|
-
end
|
8
|
-
|
9
5
|
def inline?
|
10
6
|
options[:inline]
|
11
7
|
end
|
12
8
|
|
13
9
|
def default_wrapper_class
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
"custom-radio",
|
18
|
-
("custom-control-inline" if inline?)
|
19
|
-
].compact
|
20
|
-
else
|
21
|
-
[
|
22
|
-
"form-check",
|
23
|
-
("form-check-inline" if inline?)
|
10
|
+
[
|
11
|
+
"form-check",
|
12
|
+
("form-check-inline" if inline?)
|
24
13
|
].compact
|
25
|
-
end
|
26
14
|
end
|
27
15
|
|
28
16
|
def input_class
|
29
|
-
|
17
|
+
["form-check-input"]
|
30
18
|
end
|
31
19
|
|
32
20
|
def label_class
|
33
|
-
|
21
|
+
["form-check-label"]
|
34
22
|
end
|
35
23
|
end
|
36
24
|
end
|
@@ -18,13 +18,29 @@ module Trestle
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def default_html_options
|
21
|
-
Trestle::Options.new(class: ["form-
|
21
|
+
Trestle::Options.new(class: ["form-select"], disabled: disabled? || readonly?, data: { controller: "select", placeholder: placeholder, allow_clear: clearable? })
|
22
22
|
end
|
23
23
|
|
24
24
|
def default_choices
|
25
25
|
builder.object.send(name) if builder.object
|
26
26
|
end
|
27
27
|
|
28
|
+
def placeholder
|
29
|
+
prompt = options[:prompt] || options[:include_blank]
|
30
|
+
|
31
|
+
if prompt.kind_of?(String)
|
32
|
+
prompt
|
33
|
+
elsif options[:prompt]
|
34
|
+
I18n.translate("helpers.select.prompt", default: "Please select")
|
35
|
+
elsif options[:include_blank]
|
36
|
+
""
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def clearable?
|
41
|
+
options[:allow_clear] || options[:prompt].present? || options[:include_blank].present?
|
42
|
+
end
|
43
|
+
|
28
44
|
# Allows an array of model instances (or a scope) to be
|
29
45
|
# passed to the select field as the list of choices.
|
30
46
|
class Choices
|
@@ -8,6 +8,10 @@ class Trestle::Form::Fields::TimeField < Trestle::Form::Fields::FormControl
|
|
8
8
|
def default_icon
|
9
9
|
icon("fa fa-clock-o")
|
10
10
|
end
|
11
|
+
|
12
|
+
def controller
|
13
|
+
"timepicker"
|
14
|
+
end
|
11
15
|
end
|
12
16
|
|
13
17
|
Trestle::Form::Builder.register(:time_field, Trestle::Form::Fields::TimeField)
|
@@ -17,7 +17,7 @@ module Trestle
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def default_html_options
|
20
|
-
Trestle::Options.new(class: ["form-
|
20
|
+
Trestle::Options.new(class: ["form-select"], disabled: readonly?, data: { controller: "select" })
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -16,7 +16,7 @@ module Trestle
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def default_html_options
|
19
|
-
Trestle::Options.new(class: ["form-
|
19
|
+
Trestle::Options.new(class: ["form-select"], disabled: disabled? || readonly?, data: { controller: "select" })
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -14,7 +14,7 @@ module Trestle
|
|
14
14
|
include Hook::Helpers
|
15
15
|
|
16
16
|
# Whitelisted helpers will concatenate their result to the output buffer when called.
|
17
|
-
WHITELISTED_HELPERS = [:row, :col, :render, :tab, :table, :divider, :h1, :h2, :h3, :h4, :h5, :h6, :card, :panel, :well]
|
17
|
+
WHITELISTED_HELPERS = [:row, :col, :render, :tab, :table, :divider, :h1, :h2, :h3, :h4, :h5, :h6, :card, :panel, :well, :turbo_frame_tag]
|
18
18
|
|
19
19
|
# Raw block helpers will pass their block argument directly to the method without wrapping it in a new output buffer.
|
20
20
|
RAW_BLOCK_HELPERS = [:table, :toolbar]
|
@@ -23,6 +23,9 @@ module Trestle
|
|
23
23
|
# that they can be delegated to the form builder or template by method_missing.
|
24
24
|
undef_method :select, :display
|
25
25
|
|
26
|
+
# These methods defined in ActionView::Helpers::CaptureHelper should be called directly on the existing template object.
|
27
|
+
delegate :content_for, :content_for?, :provide, to: :@template
|
28
|
+
|
26
29
|
delegate :concat, to: :output_buffer
|
27
30
|
|
28
31
|
def initialize(template, form=nil)
|
data/lib/trestle/form.rb
CHANGED
@@ -10,10 +10,25 @@ module Trestle
|
|
10
10
|
|
11
11
|
def initialize(options={}, &block)
|
12
12
|
@options, @block = options, block
|
13
|
+
|
14
|
+
if @options[:modal] == true
|
15
|
+
@options[:modal] = {}
|
16
|
+
end
|
17
|
+
|
18
|
+
if options[:dialog]
|
19
|
+
Trestle.deprecator.warn("`form dialog: true` is deprecated. Please use `form modal: true` instead.", caller_locations(3))
|
20
|
+
@options.delete(:dialog)
|
21
|
+
@options[:modal] = {}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def modal?
|
26
|
+
options[:modal]
|
13
27
|
end
|
14
28
|
|
15
29
|
def dialog?
|
16
|
-
|
30
|
+
Trestle.deprecator.warn("`Trestle::Form#dialog?` is deprecated. Please use `modal?` instead.")
|
31
|
+
options[:modal]
|
17
32
|
end
|
18
33
|
|
19
34
|
def render(template, instance)
|
@@ -5,20 +5,30 @@ module Trestle
|
|
5
5
|
delegate :admin, :instance, to: :@template
|
6
6
|
delegate :translate, :t, to: :admin
|
7
7
|
|
8
|
-
def new
|
9
|
-
|
8
|
+
def new(label: t("buttons.new", default: "New %{model_name}"), **attrs)
|
9
|
+
return unless action?(:new)
|
10
|
+
|
11
|
+
defaults = { action: :new, style: :light, icon: "fa fa-plus", class: "btn-new-resource" }
|
12
|
+
link(label, defaults.merge(attrs))
|
10
13
|
end
|
11
14
|
|
12
|
-
def save
|
13
|
-
|
15
|
+
def save(label: t("buttons.save", default: "Save %{model_name}"), **attrs)
|
16
|
+
defaults = { style: :success }
|
17
|
+
button(label, defaults.merge(attrs))
|
14
18
|
end
|
15
19
|
|
16
|
-
def delete
|
17
|
-
|
20
|
+
def delete(label: t("buttons.delete", default: "Delete %{model_name}"), **attrs)
|
21
|
+
return unless action?(:destroy)
|
22
|
+
|
23
|
+
defaults = Trestle::Options.new(action: :destroy, style: :danger, icon: "fa fa-trash", data: { turbo_method: "delete", turbo_frame: "_top", controller: "confirm-delete", confirm_delete_placement_value: "bottom" })
|
24
|
+
link(label, instance, defaults.merge(attrs))
|
18
25
|
end
|
19
26
|
|
20
|
-
def dismiss
|
21
|
-
|
27
|
+
def dismiss(label: t("buttons.ok", default: "OK"), **attrs)
|
28
|
+
return unless @template.modal_request?
|
29
|
+
|
30
|
+
defaults = Trestle::Options.new(type: :button, style: :light, data: { bs_dismiss: "modal" })
|
31
|
+
button(label, defaults.merge(attrs))
|
22
32
|
end
|
23
33
|
alias ok dismiss
|
24
34
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Trestle
|
2
|
+
class SprocketsCompressor
|
3
|
+
def initialize(original_compressor, excluded_files: ["trestle/admin"])
|
4
|
+
@original_compressor = original_compressor
|
5
|
+
@excluded_files = excluded_files
|
6
|
+
end
|
7
|
+
|
8
|
+
def call(input)
|
9
|
+
if @excluded_files.include?(input[:name])
|
10
|
+
input[:data]
|
11
|
+
else
|
12
|
+
@original_compressor.call(input)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -42,7 +42,7 @@ module Trestle
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def delete
|
45
|
-
link(t("buttons.delete", default: "Delete"), instance, admin: admin, action: :destroy,
|
45
|
+
link(t("buttons.delete", default: "Delete"), instance, admin: admin, action: :destroy, icon: "fa fa-trash", style: :danger, data: { turbo_method: "delete", controller: "confirm-delete", confirm_delete_placement_value: "left" })
|
46
46
|
end
|
47
47
|
|
48
48
|
builder_method :show, :edit, :delete
|
@@ -67,7 +67,7 @@ module Trestle
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def classes
|
70
|
-
super + ["actions"]
|
70
|
+
super + ["table-actions"]
|
71
71
|
end
|
72
72
|
|
73
73
|
def content(instance)
|
data/lib/trestle/table/row.rb
CHANGED
@@ -33,8 +33,9 @@ module Trestle
|
|
33
33
|
options = Trestle::Options.new
|
34
34
|
|
35
35
|
if @table.admin && @table.autolink? && @table.admin.actions.include?(:show)
|
36
|
+
options.merge!(data: { controller: "follow-url", action: "click->follow-url#follow" })
|
36
37
|
options.merge!(data: { url: admin_url_for(instance) })
|
37
|
-
options.merge!(data: {
|
38
|
+
options.merge!(data: { modal: true }) if @table.admin.form.modal?
|
38
39
|
end
|
39
40
|
|
40
41
|
options.merge!(@row.options)
|
@@ -13,11 +13,11 @@ module Trestle
|
|
13
13
|
|
14
14
|
class Renderer < Column::Renderer
|
15
15
|
def header
|
16
|
-
checkbox "", nil, id: checkbox_id("all")
|
16
|
+
checkbox "", nil, id: checkbox_id("all"), data: { checkbox_select_target: "selectAll", action: "change->checkbox-select#toggleAll" }
|
17
17
|
end
|
18
18
|
|
19
19
|
def content(instance)
|
20
|
-
checkbox "selected[]", instance.to_param, id: checkbox_id(instance.to_param)
|
20
|
+
checkbox "selected[]", instance.to_param, id: checkbox_id(instance.to_param), data: { checkbox_select_target: "checkbox", action: "change->checkbox-select#toggle" }
|
21
21
|
end
|
22
22
|
|
23
23
|
def classes
|
@@ -34,10 +34,7 @@ module Trestle
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def checkbox(name, value="1", options={})
|
37
|
-
@template.
|
38
|
-
@template.check_box_tag(name, value, false, options.merge(class: "custom-control-input")) +
|
39
|
-
@template.tag(:label, for: options.fetch(:id), class: "custom-control-label")
|
40
|
-
end
|
37
|
+
@template.check_box_tag(name, value, false, options.merge(class: "form-check-input"))
|
41
38
|
end
|
42
39
|
end
|
43
40
|
end
|
data/lib/trestle/table.rb
CHANGED
@@ -21,11 +21,10 @@ module Trestle
|
|
21
21
|
end
|
22
22
|
|
23
23
|
private
|
24
|
-
def
|
25
|
-
|
26
|
-
end
|
24
|
+
def self.ruby2_keywords(*)
|
25
|
+
end unless respond_to?(:ruby2_keywords, true)
|
27
26
|
|
28
|
-
def method_missing(name, *args, &block)
|
27
|
+
ruby2_keywords def method_missing(name, *args, &block)
|
29
28
|
result = builder.send(name, *args, &block)
|
30
29
|
|
31
30
|
if builder.builder_methods.include?(name)
|
@@ -34,6 +33,10 @@ module Trestle
|
|
34
33
|
result
|
35
34
|
end
|
36
35
|
end
|
36
|
+
|
37
|
+
def respond_to_missing?(name, include_all=false)
|
38
|
+
builder.respond_to?(name) || super
|
39
|
+
end
|
37
40
|
end
|
38
41
|
end
|
39
42
|
end
|