mirror of
https://github.com/docusealco/docuseal
synced 2026-11-10 07:42:32 -05:00
add search
This commit is contained in:
1 parent
8259ebdb6c
commit
ae5f87f8fb
28 files changed
+323
-34
No files matched your search
@@ -0,0 +1 @@
|
||||
<%= render 'search/row', href: folder_path(folder), icon: 'folder', title: folder.name, subtitle: folder.parent_folder&.name %>
|
||||
@@ -0,0 +1,9 @@
|
||||
<% if folders.present? %>
|
||||
<div class="mb-5">
|
||||
<div class="px-4 mb-1 text-xs font-semibold uppercase tracking-wide"><%= t('folders') %></div>
|
||||
<div id="search_folders" class="bg-base-200 rounded-2xl divide-y divide-base-300">
|
||||
<%= render partial: 'search/folder', collection: folders %>
|
||||
</div>
|
||||
<%= render 'shared/infinite_scroll', pagy:, query_params: { 'scope' => 'folders' } if pagy %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -0,0 +1,28 @@
|
||||
<% with_filters = params[:scope] == 'submissions' || params[:archived] == 'true' || Submissions::Filter::ALLOWED_PARAMS.any? { |key| params[key].present? } %>
|
||||
<turbo-frame id="search_results" class="block">
|
||||
<% if with_filters %>
|
||||
<% filter_params = params.permit(Submissions::Filter::ALLOWED_PARAMS).compact_blank %>
|
||||
<style>html, body { overflow: hidden; }</style>
|
||||
<div class="flex items-center gap-2 w-full">
|
||||
<%= render 'submissions_filters/applied_filters', filter_params:, with_status: true, with_archived: true, filter_template: @filter_template %>
|
||||
<%= render 'submissions_filters/filter_button', filter_params: %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="<%= 'overflow-y-auto -mx-4 px-4 md:-mx-2 md:px-2' if with_filters %>" style="<%= 'height: calc(100vh - 40px); padding-top: 16px; padding-bottom: 140px; -webkit-mask-image: linear-gradient(to bottom, transparent, black 16px); mask-image: linear-gradient(to bottom, transparent, black 16px);' if with_filters %>">
|
||||
<% if @query.present? %>
|
||||
<% if @template_folders.blank? && @templates.blank? && @submissions.blank? %>
|
||||
<div class="text-center mt-16 text-xl">
|
||||
<%= t('no_results') %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if params[:scope] == 'submissions' %>
|
||||
<%= render 'search/submissions', submissions: @submissions, pagy: @pagy %>
|
||||
<% end %>
|
||||
<%= render 'search/folders', folders: @template_folders, pagy: @folders_pagy %>
|
||||
<%= render 'search/templates', templates: @templates, pagy: (@pagy unless params[:scope] == 'submissions') %>
|
||||
<% unless params[:scope] == 'submissions' %>
|
||||
<%= render 'search/submissions', submissions: @submissions, pagy: nil %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</turbo-frame>
|
||||
@@ -0,0 +1,18 @@
|
||||
<% subtitle = local_assigns[:subtitle].presence %>
|
||||
<% badge = local_assigns[:badge].presence %>
|
||||
<% date = local_assigns[:date] %>
|
||||
<a href="<%= href %>" data-turbo-frame="_top" class="flex items-center gap-3 pl-4 py-3 min-h-14" style="padding-right: 20px;" data-native-title="<%= title %>" data-native-actions="<%= local_assigns[:native_actions] %>">
|
||||
<%= svg_icon(icon, class: 'w-6 h-6 shrink-0') %>
|
||||
<div class="min-w-0 flex-1 items-center" style="display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px;">
|
||||
<div class="truncate" style="grid-column: <%= badge || !subtitle ? '1' : '1 / span 2' %>; grid-row: <%= subtitle ? '1' : '1 / span 2' %>;"><%= title %></div>
|
||||
<% if subtitle %>
|
||||
<div class="text-xs text-base-content/60 truncate" style="grid-column: 1; grid-row: 2;"><%= subtitle %></div>
|
||||
<% end %>
|
||||
<% if badge %>
|
||||
<span class="badge badge-sm <%= badge_class %> bg-opacity-50 uppercase font-semibold justify-self-end" style="grid-column: 2; grid-row: 1; font-size: 10px;"><%= badge %></span>
|
||||
<% end %>
|
||||
<% if date %>
|
||||
<span class="text-xs text-base-content/60 justify-self-end" style="grid-column: 2; grid-row: <%= badge || subtitle ? '2' : '1 / span 2' %>;"><%= l(date.in_time_zone(current_account.timezone).to_date, format: :short, locale: current_account.locale) %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
</a>
|
||||
@@ -0,0 +1,4 @@
|
||||
<% status = submission.completed_at? ? 'completed' : (submission.expired? ? 'expired' : 'pending') %>
|
||||
<% name = submission.name.presence || submission.template&.name %>
|
||||
<% submitters = submission.submitters.filter_map { |s| s.name.presence || s.email.presence || s.phone.presence }.join(', ') %>
|
||||
<%= render 'search/row', href: submission_path(submission), icon: 'file_text', title: submitters, subtitle: (name if params[:template_id].blank?), date: (params[:status] == 'completed' && submission.completed_at) || submission.created_at, badge: t(status), badge_class: { 'completed' => 'badge-success', 'expired' => 'badge-error', 'pending' => 'badge-info' }[status] %>
|
||||
@@ -0,0 +1,9 @@
|
||||
<% if submissions.present? %>
|
||||
<div class="mb-5">
|
||||
<div class="px-4 mb-1 text-xs font-semibold uppercase tracking-wide"><%= t('submissions') %></div>
|
||||
<div id="search_submissions" class="bg-base-200 rounded-2xl divide-y divide-base-300">
|
||||
<%= render partial: 'search/submission', collection: submissions %>
|
||||
</div>
|
||||
<%= render 'shared/infinite_scroll', pagy: pagy if pagy %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -0,0 +1,2 @@
|
||||
<% author = template.author.full_name.presence || template.author.email.to_s.sub(/\+\w+@/, '@') %>
|
||||
<%= render 'search/row', href: template_path(template), icon: 'layout_grid', title: template.name, subtitle: template.folder.default? || params[:folder].present? ? author : template.folder.full_name, date: template.created_at, native_actions: ('pencil,menu' if turbo_native_app? && !template.archived_at? && can?(:update, template)) %>
|
||||
@@ -0,0 +1,9 @@
|
||||
<% if templates.present? %>
|
||||
<div class="mb-5">
|
||||
<div class="px-4 mb-1 text-xs font-semibold uppercase tracking-wide"><%= t('templates') %></div>
|
||||
<div id="search_templates" class="bg-base-200 rounded-2xl divide-y divide-base-300">
|
||||
<%= render partial: 'search/template', collection: templates %>
|
||||
</div>
|
||||
<%= render 'shared/infinite_scroll', pagy: pagy if pagy %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -0,0 +1,10 @@
|
||||
<% content_for(:native_title, t('search')) if turbo_native_app? %>
|
||||
<% unless turbo_native_app? %>
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h1 class="text-2xl md:text-3xl sm:text-4xl font-bold"><%= t('search') %></h1>
|
||||
<%= render 'shared/search_input', placeholder: t('search') %>
|
||||
</div>
|
||||
<% end %>
|
||||
<native-search class="block" data-src="<%= url_for(params: request.query_parameters.except('q', 'page')) %>" data-q="<%= @query %>">
|
||||
<%= render 'search/results' %>
|
||||
</native-search>
|
||||
Reference in new issue
Block a user