trestle 0.9.8 → 0.10.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +34 -4
- data/.gitignore +7 -0
- data/Gemfile +5 -1
- data/README.md +2 -1
- 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-7aa1aec9c3c1fd65c382.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 +23 -0
- data/app/controllers/concerns/trestle/controller/toolbars.rb +1 -1
- data/app/controllers/concerns/trestle/controller/turbo.rb +21 -0
- data/app/controllers/concerns/trestle/resource/controller/actions.rb +40 -29
- data/app/controllers/concerns/trestle/resource/controller/redirection.rb +7 -5
- data/app/controllers/trestle/admin_controller.rb +4 -0
- data/app/controllers/trestle/application_controller.rb +2 -1
- data/app/helpers/trestle/card_helper.rb +2 -2
- 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 +34 -0
- data/app/helpers/trestle/navigation_helper.rb +3 -1
- data/app/helpers/trestle/tab_helper.rb +1 -1
- data/app/helpers/trestle/toolbars_helper.rb +1 -1
- data/app/helpers/trestle/turbo_frame_helper.rb +34 -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 +11 -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 +1 -1
- 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/_scopes.html.erb +1 -1
- data/app/views/trestle/resource/create.turbo_stream.erb +5 -0
- data/app/views/trestle/resource/destroy.turbo_stream.erb +1 -0
- data/app/views/trestle/resource/edit.html.erb +4 -2
- data/app/views/trestle/resource/index.html.erb +12 -10
- data/app/views/trestle/resource/new.html.erb +4 -2
- data/app/views/trestle/resource/show.html.erb +4 -2
- data/app/views/trestle/resource/update.turbo_stream.erb +5 -0
- data/app/views/trestle/shared/_sidebar.html.erb +9 -9
- data/config/locales/vi.yml +1 -1
- data/frontend/css/components/_alerts.scss +19 -17
- data/frontend/css/components/_background.scss +7 -35
- data/frontend/css/components/_badges.scss +31 -0
- data/frontend/css/components/_breadcrumbs.scss +4 -4
- data/frontend/css/components/_buttons.scss +5 -4
- data/frontend/css/components/_datepicker.scss +12 -8
- data/frontend/css/components/_dropdown.scss +23 -3
- data/frontend/css/components/{_fields.scss → _forms.scss} +16 -3
- data/frontend/css/components/_media-grid.scss +52 -44
- data/frontend/css/components/_modal.scss +33 -4
- data/frontend/css/components/_pagination.scss +1 -1
- data/frontend/css/components/_photoswipe.scss +8 -0
- data/frontend/css/components/_popover.scss +1 -0
- data/frontend/css/components/_scopes.scss +1 -1
- data/frontend/css/components/_select.scss +161 -31
- data/frontend/css/components/_table.scss +60 -65
- data/frontend/css/components/_tabs.scss +10 -3
- data/frontend/css/components/_tags.scss +71 -16
- data/frontend/css/components/_toolbars.scss +18 -31
- 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 +39 -0
- data/frontend/css/core/_mixins.scss +3 -40
- data/frontend/css/core/_theme.scss +258 -0
- data/frontend/css/core/_typography.scss +10 -1
- data/frontend/css/icons/_fontawesome.scss +3 -15
- data/frontend/css/index.scss +12 -6
- data/frontend/css/layout/_base.scss +3 -3
- data/frontend/css/layout/_content.scss +11 -7
- data/frontend/css/layout/_footer.scss +1 -1
- data/frontend/css/layout/_header.scss +5 -3
- data/frontend/css/layout/_navigation.scss +2 -2
- data/frontend/css/layout/_sidebar.scss +19 -9
- data/frontend/css/support/_sprockets.scss +2 -0
- data/frontend/css/support/_webpack.scss +2 -0
- data/frontend/css/variables/_bootstrap.scss +134 -40
- data/frontend/css/variables/_maps.scss +15 -0
- data/frontend/css/variables/_trestle.scss +55 -26
- data/frontend/js/controllers/application_controller.js +17 -0
- data/frontend/js/controllers/checkbox_select_controller.js +43 -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 +10 -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 +160 -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/adapters/active_record_adapter.rb +1 -1
- data/lib/trestle/admin/builder.rb +7 -0
- data/lib/trestle/admin.rb +12 -6
- data/lib/trestle/color.rb +113 -0
- data/lib/trestle/configurable.rb +2 -2
- data/lib/trestle/configuration.rb +16 -8
- data/lib/trestle/engine.rb +23 -17
- data/lib/trestle/form/automatic.rb +3 -1
- 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 +3 -0
- data/lib/trestle/form.rb +16 -1
- data/lib/trestle/hook/helpers.rb +1 -1
- data/lib/trestle/reloader.rb +2 -11
- data/lib/trestle/resource/builder.rb +1 -8
- data/lib/trestle/resource/toolbar.rb +2 -2
- data/lib/trestle/resource.rb +2 -2
- data/lib/trestle/scopes/block.rb +7 -7
- data/lib/trestle/scopes/definition.rb +2 -2
- data/lib/trestle/scopes/scope.rb +4 -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/item.rb +1 -1
- data/lib/trestle/toolbar/menu.rb +3 -6
- data/lib/trestle/version.rb +1 -1
- data/lib/trestle.rb +3 -20
- data/package.json +31 -27
- data/trestle.gemspec +9 -10
- data/webpack.config.js +18 -11
- data/yarn.lock +1934 -2819
- metadata +181 -179
- data/app/assets/bundle/trestle/bundle.css +0 -12
- data/app/assets/bundle/trestle/bundle.js +0 -103
- 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/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
@@ -0,0 +1,115 @@
|
|
1
|
+
import PopoverController from './popover_controller'
|
2
|
+
|
3
|
+
import { i18n } from '../core/i18n'
|
4
|
+
|
5
|
+
export default class extends PopoverController {
|
6
|
+
static values = {
|
7
|
+
confirmLabel: String,
|
8
|
+
cancelLabel: String
|
9
|
+
}
|
10
|
+
|
11
|
+
static classes = [ 'confirm', 'cancel' ]
|
12
|
+
|
13
|
+
static defaultConfirmClass = 'btn-primary'
|
14
|
+
static defaultCancelClass = 'btn-light'
|
15
|
+
|
16
|
+
initialize () {
|
17
|
+
super.initialize()
|
18
|
+
|
19
|
+
this.boundOnClick = this.onClick.bind(this)
|
20
|
+
|
21
|
+
this.confirmed = false
|
22
|
+
}
|
23
|
+
|
24
|
+
connect () {
|
25
|
+
super.connect()
|
26
|
+
|
27
|
+
this.element.addEventListener('click', this.boundOnClick, { capture: true })
|
28
|
+
}
|
29
|
+
|
30
|
+
disconnect () {
|
31
|
+
super.disconnect()
|
32
|
+
|
33
|
+
this.element.removeEventListener('click', this.boundOnClick, { capture: true })
|
34
|
+
}
|
35
|
+
|
36
|
+
onClick (e) {
|
37
|
+
if (!this.confirmed) {
|
38
|
+
e.preventDefault()
|
39
|
+
e.stopImmediatePropagation()
|
40
|
+
|
41
|
+
this.toggle()
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
confirm () {
|
46
|
+
this.popover.dispose()
|
47
|
+
|
48
|
+
this.confirmed = true
|
49
|
+
this.element.click()
|
50
|
+
this.confirmed = false
|
51
|
+
}
|
52
|
+
|
53
|
+
cancel () {
|
54
|
+
this.popover.hide()
|
55
|
+
}
|
56
|
+
|
57
|
+
get popoverOptions () {
|
58
|
+
return {
|
59
|
+
...super.popoverOptions,
|
60
|
+
html: true
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
get content () {
|
65
|
+
const group = document.createElement('div')
|
66
|
+
group.classList.add('btn-group')
|
67
|
+
|
68
|
+
group.appendChild(this.confirmButton)
|
69
|
+
group.appendChild(this.cancelButton)
|
70
|
+
|
71
|
+
return group
|
72
|
+
}
|
73
|
+
|
74
|
+
get confirmButton () {
|
75
|
+
const button = document.createElement('button')
|
76
|
+
|
77
|
+
button.classList.add('btn', 'btn-sm', this.confirmButtonClass)
|
78
|
+
button.textContent = this.confirmLabel
|
79
|
+
|
80
|
+
button.addEventListener('click', this.confirm.bind(this))
|
81
|
+
|
82
|
+
return button
|
83
|
+
}
|
84
|
+
|
85
|
+
get cancelButton () {
|
86
|
+
const button = document.createElement('button')
|
87
|
+
|
88
|
+
button.classList.add('btn', 'btn-sm', this.cancelButtonClass)
|
89
|
+
button.textContent = this.cancelLabel
|
90
|
+
|
91
|
+
button.addEventListener('click', this.cancel.bind(this))
|
92
|
+
|
93
|
+
return button
|
94
|
+
}
|
95
|
+
|
96
|
+
get title () {
|
97
|
+
return this.titleValue || i18n.t('trestle.confirmation.title', { defaultValue: 'Are you sure?' })
|
98
|
+
}
|
99
|
+
|
100
|
+
get confirmLabel () {
|
101
|
+
return this.confirmLabelValue || i18n.t('trestle.confirmation.ok', { defaultValue: 'OK' })
|
102
|
+
}
|
103
|
+
|
104
|
+
get cancelLabel () {
|
105
|
+
return this.cancelLabelValue || i18n.t('trestle.confirmation.cancel', { defaultValue: 'Cancel' })
|
106
|
+
}
|
107
|
+
|
108
|
+
get confirmButtonClass () {
|
109
|
+
return this.hasConfirmClass ? this.confirmClass : this.constructor.defaultConfirmClass
|
110
|
+
}
|
111
|
+
|
112
|
+
get cancelButtonClass () {
|
113
|
+
return this.hasCancelClass ? this.cancelClass : this.constructor.defaultCancelClass
|
114
|
+
}
|
115
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import ConfirmController from './confirm_controller'
|
2
|
+
|
3
|
+
import { i18n } from '../core/i18n'
|
4
|
+
|
5
|
+
export default class extends ConfirmController {
|
6
|
+
static values = {
|
7
|
+
confirmLabel: i18n['trestle.confirmation.delete'] || 'Delete'
|
8
|
+
}
|
9
|
+
|
10
|
+
static defaultConfirmClass = 'btn-danger'
|
11
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import FlatpickrController from './flatpickr_controller'
|
2
|
+
|
3
|
+
import { i18n } from '../core/i18n'
|
4
|
+
|
5
|
+
export default class extends FlatpickrController {
|
6
|
+
get options () {
|
7
|
+
return {
|
8
|
+
...super.options,
|
9
|
+
altFormat: i18n.t('admin.datepicker.formats.date', { defaultValue: 'm/d/Y' })
|
10
|
+
}
|
11
|
+
}
|
12
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import FlatpickrController from './flatpickr_controller'
|
2
|
+
|
3
|
+
import { i18n } from '../core/i18n'
|
4
|
+
|
5
|
+
export default class extends FlatpickrController {
|
6
|
+
get options () {
|
7
|
+
return {
|
8
|
+
...super.options,
|
9
|
+
enableTime: true,
|
10
|
+
altFormat: i18n.t('admin.datepicker.formats.datetime', { defaultValue: 'm/d/Y h:i K' })
|
11
|
+
}
|
12
|
+
}
|
13
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import ApplicationController from './application_controller'
|
2
|
+
|
3
|
+
import flatpickr from 'flatpickr'
|
4
|
+
|
5
|
+
export default class extends ApplicationController {
|
6
|
+
connect () {
|
7
|
+
this.flatpickr = flatpickr(this.element, {
|
8
|
+
...this.options,
|
9
|
+
onReady: this.setup.bind(this)
|
10
|
+
})
|
11
|
+
}
|
12
|
+
|
13
|
+
disconnect () {
|
14
|
+
this.flatpickr.destroy()
|
15
|
+
}
|
16
|
+
|
17
|
+
clear () {
|
18
|
+
const isDisabled = this.element.disabled || this.element.classList.contains('disabled')
|
19
|
+
|
20
|
+
if (!isDisabled) {
|
21
|
+
this.flatpickr.clear()
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
setup (selectedDates, dateStr, instance) {
|
26
|
+
this._createClearButton(instance)
|
27
|
+
}
|
28
|
+
|
29
|
+
get options () {
|
30
|
+
return {
|
31
|
+
allowInput: true,
|
32
|
+
altInput: true
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
_createClearButton (instance) {
|
37
|
+
if (this.element.dataset.allowClear) {
|
38
|
+
const clearButton = document.createElement('button')
|
39
|
+
|
40
|
+
clearButton.classList.add('clear-datepicker')
|
41
|
+
|
42
|
+
clearButton.addEventListener('click', (e) => {
|
43
|
+
e.preventDefault()
|
44
|
+
this.clear()
|
45
|
+
})
|
46
|
+
|
47
|
+
instance.altInput.parentNode.insertBefore(clearButton, instance.altInput)
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import ApplicationController from './application_controller'
|
2
|
+
|
3
|
+
import { visit } from '@hotwired/turbo'
|
4
|
+
import Modal from '../core/modal'
|
5
|
+
|
6
|
+
export default class extends ApplicationController {
|
7
|
+
follow (e) {
|
8
|
+
if (this.ignoreElement(e.target) || !this.url) {
|
9
|
+
return
|
10
|
+
}
|
11
|
+
|
12
|
+
if (this.isModal) {
|
13
|
+
Modal.load(this.url)
|
14
|
+
} else if (e.metaKey || e.ctrlKey) {
|
15
|
+
window.open(this.url, '_blank')
|
16
|
+
} else {
|
17
|
+
visit(this.url)
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
get url () {
|
22
|
+
if (this.element.dataset.url === 'auto') {
|
23
|
+
return this.element.querySelector('td:not(.table-actions) a').href
|
24
|
+
} else {
|
25
|
+
return this.element.dataset.url
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
get isModal () {
|
30
|
+
return this.element.dataset.modal
|
31
|
+
}
|
32
|
+
|
33
|
+
ignoreElement (node) {
|
34
|
+
return node.matches('a, input, button, .select-row')
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import ApplicationController from './application_controller'
|
2
|
+
|
3
|
+
import ErrorModal from '../core/error_modal'
|
4
|
+
|
5
|
+
export default class extends ApplicationController {
|
6
|
+
connect () {
|
7
|
+
this.element.addEventListener('turbo:before-fetch-response', this.handleFormResponse)
|
8
|
+
}
|
9
|
+
|
10
|
+
disconnect () {
|
11
|
+
this.element.removeEventListener('turbo:before-fetch-response', this.handleFormResponse)
|
12
|
+
}
|
13
|
+
|
14
|
+
handleFormResponse (e) {
|
15
|
+
const response = e.detail.fetchResponse.response
|
16
|
+
|
17
|
+
if (response.status >= 500) {
|
18
|
+
e.preventDefault()
|
19
|
+
|
20
|
+
const title = `${response.status} (${response.statusText})`
|
21
|
+
response.text().then(content => ErrorModal.show({ title, content }))
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import ApplicationController from './application_controller'
|
2
|
+
|
3
|
+
const SUBMIT_BUTTON_SELECTOR = 'input[type="submit"], button[type="submit"]'
|
4
|
+
|
5
|
+
export default class extends ApplicationController {
|
6
|
+
initialize () {
|
7
|
+
this.boundSubmit = this.submit.bind(this)
|
8
|
+
this.boundReset = this.reset.bind(this)
|
9
|
+
}
|
10
|
+
|
11
|
+
connect () {
|
12
|
+
this.element.addEventListener('submit', this.boundSubmit)
|
13
|
+
this.element.addEventListener('turbo:before-fetch-response', this.boundReset)
|
14
|
+
}
|
15
|
+
|
16
|
+
disconnect () {
|
17
|
+
this.element.removeEventListener('submit', this.boundSubmit)
|
18
|
+
this.element.removeEventListener('turbo:before-fetch-response', this.boundReset)
|
19
|
+
}
|
20
|
+
|
21
|
+
submit (e) {
|
22
|
+
this.disableButtons()
|
23
|
+
this.setLoading(e.submitter || this.element.querySelector(SUBMIT_BUTTON_SELECTOR))
|
24
|
+
}
|
25
|
+
|
26
|
+
reset (e) {
|
27
|
+
this.restoreButtons()
|
28
|
+
}
|
29
|
+
|
30
|
+
setLoading (button) {
|
31
|
+
button.classList.add('loading')
|
32
|
+
}
|
33
|
+
|
34
|
+
disableButtons (e) {
|
35
|
+
this.submitButtons.forEach(button => {
|
36
|
+
button.disabled = true
|
37
|
+
})
|
38
|
+
}
|
39
|
+
|
40
|
+
restoreButtons () {
|
41
|
+
this.submitButtons.forEach(button => {
|
42
|
+
button.classList.remove('loading')
|
43
|
+
button.disabled = false
|
44
|
+
})
|
45
|
+
}
|
46
|
+
|
47
|
+
get submitButtons () {
|
48
|
+
return this.element.querySelectorAll(SUBMIT_BUTTON_SELECTOR)
|
49
|
+
}
|
50
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { Application } from '@hotwired/stimulus'
|
2
|
+
import { definitionsFromContext } from '@hotwired/stimulus-webpack-helpers'
|
3
|
+
|
4
|
+
import ApplicationController from './application_controller'
|
5
|
+
|
6
|
+
window.Stimulus = Application.start()
|
7
|
+
|
8
|
+
const context = require.context('.', true, /\.js$/)
|
9
|
+
const controllerDefinitions = definitionsFromContext(context)
|
10
|
+
Stimulus.load(controllerDefinitions)
|
11
|
+
|
12
|
+
const Controllers = controllerDefinitions.reduce((result, definition) => {
|
13
|
+
return { ...result, [definition.identifier]: definition.controllerConstructor }
|
14
|
+
}, {})
|
15
|
+
|
16
|
+
export {
|
17
|
+
ApplicationController,
|
18
|
+
Controllers
|
19
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import ApplicationController from './application_controller'
|
2
|
+
|
3
|
+
export default class extends ApplicationController {
|
4
|
+
initialize () {
|
5
|
+
this.boundHandleKeyDown = this.handleKeyDown.bind(this)
|
6
|
+
}
|
7
|
+
|
8
|
+
connect () {
|
9
|
+
this.element.addEventListener('keydown', this.boundHandleKeyDown)
|
10
|
+
}
|
11
|
+
|
12
|
+
disconnect () {
|
13
|
+
this.element.removeEventListener('keydown', this.boundHandleKeyDown)
|
14
|
+
}
|
15
|
+
|
16
|
+
handleKeyDown (e) {
|
17
|
+
if (e.key === 'Enter' && this.preventEnterKey(e.target)) {
|
18
|
+
e.preventDefault()
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
preventEnterKey (el) {
|
23
|
+
return el.matches('input:not([type="submit"])')
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,160 @@
|
|
1
|
+
import ApplicationController from './application_controller'
|
2
|
+
import usePhotoSwipe from '../mixins/photoswipe'
|
3
|
+
|
4
|
+
import PhotoSwipeLightbox from 'photoswipe/lightbox'
|
5
|
+
import getVideoId from 'get-video-id'
|
6
|
+
|
7
|
+
const waitForImageDimensions = (element) => {
|
8
|
+
return new Promise((resolve, reject) => {
|
9
|
+
const timeout = setInterval(() => {
|
10
|
+
if (element.naturalWidth && element.naturalHeight) {
|
11
|
+
clearInterval(timeout)
|
12
|
+
resolve(element)
|
13
|
+
}
|
14
|
+
}, 0)
|
15
|
+
|
16
|
+
element.addEventListener('error', () => {
|
17
|
+
clearInterval(timeout)
|
18
|
+
reject(element)
|
19
|
+
})
|
20
|
+
})
|
21
|
+
}
|
22
|
+
|
23
|
+
const VideoIframeUrl = {
|
24
|
+
youtube: (id) => `https://www.youtube.com/embed/${id}`,
|
25
|
+
vimeo: (id) => `https://player.vimeo.com/video/${id}`
|
26
|
+
}
|
27
|
+
|
28
|
+
export default class extends ApplicationController {
|
29
|
+
static targets = ["image"]
|
30
|
+
|
31
|
+
static values = {
|
32
|
+
animationType: { type: String, default: 'zoom' },
|
33
|
+
animationDuration: { type: Number, default: 150 },
|
34
|
+
padding: { type: Object, default: { top: 20, bottom: 20, left: 20, right: 20 } },
|
35
|
+
|
36
|
+
defaultVideoWidth: { type: Number, default: 800 },
|
37
|
+
defaultVideoHeight: { type: Number, default: 450 }
|
38
|
+
}
|
39
|
+
|
40
|
+
initialize () {
|
41
|
+
usePhotoSwipe(this)
|
42
|
+
}
|
43
|
+
|
44
|
+
connect () {
|
45
|
+
this.lightbox = new PhotoSwipeLightbox(this.options)
|
46
|
+
this.addFilters()
|
47
|
+
this.lightbox.init()
|
48
|
+
}
|
49
|
+
|
50
|
+
disconnect () {
|
51
|
+
this.lightbox.destroy()
|
52
|
+
}
|
53
|
+
|
54
|
+
addFilters () {
|
55
|
+
this.lightbox.on('contentLoadImage', this.contentLoadImageHandler.bind(this))
|
56
|
+
this.lightbox.on('contentActivate', this.contentActivateHandler.bind(this))
|
57
|
+
this.lightbox.on('contentDeactivate', this.contentDeactivateHandler.bind(this))
|
58
|
+
|
59
|
+
this.lightbox.addFilter('domItemData', this.domItemDimensionsFilter.bind(this))
|
60
|
+
this.lightbox.addFilter('domItemData', this.domItemVideoFilter.bind(this))
|
61
|
+
this.lightbox.addFilter('domItemData', this.domItemEmbedFilter.bind(this))
|
62
|
+
this.lightbox.addFilter('useContentPlaceholder', this.useContentPlaceholderFilter.bind(this))
|
63
|
+
}
|
64
|
+
|
65
|
+
// If the image width and height is not set, try to set it as soon
|
66
|
+
// as the image element has a naturalWidth/naturalHeight
|
67
|
+
contentLoadImageHandler ({ content }) {
|
68
|
+
if (content.width == 0 || content.height == 0) {
|
69
|
+
const imgEl = content.element
|
70
|
+
const linkEl = content.data.element
|
71
|
+
|
72
|
+
waitForImageDimensions(imgEl).then((imgEl) => {
|
73
|
+
linkEl.dataset.width = imgEl.naturalWidth
|
74
|
+
linkEl.dataset.height = imgEl.naturalHeight
|
75
|
+
|
76
|
+
content.instance.refreshSlideContent(content.index)
|
77
|
+
}).catch(() => {})
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
// Append HTML slide content when slide is reactivated
|
82
|
+
contentActivateHandler({ content }) {
|
83
|
+
if (content.type == 'html') {
|
84
|
+
content.append()
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
// Remove HTML slide content when slide is deactivated
|
89
|
+
contentDeactivateHandler ({ content }) {
|
90
|
+
if (content.type == 'html') {
|
91
|
+
content.remove()
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
// Sets the width and height from data-width and data-height attributes on the link element
|
96
|
+
domItemDimensionsFilter (itemData, element, linkEl) {
|
97
|
+
if (linkEl) {
|
98
|
+
const width = linkEl.dataset.width
|
99
|
+
const height = linkEl.dataset.height
|
100
|
+
|
101
|
+
if (width) itemData.w = Number(width)
|
102
|
+
if (height) itemData.h = Number(height)
|
103
|
+
}
|
104
|
+
|
105
|
+
return itemData
|
106
|
+
}
|
107
|
+
|
108
|
+
// Use <video> tag to play media when data-type="video"
|
109
|
+
domItemVideoFilter (itemData, element, linkEl) {
|
110
|
+
if (linkEl && linkEl.dataset.type == 'video') {
|
111
|
+
itemData.type = 'html'
|
112
|
+
itemData.html = `<video controls><source src="${itemData.src}"></video>`
|
113
|
+
|
114
|
+
this.setDefaultVideoDimensions(itemData)
|
115
|
+
}
|
116
|
+
|
117
|
+
return itemData
|
118
|
+
}
|
119
|
+
|
120
|
+
// Automatically detect video links and convert to an iframe
|
121
|
+
domItemEmbedFilter (itemData, element, linkEl) {
|
122
|
+
if (linkEl && !itemData.type) {
|
123
|
+
const video = getVideoId(itemData.src)
|
124
|
+
|
125
|
+
if (video.service && VideoIframeUrl[video.service]) {
|
126
|
+
const src = VideoIframeUrl[video.service](video.id)
|
127
|
+
|
128
|
+
itemData.type = 'html'
|
129
|
+
itemData.html = `<iframe src="${src}" allowfullscreen></iframe>`
|
130
|
+
|
131
|
+
this.setDefaultVideoDimensions(itemData)
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
return itemData
|
136
|
+
}
|
137
|
+
|
138
|
+
// Use the thumbnail as the content placeholder only when an explicit width/height is set
|
139
|
+
useContentPlaceholderFilter (useContentPlaceholder, content) {
|
140
|
+
return content.width && content.height && content.type !== 'html'
|
141
|
+
}
|
142
|
+
|
143
|
+
get options () {
|
144
|
+
return {
|
145
|
+
gallery: this.element,
|
146
|
+
pswpModule: this.loadPhotoSwipe,
|
147
|
+
|
148
|
+
padding: this.paddingValue,
|
149
|
+
|
150
|
+
showHideAnimationType: this.animationTypeValue,
|
151
|
+
showAnimationDuration: this.animationDurationValue,
|
152
|
+
hideAnimationDuration: this.animationDurationValue
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
setDefaultVideoDimensions(itemData) {
|
157
|
+
itemData.w ||= this.defaultVideoWidthValue
|
158
|
+
itemData.h ||= this.defaultVideoHeightValue
|
159
|
+
}
|
160
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import ApplicationController from './application_controller'
|
2
|
+
|
3
|
+
export default class extends ApplicationController {
|
4
|
+
show () {
|
5
|
+
this.wrapperController.animate()
|
6
|
+
document.body.classList.add('mobile-nav-expanded')
|
7
|
+
}
|
8
|
+
|
9
|
+
hide () {
|
10
|
+
this.wrapperController.animate()
|
11
|
+
document.body.classList.remove('mobile-nav-expanded')
|
12
|
+
}
|
13
|
+
|
14
|
+
toggle () {
|
15
|
+
this.wrapperController.animate()
|
16
|
+
document.body.classList.toggle('mobile-nav-expanded')
|
17
|
+
}
|
18
|
+
|
19
|
+
get isExpanded () {
|
20
|
+
return document.body.classList.contains('mobile-nav-expanded')
|
21
|
+
}
|
22
|
+
|
23
|
+
get wrapperElement () {
|
24
|
+
return document.getElementById('app-wrapper')
|
25
|
+
}
|
26
|
+
|
27
|
+
get wrapperController () {
|
28
|
+
return this.application.getControllerForElementAndIdentifier(this.wrapperElement, 'wrapper')
|
29
|
+
}
|
30
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import ApplicationController from './application_controller'
|
2
|
+
|
3
|
+
import Modal from '../core/modal'
|
4
|
+
|
5
|
+
export default class extends ApplicationController {
|
6
|
+
connect () {
|
7
|
+
this.modal = new Modal(this.element)
|
8
|
+
this.modal.show()
|
9
|
+
|
10
|
+
this.element.addEventListener('hidden.bs.modal', () => this.remove())
|
11
|
+
}
|
12
|
+
|
13
|
+
disconnect () {
|
14
|
+
this.modal.dispose()
|
15
|
+
}
|
16
|
+
|
17
|
+
remove () {
|
18
|
+
this.element.remove()
|
19
|
+
}
|
20
|
+
|
21
|
+
hide () {
|
22
|
+
this.modal.hide()
|
23
|
+
}
|
24
|
+
|
25
|
+
submit (detail) {
|
26
|
+
let event = this.dispatch('submit', { detail: detail })
|
27
|
+
if (event.defaultPrevented) return
|
28
|
+
|
29
|
+
if (this.modalTrigger) {
|
30
|
+
event = this.modalTrigger.dispatch('submit', { detail: detail })
|
31
|
+
if (event.defaultPrevented) return
|
32
|
+
}
|
33
|
+
|
34
|
+
this.hide()
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import ApplicationController from './application_controller'
|
2
|
+
|
3
|
+
export default class extends ApplicationController {
|
4
|
+
connect () {
|
5
|
+
this.element.addEventListener('turbo:before-fetch-request', this.addTrestleModalHeader)
|
6
|
+
}
|
7
|
+
|
8
|
+
addTrestleModalHeader (event) {
|
9
|
+
event.detail.fetchOptions.headers['X-Trestle-Modal'] = true
|
10
|
+
}
|
11
|
+
}
|