trestle 0.9.9 → 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 +31 -3
- data/.gitignore +3 -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/turbo.rb +21 -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 +34 -0
- data/app/helpers/trestle/tab_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/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/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 +16 -11
- 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 +2 -36
- 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 +10 -6
- 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/color.rb +113 -0
- data/lib/trestle/configuration.rb +16 -8
- data/lib/trestle/engine.rb +23 -17
- 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/resource/toolbar.rb +2 -2
- 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 +2 -23
- data/package.json +31 -27
- data/trestle.gemspec +2 -3
- data/webpack.config.js +10 -10
- data/yarn.lock +1456 -1194
- metadata +166 -164
- 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/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
@@ -14,6 +14,7 @@ module Trestle
|
|
14
14
|
def new
|
15
15
|
respond_to do |format|
|
16
16
|
format.html
|
17
|
+
format.turbo_stream { render turbo_stream: turbo_stream_modal }
|
17
18
|
format.json { render json: instance }
|
18
19
|
|
19
20
|
yield format if block_given?
|
@@ -23,20 +24,20 @@ module Trestle
|
|
23
24
|
def create
|
24
25
|
if save_instance
|
25
26
|
respond_to do |format|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
flash[:message] = flash_message("create.success", title: "Success!", message: "The %{lowercase_model_name} was successfully created.")
|
28
|
+
|
29
|
+
format.html { redirect_to_return_location(:create, instance) { admin.instance_path(instance) } }
|
30
|
+
format.turbo_stream { flash.discard } if modal_request?
|
30
31
|
format.json { render json: instance, status: :created, location: admin.instance_path(instance) }
|
31
32
|
|
32
33
|
yield format if block_given?
|
33
34
|
end
|
34
35
|
else
|
35
36
|
respond_to do |format|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
flash.now[:error] = flash_message("create.failure", title: "Warning!", message: "Please correct the errors below.")
|
38
|
+
|
39
|
+
format.html { render "new", status: :unprocessable_entity }
|
40
|
+
format.turbo_stream { render "create", status: :unprocessable_entity } if modal_request?
|
40
41
|
format.json { render json: instance.errors, status: :unprocessable_entity }
|
41
42
|
|
42
43
|
yield format if block_given?
|
@@ -55,6 +56,7 @@ module Trestle
|
|
55
56
|
else
|
56
57
|
respond_to do |format|
|
57
58
|
format.html
|
59
|
+
format.turbo_stream { render turbo_stream: turbo_stream_modal } if modal_request?
|
58
60
|
format.json { render json: instance }
|
59
61
|
|
60
62
|
yield format if block_given?
|
@@ -73,6 +75,7 @@ module Trestle
|
|
73
75
|
else
|
74
76
|
respond_to do |format|
|
75
77
|
format.html
|
78
|
+
format.turbo_stream { render turbo_stream: turbo_stream_modal } if modal_request?
|
76
79
|
format.json { render json: instance }
|
77
80
|
|
78
81
|
yield format if block_given?
|
@@ -83,20 +86,20 @@ module Trestle
|
|
83
86
|
def update
|
84
87
|
if update_instance
|
85
88
|
respond_to do |format|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
89
|
+
flash[:message] = flash_message("update.success", title: "Success!", message: "The %{lowercase_model_name} was successfully updated.")
|
90
|
+
|
91
|
+
format.html { redirect_to_return_location(:update, instance) { admin.instance_path(instance) } }
|
92
|
+
format.turbo_stream { flash.discard }
|
90
93
|
format.json { render json: instance, status: :ok }
|
91
94
|
|
92
95
|
yield format if block_given?
|
93
96
|
end
|
94
97
|
else
|
95
98
|
respond_to do |format|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
99
|
+
flash.now[:error] = flash_message("update.failure", title: "Warning!", message: "Please correct the errors below.")
|
100
|
+
|
101
|
+
format.html { render "show", status: :unprocessable_entity }
|
102
|
+
format.turbo_stream { render "update", status: :unprocessable_entity }
|
100
103
|
format.json { render json: instance.errors, status: :unprocessable_entity }
|
101
104
|
|
102
105
|
yield format if block_given?
|
@@ -105,26 +108,34 @@ module Trestle
|
|
105
108
|
end
|
106
109
|
|
107
110
|
def destroy
|
108
|
-
|
111
|
+
deleting_referer = URI(request.referer).path == admin.instance_path(instance)
|
109
112
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
113
|
+
if delete_instance
|
114
|
+
respond_to do |format|
|
115
|
+
flash[:message] = flash_message("destroy.success", title: "Success!", message: "The %{lowercase_model_name} was successfully deleted.")
|
116
|
+
|
117
|
+
format.html { redirect_to_return_location(:destroy, instance, status: :see_other) { admin.path(:index) } }
|
118
|
+
format.turbo_stream { flash.discard } unless deleting_referer
|
119
|
+
format.json { head :no_content }
|
120
|
+
|
121
|
+
yield format if block_given?
|
122
|
+
end
|
123
|
+
else
|
124
|
+
respond_to do |format|
|
125
|
+
flash[:error] = flash_message("destroy.failure", title: "Warning!", message: "Could not delete %{lowercase_model_name}.")
|
117
126
|
|
127
|
+
format.html do
|
118
128
|
if load_instance
|
119
129
|
redirect_to_return_location(:update, instance) { admin.instance_path(instance) }
|
120
130
|
else
|
121
|
-
redirect_to_return_location(:destroy, instance) { admin.path(:index) }
|
131
|
+
redirect_to_return_location(:destroy, instance, status: :see_other) { admin.path(:index) }
|
122
132
|
end
|
123
133
|
end
|
124
|
-
|
125
|
-
|
134
|
+
format.turbo_stream { flash.discard }
|
135
|
+
format.json { head :no_content }
|
126
136
|
|
127
|
-
|
137
|
+
yield format if block_given?
|
138
|
+
end
|
128
139
|
end
|
129
140
|
end
|
130
141
|
end
|
@@ -3,20 +3,20 @@ module Trestle
|
|
3
3
|
module Controller
|
4
4
|
module Redirection
|
5
5
|
protected
|
6
|
-
def redirect_to_return_location(action, instance, default: nil, &block)
|
6
|
+
def redirect_to_return_location(action, instance, status: :found, default: nil, &block)
|
7
7
|
fallback_location = block_given? ? block : default
|
8
8
|
|
9
|
-
if admin.return_locations[action] && !
|
9
|
+
if admin.return_locations[action] && !modal_request?
|
10
10
|
location = instance_exec(instance, &admin.return_locations[action])
|
11
11
|
|
12
12
|
case location
|
13
13
|
when :back
|
14
|
-
redirect_back fallback_location: fallback_location,
|
14
|
+
redirect_back fallback_location: fallback_location, status: status
|
15
15
|
else
|
16
|
-
redirect_to location,
|
16
|
+
redirect_to location, status: status
|
17
17
|
end
|
18
18
|
else
|
19
|
-
redirect_to fallback_location,
|
19
|
+
redirect_to fallback_location, status: status
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -3,10 +3,11 @@ class Trestle::ApplicationController < ActionController::Base
|
|
3
3
|
|
4
4
|
include Trestle::Controller::Breadcrumbs
|
5
5
|
include Trestle::Controller::Callbacks
|
6
|
-
include Trestle::Controller::Dialog
|
7
6
|
include Trestle::Controller::Helpers
|
8
7
|
include Trestle::Controller::Layout
|
9
8
|
include Trestle::Controller::Location
|
9
|
+
include Trestle::Controller::Modal
|
10
10
|
include Trestle::Controller::Title
|
11
11
|
include Trestle::Controller::Toolbars
|
12
|
+
include Trestle::Controller::Turbo
|
12
13
|
end
|
@@ -11,5 +11,15 @@ module Trestle
|
|
11
11
|
def instance_has_errors?
|
12
12
|
instance.errors.any? rescue false
|
13
13
|
end
|
14
|
+
|
15
|
+
def turbo_stream_update_flash
|
16
|
+
<<-EOF
|
17
|
+
<turbo-stream action="update" target="flash">
|
18
|
+
<template>
|
19
|
+
#{render_to_string(partial: "trestle/flash/flash", formats: [:html])}
|
20
|
+
</template>
|
21
|
+
</turbo-stream>
|
22
|
+
EOF
|
23
|
+
end
|
14
24
|
end
|
15
25
|
end
|
@@ -1,13 +1,14 @@
|
|
1
1
|
module Trestle
|
2
2
|
module FormHelper
|
3
3
|
IDENTITY_FIELD_ERROR_PROC = Proc.new { |html_tag, instance| html_tag }
|
4
|
+
DEFAULT_FORM_CONTROLLERS = %w(keyboard-submit form-loading form-error)
|
4
5
|
|
5
6
|
def trestle_form_for(instance, options={}, &block)
|
6
7
|
options[:builder] ||= Form::Builder
|
7
8
|
options[:as] ||= admin.parameter_name
|
8
9
|
|
9
10
|
options[:data] ||= {}
|
10
|
-
options[:data]
|
11
|
+
options[:data][:controller] = (DEFAULT_FORM_CONTROLLERS + Array(options[:data][:controller])).join(" ")
|
11
12
|
|
12
13
|
form_for(instance, options) do |f|
|
13
14
|
with_identity_field_error_proc do
|
@@ -41,7 +42,7 @@ module Trestle
|
|
41
42
|
end
|
42
43
|
|
43
44
|
def render_sidebar_as_tab?
|
44
|
-
|
45
|
+
modal_request? && content_for?(:sidebar)
|
45
46
|
end
|
46
47
|
end
|
47
48
|
end
|
@@ -13,7 +13,8 @@ module Trestle
|
|
13
13
|
when :currency
|
14
14
|
number_to_currency(value)
|
15
15
|
when :tags
|
16
|
-
|
16
|
+
tags = Array(value).map { |tag| content_tag(:span, tag, class: "tag tag-primary") }
|
17
|
+
content_tag(:div, safe_join(tags), class: "tag-list")
|
17
18
|
else
|
18
19
|
value
|
19
20
|
end
|
@@ -1,13 +1,52 @@
|
|
1
1
|
module Trestle
|
2
2
|
module I18nHelper
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
FLATPICKR_LOCALE_CONVERSIONS = { ca: "cat", el: "gr", nb: "no", vi: "vn" }.stringify_keys
|
4
|
+
|
5
|
+
# Returns the I18n fallbacks for the given locale.
|
6
|
+
#
|
7
|
+
# This is used to determine which locale files to include.
|
8
|
+
#
|
9
|
+
# Examples
|
10
|
+
#
|
11
|
+
# i18n_fallbacks("pt-BR") => ["pt-BR", "pt"]
|
12
|
+
# i18n_fallbacks("ca") => ["ca", "es-ES", "es"] %>
|
13
|
+
#
|
14
|
+
# Returns an array of locale Strings.
|
15
|
+
def i18n_fallbacks(locale=I18n.locale)
|
16
|
+
if I18n.respond_to?(:fallbacks)
|
17
|
+
I18n.fallbacks[locale].map(&:to_s)
|
18
|
+
elsif locale.to_s.include?("-")
|
19
|
+
fallback = locale.to_s.split("-").first
|
20
|
+
[locale, fallback]
|
21
|
+
else
|
22
|
+
[locale]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Returns a nested hash of I18n key/value pairs for passing to JS.
|
27
|
+
def i18n_javascript_translations(keys=Trestle.config.javascript_i18n_keys)
|
28
|
+
result = {}
|
29
|
+
|
30
|
+
keys.each do |key|
|
31
|
+
if translation = I18n.t(key, default: nil)
|
32
|
+
*parts, last = key.split(".")
|
33
|
+
|
34
|
+
# Create nesting from period-separated i18n key
|
35
|
+
target = parts.inject(result) { |hash, part|
|
36
|
+
hash[part] ||= {}
|
37
|
+
}
|
38
|
+
|
39
|
+
target[last] = translation
|
9
40
|
end
|
10
|
-
|
41
|
+
end
|
42
|
+
|
43
|
+
result
|
44
|
+
end
|
45
|
+
|
46
|
+
# Returns the Flatpickr locale code corresponding to the given locale,
|
47
|
+
# as some of their codes are different to the Rails' counterparts.
|
48
|
+
def flatpickr_locale(locale)
|
49
|
+
FLATPICKR_LOCALE_CONVERSIONS.fetch(locale.to_s) { locale }
|
11
50
|
end
|
12
51
|
end
|
13
52
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Trestle
|
2
|
+
module ModalHelper
|
3
|
+
def turbo_stream_modal(template: action_name)
|
4
|
+
template = render_to_string template: action_name, prefixes: _prefixes, formats: [:html], layout: "trestle/modal"
|
5
|
+
%(<turbo-stream action="modal"><template>#{template}</template></turbo-stream>).html_safe
|
6
|
+
end
|
7
|
+
|
8
|
+
def modal_options!(options)
|
9
|
+
modal_options.merge!(options)
|
10
|
+
end
|
11
|
+
|
12
|
+
def modal_options
|
13
|
+
@_modal_options ||= {}
|
14
|
+
end
|
15
|
+
|
16
|
+
def modal_wrapper_attributes
|
17
|
+
{
|
18
|
+
class: ["modal", "fade", modal_options[:wrapper_class]],
|
19
|
+
tabindex: "-1",
|
20
|
+
role: "dialog",
|
21
|
+
data: {
|
22
|
+
controller: ["modal", modal_options[:controller]].compact.join(" ")
|
23
|
+
}
|
24
|
+
}.deep_merge(modal_options.except(:class, :wrapper_class, :controller))
|
25
|
+
end
|
26
|
+
|
27
|
+
def modal_dialog_attributes
|
28
|
+
{
|
29
|
+
class: ["modal-dialog", modal_options[:class]],
|
30
|
+
role: "document"
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -7,7 +7,7 @@ module Trestle
|
|
7
7
|
def tab(name, options={})
|
8
8
|
tabs[name] = tab = Tab.new(name, options)
|
9
9
|
|
10
|
-
content_tag(:div, id: tab.id(("modal" if
|
10
|
+
content_tag(:div, id: tab.id(("modal" if modal_request?)), class: ["tab-pane", ('active' if name == tabs.keys.first)], role: "tabpanel") do
|
11
11
|
if block_given?
|
12
12
|
yield
|
13
13
|
elsif options[:partial]
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Trestle
|
2
|
+
module TurboFrameHelper
|
3
|
+
def index_turbo_frame(options={}, &block)
|
4
|
+
defaults = {
|
5
|
+
id: "index",
|
6
|
+
data: {
|
7
|
+
controller: "reloadable",
|
8
|
+
turbo_action: "advance"
|
9
|
+
}
|
10
|
+
}
|
11
|
+
|
12
|
+
content_tag("turbo-frame", defaults.merge(options), &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def resource_turbo_frame(instance, options={}, &block)
|
16
|
+
defaults = {
|
17
|
+
id: dom_id(instance),
|
18
|
+
target: ("_top" unless modal_request?),
|
19
|
+
data: {
|
20
|
+
controller: resource_turbo_frame_controllers.join(" ").presence
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
content_tag("turbo-frame", defaults.merge(options), &block)
|
25
|
+
end
|
26
|
+
|
27
|
+
def resource_turbo_frame_controllers
|
28
|
+
controllers = []
|
29
|
+
controllers << "modal-frame" if modal_request?
|
30
|
+
controllers << "deprecated--init" if modal_request? || request.post? || turbo_frame_request?
|
31
|
+
controllers
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Trestle
|
2
2
|
module UrlHelper
|
3
|
-
|
3
|
+
MODAL_ACTIONS = [:new, :show, :edit]
|
4
4
|
|
5
5
|
def admin_link_to(content, instance_or_url=nil, options={}, &block)
|
6
6
|
# Block given - ignore content parameter and capture content from block
|
@@ -45,9 +45,12 @@ module Trestle
|
|
45
45
|
end
|
46
46
|
|
47
47
|
# Determine link data options
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
options[:data] ||= {}
|
49
|
+
|
50
|
+
if MODAL_ACTIONS.include?(action) && admin.form.modal?
|
51
|
+
options[:data][:controller] ||= "modal-trigger"
|
52
|
+
else
|
53
|
+
options[:data][:turbo_frame] = "_top"
|
51
54
|
end
|
52
55
|
|
53
56
|
link_to(content, path, options)
|
@@ -5,10 +5,9 @@
|
|
5
5
|
<meta content='width=device-width, initial-scale=1' name='viewport'>
|
6
6
|
<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
<% end %>
|
8
|
+
<meta name='turbo-cache-control' content='no-cache'>
|
9
|
+
<meta name="turbo-prefetch" content="false" />
|
10
|
+
<meta name="turbo-root" content="<%= Trestle.config.path %>">
|
12
11
|
|
13
12
|
<%= csrf_meta_tags %>
|
14
13
|
|
@@ -16,43 +15,42 @@
|
|
16
15
|
|
17
16
|
<%= favicon_link_tag Trestle.config.favicon if Trestle.config.favicon %>
|
18
17
|
|
19
|
-
<%= stylesheet_link_tag "trestle/admin", 'data-
|
20
|
-
<%= stylesheet_link_tag "trestle/
|
21
|
-
<%= stylesheet_link_tag "trestle/custom", 'data-turbolinks-track': 'reload' %>
|
18
|
+
<%= stylesheet_link_tag "trestle/admin", 'data-turbo-track': 'reload' %>
|
19
|
+
<%= stylesheet_link_tag "trestle/icons/font-awesome", 'data-turbo-track': 'reload' if defined?(Sprockets) %>
|
22
20
|
|
23
|
-
<%=
|
21
|
+
<%= stylesheet_link_tag "trestle/custom", 'data-turbo-track': 'reload' %>
|
24
22
|
|
25
|
-
<%=
|
26
|
-
<%= javascript_include_tag "trestle/admin", 'data-turbolinks-track': 'reload' %>
|
23
|
+
<%= hook :stylesheets %>
|
27
24
|
|
28
|
-
<%=
|
29
|
-
|
30
|
-
Trestle.i18n['<%= key %>'] = "<%= escape_javascript(value) %>";
|
31
|
-
<% end %>
|
25
|
+
<%= javascript_include_tag "trestle/admin", 'data-turbo-track': 'reload' %>
|
26
|
+
<%= javascript_include_tag "trestle/custom", 'data-turbo-track': 'reload' %>
|
32
27
|
|
33
|
-
|
34
|
-
<% end %>
|
28
|
+
<%= render "trestle/i18n" unless I18n.locale == :en %>
|
35
29
|
|
36
30
|
<%= hook :javascripts %>
|
37
31
|
|
32
|
+
<%= render "trestle/theme" %>
|
33
|
+
|
38
34
|
<%= content_for(:head) %>
|
39
35
|
|
40
36
|
<%= hook :head %>
|
41
37
|
</head>
|
42
38
|
|
43
39
|
<%= content_tag :body, body_attributes do %>
|
44
|
-
<div class="app-wrapper">
|
40
|
+
<div id="app-wrapper" class="app-wrapper" data-controller="wrapper" data-action="click->wrapper#hideMobileSidebar touchstart->wrapper#hideMobileSidebar" data-wrapper-mobile-sidebar-outlet=".app-sidebar">
|
45
41
|
<%= render "trestle/shared/sidebar" %>
|
46
42
|
|
47
43
|
<div class="app-container">
|
48
44
|
<%= render "trestle/shared/header" %>
|
49
45
|
|
50
|
-
<main class="app-main"
|
46
|
+
<main class="app-main">
|
51
47
|
<%= yield %>
|
52
48
|
</main>
|
53
49
|
|
54
50
|
<%= render "trestle/shared/footer" %>
|
55
51
|
</div>
|
56
52
|
</div>
|
53
|
+
|
54
|
+
<turbo-frame id="modal"></turbo-frame>
|
57
55
|
<% end %>
|
58
56
|
</html>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<% i18n_fallbacks.each do |locale| %>
|
2
|
+
<%= javascript_include_tag "trestle/locale/#{locale}", 'data-turbo-track': 'reload' rescue nil %>
|
3
|
+
<%= javascript_include_tag "trestle/locale/flatpickr/#{flatpickr_locale(locale)}", 'data-turbo-track': 'reload' rescue nil %>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<%= javascript_tag nonce: true do %>
|
7
|
+
<% if Trestle.config.javascript_i18n_keys.any? %>
|
8
|
+
Trestle.i18n.store(<%=raw JSON.pretty_generate(I18n.locale => i18n_javascript_translations) %>);
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
Trestle.localize(<%= i18n_fallbacks.map { |l| "'#{l}'" }.join(", ").html_safe %>);
|
12
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% if Trestle.config.theme.any? %>
|
2
|
+
<style type="text/css">
|
3
|
+
:root {
|
4
|
+
<% Trestle.config.theme.each do |name, color| %>
|
5
|
+
--<%= name %>: <%= color.hex %>;
|
6
|
+
--<%= name %>-rgb: <%= color.rgb.join(", ") %>;
|
7
|
+
|
8
|
+
<% h, s, l = color.hsl %>
|
9
|
+
--<%= name %>-h: <%= h %>;
|
10
|
+
--<%= name %>-s: <%= s %>%;
|
11
|
+
--<%= name %>-l: <%= l %>%;
|
12
|
+
<% end %>
|
13
|
+
}
|
14
|
+
</style>
|
15
|
+
<% end %>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<ol class="breadcrumb">
|
7
7
|
<% breadcrumbs.each do |breadcrumb| %>
|
8
8
|
<li class="breadcrumb-item<% if breadcrumb == breadcrumbs.last %> active<% end %>">
|
9
|
-
<%= link_to breadcrumb.label, breadcrumb.path %>
|
9
|
+
<%= link_to breadcrumb.label, breadcrumb.path, data: { turbo_frame: "_top" } %>
|
10
10
|
</li>
|
11
11
|
<% end %>
|
12
12
|
</ol>
|
@@ -1,9 +1,12 @@
|
|
1
1
|
<%= render "header", hide_breadcrumbs: local_assigns.fetch(:hide_breadcrumbs, false) if local_assigns.fetch(:header, true) %>
|
2
2
|
|
3
|
-
<div class="main-content-area">
|
4
|
-
|
3
|
+
<div class="main-content-area" data-scroll-target>
|
4
|
+
<turbo-frame id="flash">
|
5
|
+
<%= render "trestle/flash/flash" %>
|
6
|
+
</turbo-frame>
|
7
|
+
|
5
8
|
<%= render "utilities" %>
|
6
|
-
<%= render "tabs" %>
|
9
|
+
<%= render "tabs", data: { controller: "tabs tab-errors" } %>
|
7
10
|
|
8
11
|
<% if local_assigns.fetch(:wrapper, true) %>
|
9
12
|
<%= container do |c| %>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<div class="modal-content">
|
2
|
+
<div class="modal-header">
|
3
|
+
<h4 class="modal-title"><%= title %></h4>
|
4
|
+
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<div class="modal-flash">
|
8
|
+
<%= render "trestle/flash/flash" %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="modal-tabs">
|
12
|
+
<%= render "tabs", data: { controller: "tab-errors" } %>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="modal-body">
|
16
|
+
<%= yield %>
|
17
|
+
|
18
|
+
<% if content_for?(:sidebar) %>
|
19
|
+
<div id="tab-sidebar" class="tab-pane" role="tabpanel">
|
20
|
+
<%= content_for(:sidebar) %>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<div class="modal-footer">
|
26
|
+
<div class="btn-toolbar secondary-toolbar" role="toolbar">
|
27
|
+
<%= render_toolbar(toolbar(:secondary)) %>
|
28
|
+
<%= deprecated_toolbar(:secondary) %>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div class="btn-toolbar primary-toolbar" role="toolbar">
|
32
|
+
<%= render_toolbar(toolbar(:primary)) %>
|
33
|
+
<%= deprecated_toolbar(:primary) %>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
</div>
|
@@ -1,15 +1,15 @@
|
|
1
1
|
<% if tabs.any? || render_sidebar_as_tab? -%>
|
2
|
-
|
2
|
+
<%= content_tag :ul, class: "nav nav-tabs", data: local_assigns.fetch(:data, {}) do %>
|
3
3
|
<% tabs.each do |name, tab| %>
|
4
4
|
<li class="nav-item">
|
5
|
-
<%= link_to tab.label, "##{tab.id(("modal" if
|
5
|
+
<%= link_to tab.label, "##{tab.id(("modal" if modal_request?))}", class: ["nav-link", ("active" if name == tabs.keys.first)], role: "tab", data: { bs_toggle: "tab" } %>
|
6
6
|
</li>
|
7
7
|
<% end %>
|
8
8
|
|
9
9
|
<% if render_sidebar_as_tab? %>
|
10
10
|
<li class="nav-item align-right">
|
11
|
-
<%= link_to icon("fa fa-list-alt"), "#tab-sidebar", class: "nav-link", role: "tab", data: {
|
11
|
+
<%= link_to icon("fa fa-list-alt"), "#tab-sidebar", class: "nav-link", role: "tab", data: { bs_toggle: "tab" } %>
|
12
12
|
</li>
|
13
13
|
<% end %>
|
14
|
-
|
14
|
+
<% end %>
|
15
15
|
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div class="alert alert-dismissable <%= html_class %>" role="alert">
|
2
|
-
<button type="button" class="close" data-dismiss="alert" aria-label="Close"
|
2
|
+
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
3
3
|
|
4
4
|
<%= icon %>
|
5
5
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% errors = local_assigns.fetch(:errors, {}) %>
|
2
2
|
|
3
3
|
<% if errors.any? %>
|
4
|
-
<%= link_to "Debug errors", "#debug-errors", class: "toggle-debug-errors small", data: {
|
4
|
+
<%= link_to "Debug errors", "#debug-errors", class: "toggle-debug-errors small", data: { bs_toggle: "collapse" } %>
|
5
5
|
|
6
6
|
<div id="debug-errors" class="debug-errors collapse">
|
7
7
|
<ul>
|
@@ -1,4 +1,9 @@
|
|
1
1
|
<% if admin.form -%>
|
2
|
+
<% if admin.form.modal? && modal_options = admin.form.options[:modal] %>
|
3
|
+
<% modal_options!(class: modal_options[:class]) %>
|
4
|
+
<% modal_options!(controller: modal_options[:controller]) %>
|
5
|
+
<% end %>
|
6
|
+
|
2
7
|
<%= admin.form.render(self, instance) %>
|
3
8
|
<% else %>
|
4
9
|
<p><%= t("trestle.onboarding.no_form", default: "Please define a form block or create a <code>_form.html</code> partial.").html_safe %></p>
|
@@ -0,0 +1 @@
|
|
1
|
+
<turbo-stream action="closeModal" target="<%= dom_id(instance) %>"></turbo-stream>
|
@@ -11,6 +11,8 @@
|
|
11
11
|
<%= t.delete %>
|
12
12
|
<% end %>
|
13
13
|
|
14
|
-
<%=
|
15
|
-
<%=
|
14
|
+
<%= resource_turbo_frame(instance) do %>
|
15
|
+
<%= trestle_form_for instance, url: admin.actions.include?(:update) ? admin.instance_path(instance, action: :update) : "#", method: :patch do |f| %>
|
16
|
+
<%= render partial: "form", layout: modal_request? ? "modal" : "layout" %>
|
17
|
+
<% end %>
|
16
18
|
<% end %>
|