diff --git a/app/javascript/elements/native_action.js b/app/javascript/elements/native_action.js index 912763a39..3e491665a 100644 --- a/app/javascript/elements/native_action.js +++ b/app/javascript/elements/native_action.js @@ -8,18 +8,23 @@ export default class extends HTMLElement { const target = this.querySelector('a, button, [role="button"]') || this.firstElementChild - if (!target) return + if (!target && !this.dataset.native) return this.nativeId ||= `native-action-${++counter}` - target.dataset.nativeId = this.nativeId + + if (target) target.dataset.nativeId = this.nativeId bridge.postMessage({ type: 'action', op: 'add', id: this.nativeId, - title: this.dataset.label || target.textContent.trim(), + title: this.dataset.label || target?.textContent.trim(), icon: this.dataset.icon, - placement: this.dataset.placement || 'menu' + placement: this.dataset.placement || 'menu', + native: this.dataset.native, + url: this.dataset.url, + accept: this.dataset.accept, + destructive: this.dataset.destructive === 'true' }) } diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2a434c25a..2f74d1427 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -28,7 +28,7 @@ <% end %> - <%= render 'shared/navbar' unless turbo_native_app? %> + <%= render turbo_native_app? ? 'shared/native_navbar' : 'shared/navbar' %> <% if flash.present? %><%= render 'shared/flash' %><% end %>
<%= yield %> diff --git a/app/views/shared/_native_navbar.html.erb b/app/views/shared/_native_navbar.html.erb new file mode 100644 index 000000000..7e02302fb --- /dev/null +++ b/app/views/shared/_native_navbar.html.erb @@ -0,0 +1,21 @@ +<% if signed_in? %> + + <%= link_to t('profile'), settings_profile_index_path %> + + + <%= link_to t('settings'), settings_path %> + + + <% if can?(:create, ::Template) %> + "> + + <% if Docuseal.multitenant? %> + + <%= link_to 'Google Drive', new_template_path(modal_tab: 'google_drive'), data: { turbo_frame: :modal } %> + + <% end %> + + <%= link_to t('create'), new_template_path, data: { turbo_frame: :modal } %> + + <% end %> +<% end %> diff --git a/app/views/submissions_dashboard/index.html.erb b/app/views/submissions_dashboard/index.html.erb index 803261792..c653f660d 100644 --- a/app/views/submissions_dashboard/index.html.erb +++ b/app/views/submissions_dashboard/index.html.erb @@ -32,7 +32,9 @@ <% view_archived_html = capture do %> <% if can?(:manage, :countless) || current_account.submissions.archived.exists? || current_account.templates.where(Submission.where(Submission.arel_table[:template_id].eq(::Template.arel_table[:id])).arel.exists).archived.exists? %>
- <%= t('view_archived') %> + + <%= t('view_archived') %> +
<% end %> <% end %> diff --git a/app/views/templates_dashboard/index.html.erb b/app/views/templates_dashboard/index.html.erb index d11a120b0..700eb270d 100644 --- a/app/views/templates_dashboard/index.html.erb +++ b/app/views/templates_dashboard/index.html.erb @@ -44,7 +44,9 @@ <% view_archived_html = capture do %> <% if has_archived %>
- <%= t('view_archived') %> + + <%= t('view_archived') %> +
<% end %> <% end %>