adjust nav

This commit is contained in:
Pete Matsyburka committed 2026-09-23 10:59:54 +03:00
1 parent 44972fcc39
commit 073859a4b7
17 files changed
+287 -72

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
<% uuid = local_assigns[:uuid] || SecureRandom.uuid %>
<% title_id = "#{uuid}-title" %>
<%= tag.dialog id: uuid, class: 'modal items-start overflow-y-auto', inert: true, 'aria-labelledby': (title_id if local_assigns[:title]) do %>
<div class="modal-box pt-4 pb-6 px-6 mt-20 max-h-none">
<div class="modal-box pt-4 pb-6 px-6 <%= turbo_native_app? ? 'mt-32' : 'mt-20' %> max-h-none">
<% if local_assigns[:title] %>
<div class="flex justify-between items-center border-b pb-2 mb-2 font-medium">
<span id="<%= title_id %>">
+5
View File
@@ -5,6 +5,11 @@
<native-action data-placement="profile" data-icon="settings">
<%= link_to t('settings'), settings_path %>
</native-action>
<% if current_account.testing? && (can?(:manage, EncryptedConfig) || current_user != true_user) %>
<native-action data-placement="test_mode" data-icon="code" data-label="<%= t('exit_test_mode') %>">
<%= button_to '', testing_account_path, method: :delete, form: { data: { turbo_action: 'replace' } } %>
</native-action>
<% end %>
<native-action data-placement="profile" data-icon="logout" data-native="sign_out" data-label="<%= t('sign_out') %>" data-destructive="true"></native-action>
<% if can?(:create, ::Template) && controller_name.in?(%w[templates_dashboard submissions_dashboard template_folders]) %>
<% folder_name = @template_folder&.full_name %>
+1 -1
View File
@@ -1,7 +1,7 @@
<% if turbo_native_app? && !turbo_frame_request? %>
<% content_for(:html_title, local_assigns[:title]) if local_assigns[:title] %>
<turbo-frame id="modal">
<native-modal class="block max-w-lg mx-auto px-4 pb-6" data-close-after-submit="<%= local_assigns.key?(:close_after_submit) ? local_assigns[:close_after_submit] : true %>">
<native-modal class="block max-w-lg mx-auto pb-6" data-close-after-submit="<%= local_assigns.key?(:close_after_submit) ? local_assigns[:close_after_submit] : true %>">
<%= yield %>
</native-modal>
</turbo-frame>
+4 -2
View File
@@ -11,8 +11,10 @@
<% with_signature_id_reason = configs.find { |e| e.key == AccountConfig::WITH_SIGNATURE_ID_REASON_KEY }&.value != false %>
<% with_signature_id_completed_at = configs.find { |e| e.key == AccountConfig::WITH_SIGNATURE_ID_COMPLETED_AT_KEY }&.value == true %>
<main style="max-width: 1600px" class="mx-auto pl-4">
<div class="flex justify-between items-center pr-4 sticky top-0 md:relative z-10 bg-base-100 <%= 'py-1.5' unless turbo_native_app? %>">
<% unless turbo_native_app? %>
<div class="flex justify-between items-center pr-4 <%= turbo_native_app? ? 'pb-3' : 'sticky top-0 md:relative z-10 bg-base-100 py-1.5' %>">
<% if turbo_native_app? %>
<h1 class="text-3xl font-semibold py-1" style="overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;"><% (@submission.name || @submission.template&.name).to_s.split(/(_)/).each do |item| %><%= item %><wbr><% end %></h1>
<% else %>
<a href="<%= signed_in? && @submission.account_id == current_account&.id && @submission.template ? template_path(@submission.template) : '/' %>" class="flex items-center space-x-3 py-1">
<span><%= render 'submissions/logo' %></span>
<h1 class="text-xl md:text-3xl font-semibold focus:text-clip" style="overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;"><% (@submission.name || @submission.template&.name).to_s.split(/(_)/).each do |item| %><%= item %><wbr><% end %></h1>
+1 -1
View File
@@ -8,6 +8,6 @@
<% if is_long %>
<%= svg_icon(icon, class: 'w-6 h-6 inline') %>
<% end %>
<native-title><%= folder.name %></native-title>
<%= folder.name %>
</div>
</a>
+93 -43
View File
@@ -5,11 +5,16 @@
<h1 class="text-3xl md:text-[2em] font-semibold" style="overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;">
<% template.name.split(/(_)/).each do |item| %><%= item %><wbr><% end %>
<% if template.archived_at? %>
<span class="ml-1 badge badge-outline badge-lg align-middle"><%= t('archived') %></span>
<span class="ml-1 badge badge-outline badge-lg align-middle hidden md:inline-flex"><%= t('archived') %></span>
<% end %>
</h1>
<%= render 'templates/access_icon', template: @template %>
</div>
<% if template.archived_at? %>
<div class="absolute -bottom-1 right-0 md:hidden">
<span class="badge badge-outline badge-lg"><%= t('archived') %></span>
</div>
<% end %>
<% if @template.account_id == current_account.id %>
<div class="flex items-center justify-between">
<div class="flex items-center">
@@ -44,17 +49,15 @@
<% if !template.archived_at? %>
<div class="flex items-center space-x-2">
<% if can?(:update, template) %>
<native-action data-label="<%= t('preferences') %>" data-icon="adjustments_horizontal" data-placement="bar">
<div class="tooltip tooltip-no-touch hidden md:block" data-tip="<%= t('preferences') %>">
<%= link_to template_preferences_path(template), class: 'btn border border-base-200 bg-base-200 hover:bg-base-300 hover:border-base-300 btn-sm flex-1 hidden md:flex', data: { turbo_frame: :modal } do %>
<span class="flex items-center justify-center space-x-2">
<%= svg_icon('adjustments_horizontal', class: 'w-6 h-6') %>
</span>
<% end %>
</div>
</native-action>
<div class="tooltip tooltip-no-touch hidden md:block" data-tip="<%= t('preferences') %>">
<%= link_to template_preferences_path(template), class: 'btn border border-base-200 bg-base-200 hover:bg-base-300 hover:border-base-300 btn-sm flex-1 hidden md:flex', data: { turbo_frame: :modal } do %>
<span class="flex items-center justify-center space-x-2">
<%= svg_icon('adjustments_horizontal', class: 'w-6 h-6') %>
</span>
<% end %>
</div>
<% end %>
<open-modal-mobile class="absolute md:relative bottom-0 right-0 mt-1">
<open-modal-mobile class="absolute md:relative -bottom-1 md:bottom-0 right-0 mt-1">
<%= 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 %>
<span class="flex items-center justify-center space-x-2">
<%= svg_icon('link', class: 'w-4 h-4 md:w-6 md:h-6') %>
@@ -65,35 +68,92 @@
</div>
<% end %>
</div>
<div class="flex flex-wrap gap-2 w-full md:w-fit md:justify-between md:flex-none md:pt-1">
<% if can?(:destroy, template) %>
<% if template.archived_at? %>
<%= button_to button_title(title: t('restore'), disabled_with: t('restoring')[..-4], icon: svg_icon('rotate', class: 'w-6 h-6')), template_restore_index_path(template), class: 'btn btn-outline btn-sm w-full', form_class: 'flex-1' %>
<% else %>
<%= button_to button_title(title: t('archive'), disabled_with: t('archiving')[..-4], title_class: 'inline', icon: svg_icon('archive', class: 'w-6 h-6')), template_path(template), class: 'btn btn-outline btn-sm w-full', form_class: 'flex-1', method: :delete %>
<% if turbo_native_app? %>
<% unless template.archived_at? %>
<% if can?(:create, Submission) %>
<native-action data-section="send" data-icon="send" data-label="<%= t('send') %>">
<a href="<%= new_template_submission_path(template) %>" data-turbo-frame="modal"></a>
</native-action>
<% end %>
<native-action data-section="send" data-icon="writing" data-label="<%= t('sign_yourself') %>">
<a href="<%= new_template_submission_path(template, selfsign: true) %>" data-turbo-frame="modal"></a>
</native-action>
<% end %>
<% if !template.archived_at? && can?(:update, template) %>
<native-action data-placement="bar" data-icon="pencil" data-label="<%= t('edit') %>">
<a href="<%= edit_template_path(template) %>"></a>
</native-action>
<native-action data-section="edit" data-icon="adjustments_horizontal" data-label="<%= t('preferences') %>">
<a href="<%= template_preferences_path(template) %>" data-turbo-frame="modal"></a>
</native-action>
<% end %>
<% if can?(:create, current_account.templates.new(author: current_user)) %>
<div class="flex-1">
<%= link_to new_template_clone_path(template), class: 'btn btn-outline btn-sm w-full', data: { turbo_frame: :modal } do %>
<span class="flex items-center justify-center space-x-2">
<%= svg_icon('copy', class: 'w-6 h-6') %>
<span class="inline"><%= t('clone') %></span>
</span>
<% end %>
</div>
<native-action data-section="edit" data-icon="copy" data-label="<%= t('clone') %>">
<a href="<%= new_template_clone_path(template) %>" data-turbo-frame="modal"></a>
</native-action>
<% end %>
<% if !template.archived_at? %>
<% if can?(:update, template) %>
<% if template.archived_at? || (!can?(:update, template) && can?(:read, template)) %>
<native-action data-section="edit" data-icon="file_text" data-label="<%= t('preview') %>">
<a href="<%= template_preview_path(template) %>"></a>
</native-action>
<% end %>
<% if local_assigns[:with_export] %>
<native-action data-section="edit" data-icon="download" data-label="<%= t('export') %>">
<a href="<%= new_template_submissions_export_path(template, params.permit(:q, *Submissions::Filter::ALLOWED_PARAMS)) %>" data-turbo-frame="modal"></a>
</native-action>
<% end %>
<% if can?(:destroy, template) %>
<% if template.archived_at? %>
<native-action data-section="archive" data-icon="rotate" data-label="<%= t('restore') %>">
<%= button_to '', template_restore_index_path(template) %>
</native-action>
<% else %>
<native-action data-section="archive" data-icon="archive" data-label="<%= t('archive') %>">
<%= button_to '', template_path(template), method: :delete %>
</native-action>
<% end %>
<% end %>
<% else %>
<div class="flex flex-wrap gap-2 w-full md:w-fit md:justify-between md:flex-none md:pt-1">
<% if can?(:destroy, template) %>
<% if template.archived_at? %>
<%= button_to button_title(title: t('restore'), disabled_with: t('restoring')[..-4], icon: svg_icon('rotate', class: 'w-6 h-6')), template_restore_index_path(template), class: 'btn btn-outline btn-sm w-full', form_class: 'flex-1' %>
<% else %>
<%= button_to button_title(title: t('archive'), disabled_with: t('archiving')[..-4], title_class: 'inline', icon: svg_icon('archive', class: 'w-6 h-6')), template_path(template), class: 'btn btn-outline btn-sm w-full', form_class: 'flex-1', method: :delete %>
<% end %>
<% end %>
<% if can?(:create, current_account.templates.new(author: current_user)) %>
<div class="flex-1">
<%= link_to edit_template_path(template), class: 'btn btn-outline btn-sm w-full' do %>
<%= link_to new_template_clone_path(template), class: 'btn btn-outline btn-sm w-full', data: { turbo_frame: :modal } do %>
<span class="flex items-center justify-center space-x-2">
<%= svg_icon('pencil', class: 'w-6 h-6') %>
<span><%= t('edit') %></span>
<%= svg_icon('copy', class: 'w-6 h-6') %>
<span class="inline"><%= t('clone') %></span>
</span>
<% end %>
</div>
<% elsif can?(:read, template) && !template.archived_at? %>
<% end %>
<% if !template.archived_at? %>
<% if can?(:update, template) %>
<div class="flex-1">
<%= link_to edit_template_path(template), class: 'btn btn-outline btn-sm w-full' do %>
<span class="flex items-center justify-center space-x-2">
<%= svg_icon('pencil', class: 'w-6 h-6') %>
<span><%= t('edit') %></span>
</span>
<% end %>
</div>
<% elsif can?(:read, template) && !template.archived_at? %>
<div class="flex-1">
<%= link_to template_preview_path(template), class: 'btn btn-outline btn-sm w-full' do %>
<span class="flex items-center justify-center space-x-2">
<%= svg_icon('file_text', class: 'w-6 h-6') %>
<span><%= t('preview') %></span>
</span>
<% end %>
</div>
<% end %>
<% end %>
<% if template.archived_at? %>
<div class="flex-1">
<%= link_to template_preview_path(template), class: 'btn btn-outline btn-sm w-full' do %>
<span class="flex items-center justify-center space-x-2">
@@ -103,16 +163,6 @@
<% end %>
</div>
<% end %>
<% end %>
<% if template.archived_at? %>
<div class="flex-1">
<%= link_to template_preview_path(template), class: 'btn btn-outline btn-sm w-full' do %>
<span class="flex items-center justify-center space-x-2">
<%= svg_icon('file_text', class: 'w-6 h-6') %>
<span><%= t('preview') %></span>
</span>
<% end %>
</div>
<% end %>
</div>
</div>
<% end %>
</div>
+15 -5
View File
@@ -1,17 +1,27 @@
<% content_for(:native_title, @template.name) if turbo_native_app? %>
<%= render 'title', template: @template %>
<% filter_params = params.permit(Submissions::Filter::ALLOWED_PARAMS).compact_blank %>
<% is_show_tabs = @pagy.pages > 1 || params[:q].present? || params[:status].present? || filter_params.present? %>
<% if @pagy.count.nil? || !@pagy.count.zero? || params[:q].present? || params[:status].present? || filter_params.present? %>
<div class="<%= is_show_tabs ? 'mb-4' : 'mb-6' %>">
<div class="group/header flex justify-between items-center md:items-end">
<% submissions_count = @pagy.count %>
<% is_show_header = submissions_count != 0 || params[:q].present? || params[:status].present? || filter_params.present? %>
<%= render 'title', template: @template, with_export: is_show_header %>
<% if turbo_native_app? %>
<%= render 'shared/search_input' %>
<% if !@template.archived_at? && can?(:create, Submission) %>
<native-action data-placement="footer" data-icon="send" data-label="<%= t('send_to_recipients') %>">
<a href="<%= new_template_submission_path(@template) %>" data-turbo-frame="modal"></a>
</native-action>
<% end %>
<% end %>
<% if is_show_header %>
<div class="<%= is_show_tabs ? 'mb-2 md:mb-4' : 'mb-4 md:mb-6' %>">
<div class="group/header flex justify-between items-end">
<div class="max-md:group-has-[search-input:focus-within]/header:hidden">
<h2 class="text-3xl font-bold md:block <%= 'hidden' if params[:q].present? %>">
<%= t('submissions') %>
</h2>
</div>
<div class="flex justify-end space-x-2 max-md:has-[search-input:focus-within]:grow <%= 'max-md:grow' if params[:q].present? %>">
<% if params[:q].present? || params[:status].present? || filter_params.present? || @pagy.pages > 1 %>
<% if !turbo_native_app? && (params[:q].present? || params[:status].present? || filter_params.present? || @pagy.pages > 1) %>
<%= render 'shared/search_input' %>
<% end %>
<%= link_to new_template_submissions_export_path(@template, params.permit(:q, *Submissions::Filter::ALLOWED_PARAMS)), class: 'hidden md:flex btn btn-ghost text-base', data: { turbo_frame: 'modal' } do %>
@@ -275,14 +275,16 @@
</div>
</div>
</div>
<button type="button" id="qr-print-button" class="print-button">
<%= svg_icon('printer') %>
<span><%= t('print') %></span>
</button>
<script nonce="<%= content_security_policy_nonce %>">
document.getElementById('qr-print-button').addEventListener('click', function () {
window.print();
});
</script>
<% unless turbo_native_app? %>
<button type="button" id="qr-print-button" class="print-button">
<%= svg_icon('printer') %>
<span><%= t('print') %></span>
</button>
<script nonce="<%= content_security_policy_nonce %>">
document.getElementById('qr-print-button').addEventListener('click', function () {
window.print();
});
</script>
<% end %>
</body>
</html>
@@ -0,0 +1,24 @@
<%= render 'shared/turbo_modal', title: t('revisions') do %>
<ul class="space-y-1.5">
<% @versions.each do |version| %>
<li>
<native-event class="group flex justify-between items-center gap-2 w-full rounded-lg p-3 border border-dashed border-base-200 cursor-pointer" data-name="template-builder:apply-revision" data-src="<%= template_version_path(@template, version) %>">
<div class="flex flex-col min-w-0">
<span><%= l(version.created_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %></span>
<span class="-ml-0.5 flex items-center space-x-1 text-xs text-base-content/60 mt-0.5">
<%= svg_icon('user', class: 'w-3.5 h-3.5 flex-shrink-0') %>
<span class="truncate"><%= version.author.full_name.presence || version.author.email %></span>
</span>
</div>
<span class="btn btn-sm btn-neutral text-white pointer-events-none flex-shrink-0">
<span class="group-data-[loading]:hidden"><%= t('view') %></span>
<%= svg_icon('loader', class: 'w-4 h-4 animate-spin hidden group-data-[loading]:block') %>
</span>
</native-event>
</li>
<% end %>
<% if @versions.empty? %>
<li class="py-4 text-center text-base-content/60"><%= t('no_revisions_yet') %></li>
<% end %>
</ul>
<% end %>
+1 -1
View File
@@ -1,4 +1,4 @@
<% content_for(:native_title, t('users')) if turbo_native_app? %>
<% content_for(:native_title, params[:status] == 'archived' ? t('archived_users') : (params[:status] == 'integration' ? t('embedding_users') : t('users'))) if turbo_native_app? %>
<div class="flex-wrap space-y-4 md:flex md:flex-nowrap md:space-y-0 md:space-x-10">
<%= render 'shared/settings_nav' %>
<div class="md:flex-grow">