mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.5 KiB
65 lines
2.5 KiB
<% has_archived = current_account.templates.where.not(archived_at: nil).exists? %>
|
|
<% if Docuseal.demo? %><%= render 'shared/demo_alert' %><% end %>
|
|
<div class="flex justify-between items-center w-full mb-4">
|
|
<div class="flex items-center flex-grow min-w-0">
|
|
<% if has_archived || @pagy.count > 0 %>
|
|
<div class="mr-2">
|
|
<%= render 'dashboard/toggle_view', selected: 'templates' %>
|
|
</div>
|
|
<% end %>
|
|
<h1 class="text-2xl truncate md:text-3xl sm:text-4xl font-bold md:block <%= 'hidden' if params[:q].present? %>">
|
|
<%= t('document_templates_html') %>
|
|
</h1>
|
|
</div>
|
|
<div class="flex space-x-2">
|
|
<% if params[:q].present? || @pagy.pages > 1 || @template_folders.present? %>
|
|
<%= render 'shared/search_input' %>
|
|
<% end %>
|
|
<% if can?(:create, ::Template) %>
|
|
<span class="hidden sm:block">
|
|
<%= render 'templates/upload_button' %>
|
|
</span>
|
|
<%= 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') %>
|
|
<span class="hidden md:block"><%= t('create') %></span>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% view_archived_html = capture do %>
|
|
<% if has_archived %>
|
|
<div>
|
|
<a href="<%= templates_archived_index_path %>" class="link text-sm"><%= t('view_archived') %></a>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
<% if @template_folders.present? %>
|
|
<div class="grid gap-4 md:grid-cols-3 <%= 'mb-6' if @templates.present? %>">
|
|
<%= render partial: 'template_folders/folder', collection: @template_folders, as: :folder %>
|
|
</div>
|
|
<% end %>
|
|
<% if @templates.present? %>
|
|
<div class="grid gap-4 md:grid-cols-3">
|
|
<%= render partial: 'templates/template', collection: @templates %>
|
|
</div>
|
|
<% end %>
|
|
<% if params[:q].blank? && @pagy.pages == 1 && ((@template_folders.size < 10 && @templates.size.zero?) || (@template_folders.size < 7 && @templates.size < 4) || (@template_folders.size < 4 && @templates.size < 7)) %>
|
|
<%= render 'templates/dropzone' %>
|
|
<% end %>
|
|
<% if @templates.present? || params[:q].blank? %>
|
|
<% if @pagy.pages > 1 %>
|
|
<%= render 'shared/pagination', pagy: @pagy, items_name: 'templates', left_additional_html: view_archived_html %>
|
|
<% else %>
|
|
<div class="mt-2">
|
|
<%= view_archived_html %>
|
|
</div>
|
|
<% end %>
|
|
<% elsif params[:q].present? %>
|
|
<div class="text-center">
|
|
<div class="mt-16 text-3xl font-semibold">
|
|
<%= t('templates_not_found') %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<%= render 'shared/review_form' %>
|