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
Binary file
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<% flatpickr_locale_conversions = { ca: "cat", el: "gr", nb: "no", vi: "vn" } %>
|
2
|
-
|
3
|
-
<% I18n.available_locales.sort.each do |locale| %>
|
4
|
-
<% Trestle.i18n_fallbacks(locale).each do |candidate| %>
|
5
|
-
<% candidate = flatpickr_locale_conversions[candidate] || candidate %>
|
6
|
-
<% require_asset("trestle/flatpickr/#{candidate}") rescue nil %>
|
7
|
-
<% end %>
|
8
|
-
<% end %>
|
@@ -1,40 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Font Awesome Free 5.8.1 by @fontawesome - https://fontawesome.com
|
3
|
-
* License - https://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
4
|
-
*/
|
5
|
-
|
6
|
-
@font-face {
|
7
|
-
font-family: 'Font Awesome 5 Free';
|
8
|
-
font-style: normal;
|
9
|
-
font-weight: 400;
|
10
|
-
src: url(<%= asset_path('trestle/fa-regular-400.eot') %>);
|
11
|
-
src: url(<%= asset_path('trestle/fa-regular-400.eot?#iefix') %>) format('embedded-opentype'),
|
12
|
-
url(<%= asset_path('trestle/fa-regular-400.woff2') %>) format('woff2'),
|
13
|
-
url(<%= asset_path('trestle/fa-regular-400.woff') %>) format('woff'),
|
14
|
-
url(<%= asset_path('trestle/fa-regular-400.ttf') %>) format('truetype'),
|
15
|
-
url(<%= asset_path('trestle/fa-regular-400.svg#fontawesome') %>) format('svg');
|
16
|
-
}
|
17
|
-
|
18
|
-
@font-face {
|
19
|
-
font-family: 'Font Awesome 5 Free';
|
20
|
-
font-style: normal;
|
21
|
-
font-weight: 900;
|
22
|
-
src: url(<%= asset_path('trestle/fa-solid-900.eot') %>);
|
23
|
-
src: url(<%= asset_path('trestle/fa-solid-900.eot?#iefix') %>) format('embedded-opentype'),
|
24
|
-
url(<%= asset_path('trestle/fa-solid-900.woff2') %>) format('woff2'),
|
25
|
-
url(<%= asset_path('trestle/fa-solid-900.woff') %>) format('woff'),
|
26
|
-
url(<%= asset_path('trestle/fa-solid-900.ttf') %>) format('truetype'),
|
27
|
-
url(<%= asset_path('trestle/fa-solid-900.svg#fontawesome') %>) format('svg');
|
28
|
-
}
|
29
|
-
|
30
|
-
@font-face {
|
31
|
-
font-family: 'Font Awesome 5 Brands';
|
32
|
-
font-style: normal;
|
33
|
-
font-weight: normal;
|
34
|
-
src: url(<%= asset_path('trestle/fa-brands-400.eot') %>);
|
35
|
-
src: url(<%= asset_path('trestle/fa-brands-400.eot?#iefix') %>) format('embedded-opentype'),
|
36
|
-
url(<%= asset_path('trestle/fa-brands-400.woff2') %>) format('woff2'),
|
37
|
-
url(<%= asset_path('trestle/fa-brands-400.woff') %>) format('woff'),
|
38
|
-
url(<%= asset_path('trestle/fa-brands-400.ttf') %>) format('truetype'),
|
39
|
-
url(<%= asset_path('trestle/fa-brands-400.svg#fontawesome') %>) format('svg');
|
40
|
-
}
|
@@ -1,34 +0,0 @@
|
|
1
|
-
<div class="modal-header">
|
2
|
-
<h4 class="modal-title"><%= title %></h4>
|
3
|
-
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
4
|
-
</div>
|
5
|
-
|
6
|
-
<div class="modal-flash">
|
7
|
-
<%= render "trestle/flash/flash" %>
|
8
|
-
</div>
|
9
|
-
|
10
|
-
<div class="modal-tabs">
|
11
|
-
<%= render "tabs" %>
|
12
|
-
</div>
|
13
|
-
|
14
|
-
<div class="modal-body">
|
15
|
-
<%= yield %>
|
16
|
-
|
17
|
-
<% if content_for?(:sidebar) %>
|
18
|
-
<div id="tab-sidebar" class="tab-pane" role="tabpanel">
|
19
|
-
<%= content_for(:sidebar) %>
|
20
|
-
</div>
|
21
|
-
<% end %>
|
22
|
-
</div>
|
23
|
-
|
24
|
-
<div class="modal-footer">
|
25
|
-
<div class="btn-toolbar secondary-toolbar" role="toolbar">
|
26
|
-
<%= render_toolbar(toolbar(:secondary)) %>
|
27
|
-
<%= deprecated_toolbar(:secondary) %>
|
28
|
-
</div>
|
29
|
-
|
30
|
-
<div class="btn-toolbar primary-toolbar" role="toolbar">
|
31
|
-
<%= render_toolbar(toolbar(:primary)) %>
|
32
|
-
<%= deprecated_toolbar(:primary) %>
|
33
|
-
</div>
|
34
|
-
</div>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
:root {
|
2
|
-
$color: "primary";
|
3
|
-
$value: theme-color($color);
|
4
|
-
|
5
|
-
--#{$color}-rgb: #{red($value), green($value), blue($value)};
|
6
|
-
|
7
|
-
--#{$color}-hue: #{hue($value)};
|
8
|
-
--#{$color}-saturation: #{saturation($value)};
|
9
|
-
--#{$color}-lightness: #{lightness($value)};
|
10
|
-
}
|
@@ -1,35 +0,0 @@
|
|
1
|
-
// Convert custom controls to use em rather than rem sizing, so that they scale nicely.
|
2
|
-
// This is planned for Bootstrap 5 (https://github.com/twbs/bootstrap/issues/27803)
|
3
|
-
.custom-control-label {
|
4
|
-
&::before {
|
5
|
-
top: em(($font-size-base * $line-height-base - $custom-control-indicator-size) / 2);
|
6
|
-
left: em(-($custom-control-gutter + $custom-control-indicator-size));
|
7
|
-
width: em($custom-control-indicator-size);
|
8
|
-
height: em($custom-control-indicator-size);
|
9
|
-
}
|
10
|
-
|
11
|
-
&::after {
|
12
|
-
top: em(($font-size-base * $line-height-base - $custom-control-indicator-size) / 2);
|
13
|
-
left: em(-($custom-control-gutter + $custom-control-indicator-size));
|
14
|
-
width: em($custom-control-indicator-size);
|
15
|
-
height: em($custom-control-indicator-size);
|
16
|
-
}
|
17
|
-
}
|
18
|
-
|
19
|
-
.custom-switch {
|
20
|
-
padding-left: em($custom-switch-width + $custom-control-gutter);
|
21
|
-
|
22
|
-
.custom-control-label {
|
23
|
-
&::before {
|
24
|
-
left: em(-($custom-switch-width + $custom-control-gutter));
|
25
|
-
width: em($custom-switch-width);
|
26
|
-
}
|
27
|
-
|
28
|
-
&::after {
|
29
|
-
top: calc(#{em((($font-size-base * $line-height-base - $custom-control-indicator-size) / 2))} + #{$custom-control-indicator-border-width * 2});
|
30
|
-
left: calc(#{em(-($custom-switch-width + $custom-control-gutter))} + #{$custom-control-indicator-border-width * 2});
|
31
|
-
width: $custom-switch-indicator-size;
|
32
|
-
height: $custom-switch-indicator-size;
|
33
|
-
}
|
34
|
-
}
|
35
|
-
}
|
@@ -1,36 +0,0 @@
|
|
1
|
-
// Fix z-index of Magnific Popup lightboxes so that they appear above Bootstrap modals
|
2
|
-
|
3
|
-
$mfp-z-index-base: 1140;
|
4
|
-
|
5
|
-
.mfp-bg { z-index: $mfp-z-index-base + 2; }
|
6
|
-
.mfp-wrap { z-index: $mfp-z-index-base + 3; }
|
7
|
-
.mfp-content { z-index: $mfp-z-index-base + 5; }
|
8
|
-
.mfp-preloader { z-index: $mfp-z-index-base + 4; }
|
9
|
-
|
10
|
-
button.mfp-close,
|
11
|
-
button.mfp-arrow {
|
12
|
-
z-index: $mfp-z-index-base + 6;
|
13
|
-
}
|
14
|
-
|
15
|
-
|
16
|
-
// Smooth transition of lightbox background
|
17
|
-
|
18
|
-
.mfp-with-zoom .mfp-container,
|
19
|
-
.mfp-with-zoom.mfp-bg {
|
20
|
-
opacity: 0;
|
21
|
-
|
22
|
-
backface-visibility: hidden;
|
23
|
-
transition: all 150ms ease-out;
|
24
|
-
}
|
25
|
-
|
26
|
-
.mfp-with-zoom.mfp-ready .mfp-container {
|
27
|
-
opacity: 1;
|
28
|
-
}
|
29
|
-
.mfp-with-zoom.mfp-ready.mfp-bg {
|
30
|
-
opacity: 0.8;
|
31
|
-
}
|
32
|
-
|
33
|
-
.mfp-with-zoom.mfp-removing .mfp-container,
|
34
|
-
.mfp-with-zoom.mfp-removing.mfp-bg {
|
35
|
-
opacity: 0;
|
36
|
-
}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import $ from 'jquery'
|
2
|
-
|
3
|
-
import { init } from '../core/events'
|
4
|
-
import { i18n } from '../core/i18n'
|
5
|
-
|
6
|
-
init(function (root) {
|
7
|
-
const DEFAULTS = {
|
8
|
-
singleton: true,
|
9
|
-
popout: true,
|
10
|
-
title: i18n['trestle.confirmation.title'] || 'Are you sure?',
|
11
|
-
btnOkClass: 'btn btn-sm btn-primary',
|
12
|
-
btnOkLabel: i18n['trestle.confirmation.ok'] || 'OK',
|
13
|
-
btnCancelClass: 'btn btn-sm btn-light',
|
14
|
-
btnCancelLabel: i18n['trestle.confirmation.cancel'] || 'Cancel',
|
15
|
-
copyAttributes: 'href target data-remote data-method data-url data-params data-type'
|
16
|
-
}
|
17
|
-
|
18
|
-
const CONFIRM = {
|
19
|
-
...DEFAULTS,
|
20
|
-
rootSelector: '[data-toggle="confirm"]'
|
21
|
-
}
|
22
|
-
|
23
|
-
const DELETE = {
|
24
|
-
...DEFAULTS,
|
25
|
-
rootSelector: '[data-toggle="confirm-delete"]',
|
26
|
-
btnOkClass: 'btn btn-sm btn-danger',
|
27
|
-
btnOkLabel: i18n['trestle.confirmation.delete'] || 'Delete'
|
28
|
-
}
|
29
|
-
|
30
|
-
$(root).find('[data-toggle="confirm"]').confirmation(CONFIRM)
|
31
|
-
$(root).find('[data-toggle="confirm-delete"]').confirmation(DELETE)
|
32
|
-
})
|
@@ -1,69 +0,0 @@
|
|
1
|
-
import $ from 'jquery'
|
2
|
-
|
3
|
-
import { init } from '../core/events'
|
4
|
-
import { i18n } from '../core/i18n'
|
5
|
-
|
6
|
-
function setupDatePicker (selectedDates, dateStr, instance) {
|
7
|
-
addClearButton(instance)
|
8
|
-
enableDirectEntry(instance)
|
9
|
-
}
|
10
|
-
|
11
|
-
function addClearButton (instance) {
|
12
|
-
const $input = $(instance.input)
|
13
|
-
|
14
|
-
if ($input.data('allow-clear')) {
|
15
|
-
$('<a href="#">')
|
16
|
-
.on('click', function (e) {
|
17
|
-
e.preventDefault()
|
18
|
-
|
19
|
-
const isDisabled = $input.is(':disabled') || $input.hasClass('disabled')
|
20
|
-
|
21
|
-
if (!isDisabled) {
|
22
|
-
instance.clear()
|
23
|
-
}
|
24
|
-
})
|
25
|
-
.addClass('clear-datepicker')
|
26
|
-
.insertBefore(instance.altInput)
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
function enableDirectEntry (instance) {
|
31
|
-
const $altInput = $(instance.altInput)
|
32
|
-
|
33
|
-
$altInput.on('input', function (e) {
|
34
|
-
const value = $altInput.val()
|
35
|
-
|
36
|
-
const parsedDate = instance.parseDate(value, instance.config.altFormat)
|
37
|
-
const formattedDate = instance.formatDate(parsedDate, instance.config.altFormat)
|
38
|
-
|
39
|
-
if (value === formattedDate) {
|
40
|
-
instance.setDate(value, true, instance.config.altFormat)
|
41
|
-
}
|
42
|
-
})
|
43
|
-
}
|
44
|
-
|
45
|
-
init(function (root) {
|
46
|
-
$(root).find('input[type="date"][data-picker="true"]').flatpickr({
|
47
|
-
allowInput: true,
|
48
|
-
altInput: true,
|
49
|
-
altFormat: i18n['admin.datepicker.formats.date'] || 'm/d/Y',
|
50
|
-
onReady: setupDatePicker
|
51
|
-
})
|
52
|
-
|
53
|
-
$(root).find('input[type="datetime"][data-picker="true"], input[type="datetime-local"][data-picker="true"]').flatpickr({
|
54
|
-
enableTime: true,
|
55
|
-
allowInput: true,
|
56
|
-
altInput: true,
|
57
|
-
altFormat: i18n['admin.datepicker.formats.datetime'] || 'm/d/Y h:i K',
|
58
|
-
onReady: setupDatePicker
|
59
|
-
})
|
60
|
-
|
61
|
-
$(root).find('input[type="time"][data-picker="true"]').flatpickr({
|
62
|
-
enableTime: true,
|
63
|
-
noCalendar: true,
|
64
|
-
allowInput: true,
|
65
|
-
altInput: true,
|
66
|
-
altFormat: i18n['admin.datepicker.formats.time'] || 'h:i K',
|
67
|
-
onReady: setupDatePicker
|
68
|
-
})
|
69
|
-
})
|
@@ -1,149 +0,0 @@
|
|
1
|
-
import $ from 'jquery'
|
2
|
-
|
3
|
-
import { i18n } from '../core/i18n'
|
4
|
-
import { triggerInit } from '../core/events'
|
5
|
-
|
6
|
-
const TEMPLATE = `
|
7
|
-
<div class="modal fade" tabindex="-1" role="dialog">
|
8
|
-
<div class="modal-dialog" role="document">
|
9
|
-
<div class="modal-content" data-context>
|
10
|
-
</div>
|
11
|
-
</div>
|
12
|
-
</div>
|
13
|
-
`
|
14
|
-
|
15
|
-
function createElement () {
|
16
|
-
const $el = $(TEMPLATE).appendTo('body')
|
17
|
-
|
18
|
-
$el.modal({
|
19
|
-
show: false,
|
20
|
-
focus: false
|
21
|
-
})
|
22
|
-
|
23
|
-
$el.on('hidden.bs.modal', function () {
|
24
|
-
// Restore modal-open class on body if background modals still visible
|
25
|
-
if ($el.prevAll('.modal.show').length) {
|
26
|
-
$(document.body).addClass('modal-open')
|
27
|
-
}
|
28
|
-
|
29
|
-
// Remove dialog elements once hidden
|
30
|
-
$el.remove()
|
31
|
-
})
|
32
|
-
|
33
|
-
// Restore the next visible modal to the foreground
|
34
|
-
$el.on('hide.bs.modal', function () {
|
35
|
-
$el.prevAll('.modal.show').last().removeClass('background')
|
36
|
-
})
|
37
|
-
|
38
|
-
// Set X-Trestle-Dialog header on AJAX requests initiated from the dialog
|
39
|
-
$el.on('ajax:beforeSend', '[data-remote]', function (e) {
|
40
|
-
const xhr = e.detail[0]
|
41
|
-
xhr.setRequestHeader('X-Trestle-Dialog', true)
|
42
|
-
})
|
43
|
-
|
44
|
-
return $el
|
45
|
-
}
|
46
|
-
|
47
|
-
export function showError (title, errorText) {
|
48
|
-
const dialog = new Dialog({ modalClass: 'modal-lg' })
|
49
|
-
|
50
|
-
dialog.showError(title, $('<pre>').addClass('exception').text(errorText))
|
51
|
-
dialog.show()
|
52
|
-
|
53
|
-
return dialog
|
54
|
-
}
|
55
|
-
|
56
|
-
export default class Dialog {
|
57
|
-
constructor (options = {}) {
|
58
|
-
this.options = options
|
59
|
-
this.$el = createElement()
|
60
|
-
|
61
|
-
if (options.modalClass) {
|
62
|
-
this.$el.find('.modal-dialog').addClass(options.modalClass)
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
load (url, callback) {
|
67
|
-
this.show()
|
68
|
-
this.setLoading(true)
|
69
|
-
|
70
|
-
$.ajax({
|
71
|
-
url: url,
|
72
|
-
dataType: 'html',
|
73
|
-
headers: {
|
74
|
-
'X-Trestle-Dialog': true
|
75
|
-
},
|
76
|
-
complete: () => {
|
77
|
-
this.setLoading(false)
|
78
|
-
},
|
79
|
-
success: (content) => {
|
80
|
-
this.setContent(content)
|
81
|
-
|
82
|
-
if (callback) {
|
83
|
-
callback.apply(this)
|
84
|
-
}
|
85
|
-
},
|
86
|
-
error: (xhr, status, error) => {
|
87
|
-
const errorMessage = i18n['trestle.dialog.error'] || 'The request could not be completed.'
|
88
|
-
|
89
|
-
const title = error || errorMessage
|
90
|
-
const content = $('<p>').text(errorMessage)
|
91
|
-
|
92
|
-
this.showError(title, content)
|
93
|
-
}
|
94
|
-
})
|
95
|
-
}
|
96
|
-
|
97
|
-
setLoading (loading) {
|
98
|
-
this.$el.toggleClass('loading', loading)
|
99
|
-
}
|
100
|
-
|
101
|
-
setContent (content) {
|
102
|
-
this.$el.find('.modal-content').html(content)
|
103
|
-
triggerInit(this.$el)
|
104
|
-
}
|
105
|
-
|
106
|
-
showError (title, content) {
|
107
|
-
this.$el.addClass('error')
|
108
|
-
|
109
|
-
this.setContent(`
|
110
|
-
<div class="modal-header">
|
111
|
-
<h4 class="modal-title">${title}</h4>
|
112
|
-
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
113
|
-
</div>
|
114
|
-
|
115
|
-
<div class="modal-body">
|
116
|
-
${content.prop('outerHTML')}
|
117
|
-
</div>
|
118
|
-
|
119
|
-
<div class="modal-footer">
|
120
|
-
<button type="button" class="btn btn-light" data-dismiss="modal" aria-label="OK">${i18n['admin.buttons.ok'] || 'OK'}</button>
|
121
|
-
</div>`)
|
122
|
-
}
|
123
|
-
|
124
|
-
show () {
|
125
|
-
this.$el.modal('show')
|
126
|
-
|
127
|
-
// Background any existing visible modals
|
128
|
-
this.$el.prevAll('.modal.show').addClass('background')
|
129
|
-
}
|
130
|
-
|
131
|
-
hide () {
|
132
|
-
this.$el.modal('hide')
|
133
|
-
}
|
134
|
-
}
|
135
|
-
|
136
|
-
// Expose showError as Trestle.Dialog.showError
|
137
|
-
Dialog.showError = showError
|
138
|
-
|
139
|
-
$(document).on('click', '[data-behavior="dialog"]', function (e) {
|
140
|
-
e.preventDefault()
|
141
|
-
|
142
|
-
const url = $(this).data('url') || $(this).attr('href')
|
143
|
-
|
144
|
-
const dialog = new Dialog({
|
145
|
-
modalClass: $(this).data('dialog-class')
|
146
|
-
})
|
147
|
-
|
148
|
-
dialog.load(url)
|
149
|
-
})
|
@@ -1,100 +0,0 @@
|
|
1
|
-
/* global history */
|
2
|
-
|
3
|
-
import $ from 'jquery'
|
4
|
-
|
5
|
-
import { init, triggerInit } from '../core/events'
|
6
|
-
import { refreshMainContext } from '../core/contexts'
|
7
|
-
|
8
|
-
import { focusActiveTab } from './tabs'
|
9
|
-
import { showError } from './dialog'
|
10
|
-
|
11
|
-
const FORM_SELECTOR = 'form[data-behavior="trestle-form"]'
|
12
|
-
|
13
|
-
// Prevent enter key from submitting the form
|
14
|
-
$(document).on('keypress', `${FORM_SELECTOR} :input:not(textarea):not([type=submit])`, function (e) {
|
15
|
-
if (e.keyCode === 13) {
|
16
|
-
e.preventDefault()
|
17
|
-
}
|
18
|
-
})
|
19
|
-
|
20
|
-
init(function (root) {
|
21
|
-
const $form = $(root).find(FORM_SELECTOR)
|
22
|
-
|
23
|
-
$form
|
24
|
-
.on('ajax:send', function (e) {
|
25
|
-
// Only run when triggered directly on form
|
26
|
-
if (e.target !== this) return
|
27
|
-
|
28
|
-
// Disable submit buttons
|
29
|
-
$(this).find(':submit').prop('disabled', true)
|
30
|
-
|
31
|
-
// Set loading status on button that triggered submission
|
32
|
-
const button = $(this).data('trestle:submitButton')
|
33
|
-
if (button) { $(button).addClass('loading') }
|
34
|
-
})
|
35
|
-
.on('ajax:complete', function (e) {
|
36
|
-
// Only run when triggered directly on form
|
37
|
-
if (e.target !== this) return
|
38
|
-
|
39
|
-
const xhr = e.detail[0]
|
40
|
-
|
41
|
-
// Reset submit buttons
|
42
|
-
$(this).find(':submit').prop('disabled', false).removeClass('loading')
|
43
|
-
$(this).removeData('trestle:submitButton')
|
44
|
-
|
45
|
-
const contentType = (xhr.getResponseHeader('Content-Type') || '').split(';')[0]
|
46
|
-
|
47
|
-
if (contentType === 'text/html') {
|
48
|
-
if (/<html/i.test(xhr.responseText)) {
|
49
|
-
// Response is a full HTML page, likely an error page. Render within an iframe.
|
50
|
-
const $context = $(this).closest('[data-context]')
|
51
|
-
const iframe = $('<iframe>').addClass('error-iframe').get(0)
|
52
|
-
$context.html(iframe)
|
53
|
-
|
54
|
-
iframe.contentWindow.document.documentElement.innerHTML = xhr.responseText
|
55
|
-
} else {
|
56
|
-
// Find the parent context and replace content
|
57
|
-
const $context = $(this).closest('[data-context]')
|
58
|
-
$context.html(xhr.responseText)
|
59
|
-
|
60
|
-
// Initialize replaced elements within the context
|
61
|
-
triggerInit($context)
|
62
|
-
|
63
|
-
// Focus the correct tab
|
64
|
-
focusActiveTab()
|
65
|
-
}
|
66
|
-
} else if (contentType === 'text/plain') {
|
67
|
-
// Assume an error response
|
68
|
-
const title = `${xhr.status} (${xhr.statusText})`
|
69
|
-
showError(title, xhr.responseText)
|
70
|
-
}
|
71
|
-
})
|
72
|
-
.on('ajax:success', function (e) {
|
73
|
-
// Only run when triggered directly on form
|
74
|
-
if (e.target !== this) return
|
75
|
-
|
76
|
-
const xhr = e.detail[2]
|
77
|
-
|
78
|
-
const $context = $(this).closest('[data-context]')
|
79
|
-
let location = xhr.getResponseHeader('X-Trestle-Location')
|
80
|
-
|
81
|
-
if (location) {
|
82
|
-
// Retain current active tab
|
83
|
-
location = location + document.location.hash
|
84
|
-
|
85
|
-
// Update the URL in the browser and context
|
86
|
-
history.replaceState({}, '', location)
|
87
|
-
$context.data('context', location)
|
88
|
-
}
|
89
|
-
|
90
|
-
// Refresh the main context
|
91
|
-
if (!$context.hasClass('app-main')) {
|
92
|
-
refreshMainContext()
|
93
|
-
}
|
94
|
-
})
|
95
|
-
|
96
|
-
$form.find(':submit').click(function () {
|
97
|
-
// Save this as the button that triggered the form
|
98
|
-
$(this).closest('form').data('trestle:submitButton', this)
|
99
|
-
})
|
100
|
-
})
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import $ from 'jquery'
|
2
|
-
|
3
|
-
import { init } from '../core/events'
|
4
|
-
|
5
|
-
init(function (root) {
|
6
|
-
$(root).find('[data-behavior~="zoom"]').magnificPopup({
|
7
|
-
type: 'image',
|
8
|
-
closeOnContentClick: false,
|
9
|
-
closeBtnInside: false,
|
10
|
-
mainClass: 'mfp-with-zoom mfp-img-mobile',
|
11
|
-
zoom: {
|
12
|
-
enabled: true,
|
13
|
-
duration: 150
|
14
|
-
}
|
15
|
-
})
|
16
|
-
|
17
|
-
$(root).find('[data-behavior~="gallery"]').each(function () {
|
18
|
-
$(this).magnificPopup({
|
19
|
-
delegate: 'a',
|
20
|
-
type: 'image',
|
21
|
-
closeOnContentClick: false,
|
22
|
-
closeBtnInside: false,
|
23
|
-
mainClass: 'mfp-with-zoom mfp-img-mobile',
|
24
|
-
gallery: {
|
25
|
-
enabled: true
|
26
|
-
},
|
27
|
-
zoom: {
|
28
|
-
enabled: true,
|
29
|
-
duration: 150
|
30
|
-
}
|
31
|
-
})
|
32
|
-
})
|
33
|
-
})
|
@@ -1,51 +0,0 @@
|
|
1
|
-
/* global history */
|
2
|
-
|
3
|
-
import $ from 'jquery'
|
4
|
-
|
5
|
-
import { triggerInit } from '../core/events'
|
6
|
-
|
7
|
-
const REMOTE_PAGINATION_SELECTOR = '.page-link[data-remote]'
|
8
|
-
|
9
|
-
$(document)
|
10
|
-
.on('ajax:send', function (e) {
|
11
|
-
const $context = $(e.target).closest('[data-context]')
|
12
|
-
const $table = $context.find('.table-container')
|
13
|
-
$table.addClass('loading')
|
14
|
-
})
|
15
|
-
|
16
|
-
.on('ajax:complete', function (e) {
|
17
|
-
const $context = $(e.target).closest('[data-context]')
|
18
|
-
const $table = $context.find('.table-container')
|
19
|
-
$table.removeClass('loading')
|
20
|
-
})
|
21
|
-
|
22
|
-
.on('ajax:success', REMOTE_PAGINATION_SELECTOR, function (e) {
|
23
|
-
const $link = $(e.target)
|
24
|
-
const $context = $link.closest('[data-context]')
|
25
|
-
|
26
|
-
// Update table and pagination
|
27
|
-
const $doc = $(e.detail[0])
|
28
|
-
|
29
|
-
const $table = $doc.find('.table-container')
|
30
|
-
$context.find('.table-container').replaceWith($table)
|
31
|
-
|
32
|
-
triggerInit($table)
|
33
|
-
|
34
|
-
const $pagination = $doc.find('.pagination-container')
|
35
|
-
$context.find('.pagination-container').replaceWith($pagination)
|
36
|
-
|
37
|
-
// Update the URL in the browser and context
|
38
|
-
const location = $link.attr('href')
|
39
|
-
|
40
|
-
if (location) {
|
41
|
-
// TODO: Implement URL updating with back button support
|
42
|
-
// if ($context.hasClass('app-main')) {
|
43
|
-
// history.pushState({}, '', location)
|
44
|
-
// }
|
45
|
-
|
46
|
-
$context.data('context', location)
|
47
|
-
}
|
48
|
-
|
49
|
-
// Scroll to top of table
|
50
|
-
$table[0].scrollIntoView(true)
|
51
|
-
})
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import $ from 'jquery'
|
2
|
-
|
3
|
-
import { init } from '../core/events'
|
4
|
-
|
5
|
-
// Use Bootstrap theme
|
6
|
-
$.fn.select2.defaults.set('theme', 'bootstrap')
|
7
|
-
|
8
|
-
// Copy all classes from select tag to replacement select field (.select2-selection)
|
9
|
-
$.fn.select2.defaults.set('containerCssClass', ':all:')
|
10
|
-
|
11
|
-
// Copy all classes excluding 'form-control'/'form-control-*' from select tag to dropdown container (.select2-dropdown)
|
12
|
-
$.fn.select2.defaults.set('dropdownCssClass', function (el) {
|
13
|
-
return el[0].className.replace(/\s*form-control(-\w+)?\s*/g, '')
|
14
|
-
})
|
15
|
-
|
16
|
-
init(function (root) {
|
17
|
-
$(root).find('select[data-enable-select2]').select2()
|
18
|
-
})
|