From 1f46f744001e05c9fd4328d0430a2f5198222043 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Fri, 18 Sep 2026 15:56:29 +0300 Subject: [PATCH] adjust modal title --- app/javascript/elements/native_bridge.js | 28 +++++++++---------- app/views/submissions/show.html.erb | 2 +- .../_applied_filters.html.erb | 18 ++++++------ app/views/templates/_submission.html.erb | 4 +-- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/app/javascript/elements/native_bridge.js b/app/javascript/elements/native_bridge.js index a4369b6a7..3b290bd84 100644 --- a/app/javascript/elements/native_bridge.js +++ b/app/javascript/elements/native_bridge.js @@ -34,6 +34,20 @@ if (handlers?.native && window === window.top) { reportPageFlash() + document.addEventListener('click', (event) => { + const link = event.target.closest?.('a[href]') + + if (!link) return + + const title = link.dataset.nativeTitle || link.getAttribute('aria-label') || link.closest('[data-native-title]')?.dataset.nativeTitle || link.innerText.trim() + + if (!title) return + + const actions = link.closest('[data-native-actions]')?.dataset.nativeActions + + handlers.native.postMessage({ type: 'title', url: link.href, title, actions: actions ? actions.split(',') : null }) + }, true) + document.addEventListener('click', (event) => { if (document.querySelector('native-modal')) return @@ -47,20 +61,6 @@ if (handlers?.native && window === window.top) { handlers.modal.postMessage({ action: 'open', url: link.href, modal: link.closest('[data-native-modal]')?.dataset.nativeModal || '' }) }, true) - document.addEventListener('click', (event) => { - const link = event.target.closest?.('a[href]') - - if (!link) return - - const title = link.dataset.nativeTitle || link.closest('[data-native-title]')?.dataset.nativeTitle || link.innerText.trim() - - if (!title) return - - const actions = link.closest('[data-native-actions]')?.dataset.nativeActions - - handlers.native.postMessage({ type: 'title', url: link.href, title, actions: actions ? actions.split(',') : null }) - }, true) - document.addEventListener('native:action', (event) => { document.querySelector(`[data-native-id="${event.detail.id}"]`)?.click() }) diff --git a/app/views/submissions/show.html.erb b/app/views/submissions/show.html.erb index 0b5840063..2e38b403a 100644 --- a/app/views/submissions/show.html.erb +++ b/app/views/submissions/show.html.erb @@ -211,7 +211,7 @@ <% 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', native_modal: 'medium' } do %> + <%= link_to edit_submitter_path(submitter), class: 'shrink-0 inline md:hidden md:group-hover:inline', data: { turbo_frame: 'modal', native_modal: 'medium' }, aria: { label: t('edit_recipient') } do %> <%= svg_icon('pencil', class: 'w-5 h-5') %> <% end %> diff --git a/app/views/submissions_filters/_applied_filters.html.erb b/app/views/submissions_filters/_applied_filters.html.erb index 63fcf4b92..36037dc01 100644 --- a/app/views/submissions_filters/_applied_filters.html.erb +++ b/app/views/submissions_filters/_applied_filters.html.erb @@ -11,7 +11,7 @@ <% status_chip_html = capture do %> <% if status_icon || default_status_icon %>
- <%= link_to submissions_filter_path('status', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal', native_modal: 'medium', native_title: t('status') }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %> + <%= link_to submissions_filter_path('status', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal', native_modal: 'medium' }, aria: { label: t('status') }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %> <%= svg_icon(status_icon || default_status_icon, class: 'w-5 h-5 shrink-0') %> <%= t(params[:status]) %> <% end %> @@ -46,7 +46,7 @@ <% end %> <% if params[:folder].present? %>
- <%= link_to submissions_filter_path('folder', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal', native_modal: 'medium', native_title: t('folder') }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %> + <%= link_to submissions_filter_path('folder', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal', native_modal: 'medium' }, aria: { label: t('folder') }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %> <%= svg_icon('folder', class: 'w-5 h-5 shrink-0') %> <%= params[:folder] %> <% end %> @@ -57,7 +57,7 @@ <% end %> <% if params[:author].present? %>
- <%= link_to submissions_filter_path('author', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal', native_modal: 'medium', native_title: t('author') }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %> + <%= link_to submissions_filter_path('author', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal', native_modal: 'medium' }, aria: { label: t('author') }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %> <%= svg_icon('user', class: 'w-5 h-5 shrink-0') %> <%= current_account.users.accessible_by(current_ability).where(account: current_account).find_by(email: params[:author])&.full_name || 'NA' %> <% end %> @@ -68,7 +68,7 @@ <% end %> <% if query_params[:completed_at_from].present? || query_params[:completed_at_to].present? %>
- <%= link_to submissions_filter_path('completed_at', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal', native_modal: 'medium', native_title: t('completed_at') }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %> + <%= link_to submissions_filter_path('completed_at', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal', native_modal: 'medium' }, aria: { label: t('completed_at') }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %> <%= svg_icon('calendar_check', class: 'w-5 h-5 shrink-0') %> <% if query_params[:completed_at_from] == query_params[:completed_at_to] %> @@ -86,7 +86,7 @@ <% end %> <% if query_params[:created_at_from].present? || query_params[:created_at_to].present? %>
- <%= link_to submissions_filter_path('created_at', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal', native_modal: 'medium', native_title: t('created_at') }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %> + <%= link_to submissions_filter_path('created_at', query_params.merge(path: url_for, with_remove: true)), data: { turbo_frame: 'modal', native_modal: 'medium' }, aria: { label: t('created_at') }, class: 'flex items-center space-x-1 flex-1 min-w-0 pr-1' do %> <%= svg_icon('calendar', class: 'w-5 h-5 shrink-0') %> <% if query_params[:created_at_from] == query_params[:created_at_to] %> @@ -114,7 +114,7 @@