diff --git a/app/controllers/submission_events_controller.rb b/app/controllers/submission_events_controller.rb index 0dad2336..b3b892f1 100644 --- a/app/controllers/submission_events_controller.rb +++ b/app/controllers/submission_events_controller.rb @@ -24,5 +24,7 @@ class SubmissionEventsController < ApplicationController load_and_authorize_resource :submission - def index; end + def index + render :index, layout: 'plain' + end end diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index 31e568e2..96ae4972 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -33,6 +33,8 @@ class SubmissionsController < ApplicationController def new authorize!(:new, Submission) + + render :new, layout: 'plain' end def create diff --git a/app/controllers/submitters_controller.rb b/app/controllers/submitters_controller.rb index 7a40101f..48610854 100644 --- a/app/controllers/submitters_controller.rb +++ b/app/controllers/submitters_controller.rb @@ -8,6 +8,8 @@ class SubmittersController < ApplicationController if @submitter.preferences['email_message_uuid'].present? @submitter.account.email_messages.find_by(uuid: @submitter.preferences['email_message_uuid']) end + + render :edit, layout: 'plain' end def update diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index b0d3446f..c45fe6cd 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -25,7 +25,9 @@ class TemplatesController < ApplicationController redirect_to root_path end - def new; end + def new + render :new, layout: 'plain' + end def edit @template_data = Templates.serialize_for_builder(@template) diff --git a/app/controllers/templates_preferences_controller.rb b/app/controllers/templates_preferences_controller.rb index b49202d0..449a58c6 100644 --- a/app/controllers/templates_preferences_controller.rb +++ b/app/controllers/templates_preferences_controller.rb @@ -14,7 +14,9 @@ class TemplatesPreferencesController < ApplicationController completed_notification_email_body] }.freeze - def show; end + def show + render :show, layout: 'plain' + end def create authorize!(:update, @template) diff --git a/app/controllers/templates_share_link_controller.rb b/app/controllers/templates_share_link_controller.rb index 5dfed111..8600ce95 100644 --- a/app/controllers/templates_share_link_controller.rb +++ b/app/controllers/templates_share_link_controller.rb @@ -3,7 +3,9 @@ class TemplatesShareLinkController < ApplicationController load_and_authorize_resource :template - def show; end + def show + render :show, layout: 'plain' + end def create authorize!(:update, @template) diff --git a/app/javascript/application.js b/app/javascript/application.js index 0bcc7418..9e14ff9b 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -57,7 +57,8 @@ import BarChart from './elements/bar_chart' import FieldCondition from './elements/field_condition' import ConfirmUpload from './elements/confirm_upload' import ScrollFade from './elements/scroll_fade' -import ConvertModalLinks from './elements/convert_modal_links' +import OpenModalMobile from './elements/open_modal_mobile' +import HistoryBack from './elements/history_back' import * as TurboInstantClick from './lib/turbo_instant_click' @@ -153,7 +154,8 @@ safeRegisterElement('bar-chart', BarChart) safeRegisterElement('field-condition', FieldCondition) safeRegisterElement('confirm-upload', ConfirmUpload) safeRegisterElement('scroll-fade', ScrollFade) -safeRegisterElement('convert-modal-links', ConvertModalLinks) +safeRegisterElement('open-modal-mobile', OpenModalMobile) +safeRegisterElement('history-back', HistoryBack) safeRegisterElement('template-builder', class extends HTMLElement { connectedCallback () { diff --git a/app/javascript/elements/history_back.js b/app/javascript/elements/history_back.js new file mode 100644 index 00000000..3c44ad61 --- /dev/null +++ b/app/javascript/elements/history_back.js @@ -0,0 +1,15 @@ +export default class extends HTMLElement { + connectedCallback () { + this.addEventListener('click', this.onClick) + } + + disconnectedCallback () { + this.removeEventListener('click', this.onClick) + } + + onClick = (e) => { + e.preventDefault() + + window.history.back() + } +} diff --git a/app/javascript/elements/convert_modal_links.js b/app/javascript/elements/open_modal_mobile.js similarity index 77% rename from app/javascript/elements/convert_modal_links.js rename to app/javascript/elements/open_modal_mobile.js index b31e3108..a9d45ed4 100644 --- a/app/javascript/elements/convert_modal_links.js +++ b/app/javascript/elements/open_modal_mobile.js @@ -1,8 +1,9 @@ export default class extends HTMLElement { connectedCallback () { if (!this.isMobile()) return + if (window.innerWidth >= 768) return - document.querySelectorAll('a[data-turbo-frame="modal"]').forEach((link) => { + this.querySelectorAll('a[data-turbo-frame]').forEach((link) => { link.dataset.turboFrame = '_top' }) } diff --git a/app/javascript/elements/turbo_modal.js b/app/javascript/elements/turbo_modal.js index 7642386c..89460ee6 100644 --- a/app/javascript/elements/turbo_modal.js +++ b/app/javascript/elements/turbo_modal.js @@ -42,10 +42,6 @@ export default actionable(class extends HTMLElement { close = (e) => { e?.preventDefault() - if (!this.closest('turbo-frame')?.src && window.history.length > 1) { - window.history.back() - } else { - this.remove() - } + this.remove() } }) diff --git a/app/javascript/template_builder/builder.vue b/app/javascript/template_builder/builder.vue index 5b0546af..8dd2208f 100644 --- a/app/javascript/template_builder/builder.vue +++ b/app/javascript/template_builder/builder.vue @@ -164,7 +164,7 @@ v-if="withSendButton" id="send_button" :href="`/templates/${template.id}/submissions/new?with_link=true`" - data-turbo-frame="modal" + :data-turbo-frame="isMobile && isBreakpointLg ? '_top' : 'modal'" class="white-button md:!px-6" @click="maybeShowErrorTemplateAlert" > @@ -229,7 +229,7 @@
  • diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index cb372271..09cfb218 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -27,7 +27,6 @@ <% end %> <% end %> - <%= render 'shared/navbar' %> <% if flash.present? %><%= render 'shared/flash' %><% end %> diff --git a/app/views/shared/_turbo_modal_large.html.erb b/app/views/shared/_turbo_modal_large.html.erb index d929519c..4c42fe56 100644 --- a/app/views/shared/_turbo_modal_large.html.erb +++ b/app/views/shared/_turbo_modal_large.html.erb @@ -1,18 +1,34 @@ - - -
    -
    - <% if local_assigns[:title] %> -
    - - <%= local_assigns[:title] %> - - × +<% if turbo_frame_request? %> + + +
    +
    + <% if local_assigns[:title] %> +
    + + <%= local_assigns[:title] %> + + × +
    + <% end %> +
    + <%= yield %>
    - <% end %> -
    - <%= yield %>
    + + +<% else %> + <% if local_assigns[:title] %> +
    + + <%= local_assigns[:title] %> + + + × +
    - - + <% end %> +
    + <%= yield %> +
    +<% end %> diff --git a/app/views/submissions/show.html.erb b/app/views/submissions/show.html.erb index 95edc4e7..809a1828 100644 --- a/app/views/submissions/show.html.erb +++ b/app/views/submissions/show.html.erb @@ -25,10 +25,12 @@ <% elsif signed_in? %> - <%= link_to submission_events_path(@submission), class: 'white-button', data: { turbo_frame: :modal } do %> - <%= svg_icon('logs', class: 'w-6 h-6') %> - - <% end %> + + <%= link_to submission_events_path(@submission), class: 'white-button', data: { turbo_frame: :modal } do %> + <%= svg_icon('logs', class: 'w-6 h-6') %> + + <% end %> + <% end %> <% if signed_in? && !@submission.completed_at? && can?(:manage, :resend_all) && @submission.submitters.to_a.size > 3 && !@submission.archived_at? && !@submission.template&.archived_at? && !@submission.expired? && can?(:update, @submission) %> <% pending_submitters_count = @submission.submitters.to_a.count { |s| !s.completed_at? && s.email.present? && !s.declined_at? } %> @@ -181,9 +183,11 @@
    <% if signed_in? && can?(:update, @submission) && submitter && !submitter.completed_at? && !@submission.completed_at? && !submitter.declined_at? && !@submission.archived_at? && !@submission.template&.archived_at? && !@submission.expired? && !submitter.start_form_submission_events.any? %> - <%= link_to edit_submitter_path(submitter), class: 'shrink-0 inline md:hidden md:group-hover:inline', data: { turbo_frame: 'modal' } do %> - <%= svg_icon('pencil', class: 'w-5 h-5') %> - <% end %> + + <%= link_to edit_submitter_path(submitter), class: 'shrink-0 inline md:hidden md:group-hover:inline', data: { turbo_frame: 'modal' } do %> + <%= svg_icon('pencil', class: 'w-5 h-5') %> + <% end %> + <% end %>
    diff --git a/app/views/submissions_dashboard/index.html.erb b/app/views/submissions_dashboard/index.html.erb index dc7580c2..5b8a0a71 100644 --- a/app/views/submissions_dashboard/index.html.erb +++ b/app/views/submissions_dashboard/index.html.erb @@ -18,10 +18,12 @@ - <%= link_to new_template_path, class: 'white-button !border gap-2', data: { turbo_frame: :modal } do %> - <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %> - - <% end %> + + <%= link_to new_template_path, class: 'white-button !border gap-2', data: { turbo_frame: :modal } do %> + <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %> + + <% end %> + <% end %>
    diff --git a/app/views/template_folders/show.html.erb b/app/views/template_folders/show.html.erb index 9120dc92..d5557117 100644 --- a/app/views/template_folders/show.html.erb +++ b/app/views/template_folders/show.html.erb @@ -37,10 +37,12 @@ - <%= link_to new_template_path(folder_name: @template_folder.full_name), class: 'white-button !border gap-2', data: { turbo_frame: :modal } do %> - <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %> - - <% end %> + + <%= link_to new_template_path(folder_name: @template_folder.full_name), class: 'white-button !border gap-2', data: { turbo_frame: :modal } do %> + <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %> + + <% end %> + <% end %> diff --git a/app/views/templates/_submission.html.erb b/app/views/templates/_submission.html.erb index e0a7acab..278bd679 100644 --- a/app/views/templates/_submission.html.erb +++ b/app/views/templates/_submission.html.erb @@ -53,9 +53,11 @@ <% if !submitter.completed_at? && !submission.completed_at? && can?(:update, submission) && !submitter.start_form_submission_events.any? && !submission.archived_at? && !submission.expired? && !submitter.declined_at? %> - <%= link_to edit_submitter_path(submitter), class: 'shrink-0', data: { turbo_frame: 'modal' } do %> - <%= svg_icon('pencil', class: 'w-5 h-5') %> - <% end %> + + <%= link_to edit_submitter_path(submitter), class: 'shrink-0', data: { turbo_frame: 'modal' } do %> + <%= svg_icon('pencil', class: 'w-5 h-5') %> + <% end %> + <% end %> @@ -146,9 +148,11 @@ <% if !submitter.completed_at? && !submission.completed_at? && can?(:update, submission) && !submitter.start_form_submission_events.any? && !submission.archived_at? && !submission.expired? && !submitter.declined_at? %> - <%= link_to edit_submitter_path(submitter), class: 'shrink-0', data: { turbo_frame: 'modal' } do %> - <%= svg_icon('pencil', class: 'w-5 h-5') %> - <% end %> + + <%= link_to edit_submitter_path(submitter), class: 'shrink-0', data: { turbo_frame: 'modal' } do %> + <%= svg_icon('pencil', class: 'w-5 h-5') %> + <% end %> + <% end %> diff --git a/app/views/templates/_title.html.erb b/app/views/templates/_title.html.erb index 0ec43e7e..76b1a5f9 100644 --- a/app/views/templates/_title.html.erb +++ b/app/views/templates/_title.html.erb @@ -52,12 +52,14 @@ <% end %> <% end %> - <%= link_to template_share_link_path(template), class: 'absolute md:relative bottom-0 right-0 btn btn-xs md:btn-sm whitespace-nowrap btn-neutral text-white mt-1 px-2', data: { turbo_frame: :modal } do %> - - <%= svg_icon('link', class: 'w-4 h-4 md:w-6 md:h-6') %> - <%= t('link') %> - - <% end %> + + <%= link_to template_share_link_path(template), class: 'btn btn-xs md:btn-sm whitespace-nowrap btn-neutral text-white px-2', data: { turbo_frame: :modal } do %> + + <%= svg_icon('link', class: 'w-4 h-4 md:w-6 md:h-6') %> + <%= t('link') %> + + <% end %> + <% end %> diff --git a/app/views/templates/show.html.erb b/app/views/templates/show.html.erb index 541c37ba..500b11f0 100644 --- a/app/views/templates/show.html.erb +++ b/app/views/templates/show.html.erb @@ -18,10 +18,12 @@ <%= t('export') %> <% end %> <% if !@template.archived_at? && can?(:create, Submission) %> - <%= link_to new_template_submission_path(@template), id: 'add_recipients_button', class: 'white-button !border', data: { turbo_frame: 'modal' } do %> - <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %> - <%= t('add_recipients_html') %> - <% end %> + + <%= link_to new_template_submission_path(@template), id: 'add_recipients_button', class: 'white-button !border', data: { turbo_frame: 'modal' } do %> + <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %> + <%= t('add_recipients_html') %> + <% end %> + <% end %> diff --git a/app/views/templates_dashboard/index.html.erb b/app/views/templates_dashboard/index.html.erb index 887a9f84..8ab97431 100644 --- a/app/views/templates_dashboard/index.html.erb +++ b/app/views/templates_dashboard/index.html.erb @@ -30,10 +30,12 @@ - <%= link_to new_template_path, class: 'white-button !border gap-2', data: { turbo_frame: :modal } do %> - <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %> - - <% end %> + + <%= link_to new_template_path, class: 'white-button !border gap-2', data: { turbo_frame: :modal } do %> + <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %> + + <% end %> + <% end %>