diff --git a/app/views/templates/_submission.html.erb b/app/views/templates/_submission.html.erb index 2b696f08..e2a8c579 100644 --- a/app/views/templates/_submission.html.erb +++ b/app/views/templates/_submission.html.erb @@ -1,12 +1,12 @@ <% status_badges = { 'awaiting' => 'badge-info', 'sent' => 'badge-info', 'completed' => 'badge-success', 'opened' => 'badge-warning' } %> - + <% submitters = (submission.template_submitters || submission.template.submitters).filter_map { |item| submission.submitters.find { |e| e.uuid == item['uuid'] } } %> <% is_submission_completed = submitters.all?(&:completed_at?) && submitters.size.positive? %> <% if submitters.size == 1 %>
<% submitter = submitters.first %>
- +
<%= submitter.status %> @@ -20,14 +20,14 @@
<% if submitter.completed_at? %> -
-
<% else %> - <%= render 'shared/clipboard_copy', text: submit_form_url(slug: submitter.slug), class: 'btn btn-sm btn-neutral text-white md:w-36 flex', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy Link', copy_title_md: 'Copy', copied_title_md: 'Copied' %> +
+ <%= render 'shared/clipboard_copy', text: submit_form_url(slug: submitter.slug), class: 'btn btn-sm btn-neutral text-white md:w-36 flex', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy Link', copy_title_md: 'Copy', copied_title_md: 'Copied' %> +
<% end %> <% end %> - View +
+ View +
<% if !submission.archived_at? && can?(:destroy, submission) %> - <%= button_to button_title(title: nil, disabled_with: 'Remov', icon: svg_icon('trash', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm', form: { class: 'flex' }, title: 'Delete', method: :delete, data: { turbo_confirm: 'Are you sure?' }, onclick: 'event.stopPropagation()' %> + <%= button_to button_title(title: nil, disabled_with: 'Remov', icon: svg_icon('trash', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: 'Delete', method: :delete, data: { turbo_confirm: 'Are you sure?' }, onclick: 'event.stopPropagation()' %> <% end %>
<% else %>
-
+
<% if is_submission_completed %> <% latest_submitter = submitters.select(&:completed_at?).max_by(&:completed_at) %>
@@ -64,10 +68,10 @@
<% end %> -
+
<% submitters.each_with_index do |submitter, index| %> -
- +
+ <% unless is_submission_completed %>
@@ -82,31 +86,31 @@ <% if submitter.completed_at? && !is_submission_completed %>
<% elsif !is_submission_completed %> -
+
<% if current_user.email == submitter.email %>
-
<% else %> - <%= render 'shared/clipboard_copy', text: submit_form_url(slug: submitter.slug), class: 'btn btn-xs text-xs btn-neutral text-white md:w-36 flex', icon_class: 'w-4 h-4 text-white', copy_title: 'Copy Link' %> + <%= render 'shared/clipboard_copy', text: submit_form_url(slug: submitter.slug), class: 'absolute md:relative top-0 right-0 btn btn-xs text-xs btn-neutral text-white w-28 md:w-36 flex', icon_class: 'w-4 h-4 text-white', copy_title: 'Copy Link', copy_title_md: 'Copy Link', copied_title_md: 'Copied' %> <% end %>
<% end %> @@ -115,27 +119,31 @@
-
+
<% if is_submission_completed %> <% latest_submitter = submitters.select(&:completed_at?).max_by(&:completed_at) %> -
- -
+
+
+ +
+
<% end %> - View +
+ View +
<% unless submission.archived_at? %> - <%= button_to button_title(title: nil, disabled_with: 'Remov', icon: svg_icon('trash', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm', form: { class: 'flex' }, title: 'Delete', method: :delete, data: { turbo_confirm: 'Are you sure?' }, onclick: 'event.stopPropagation()' %> + <%= button_to button_title(title: nil, disabled_with: 'Remov', icon: svg_icon('trash', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: 'Delete', method: :delete, data: { turbo_confirm: 'Are you sure?' }, onclick: 'event.stopPropagation()' %> <% end %>
<% end %> diff --git a/app/views/templates/_title.html.erb b/app/views/templates/_title.html.erb index d948ec0d..ba812af7 100644 --- a/app/views/templates/_title.html.erb +++ b/app/views/templates/_title.html.erb @@ -1,42 +1,48 @@ -
-
-

- <%= template.name %> - <% if template.archived_at? %> - Archived - <% end %> -

-
- - <%= svg_icon('folder', class: 'w-5 h-5 flex-shrink-0') %> - - <%= @template.folder.name %> - - - <% if can?(:update, template) %> - - - <%= svg_icon('pencil_share', class: 'w-5 h-5') %> +
+ -
<% if !template.archived_at? %> - <%= render 'shared/clipboard_copy', text: start_form_url(slug: @template.slug), class: 'btn btn-sm btn-neutral text-white', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy Link', copied_title: 'Copied', copy_title_md: 'Link', copied_title_md: 'Copied' %> + <%= render 'shared/clipboard_copy', text: start_form_url(slug: @template.slug), class: 'absolute md:relative bottom-0 right-0 btn btn-xs md:btn-sm whitespace-nowrap btn-neutral text-white mt-1 px-2', icon_class: 'w-4 h-4 md:w-6 md:h-6 text-white', copy_title: 'Copy Link', copied_title: 'Copied', copy_title_md: 'Link', copied_title_md: 'Copied' %> <% end %> +
+
<% if !template.archived_at? && can?(:destroy, template) %> - <%= button_to button_title(title: 'Archive', disabled_with: 'Archiving', title_class: 'hidden md:inline', icon: svg_icon('archive', class: 'w-6 h-6')), template_path(template), class: 'btn btn-outline btn-sm', method: :delete, data: { turbo_confirm: 'Are you sure?' } %> + <%= button_to button_title(title: 'Archive', disabled_with: 'Archiving', 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, data: { turbo_confirm: 'Are you sure?' } %> <% end %> <% if can?(:create, template) %> - <%= link_to new_template_path(base_template_id: template.id), class: 'btn btn-outline btn-sm', data: { turbo_frame: :modal } do %> - <%= svg_icon('copy', class: 'w-6 h-6') %> - + <%= link_to new_template_path(base_template_id: template.id), class: 'btn btn-outline btn-sm flex-1', data: { turbo_frame: :modal } do %> + + <%= svg_icon('copy', class: 'w-6 h-6') %> + Clone + <% end %> <% end %> <% if !template.archived_at? && can?(:update, template) %> - <%= link_to edit_template_path(template), class: 'btn btn-outline btn-sm' do %> + <%= link_to edit_template_path(template), class: 'btn btn-outline btn-sm flex-1' do %> <%= svg_icon('pencil', class: 'w-6 h-6') %> Edit @@ -44,7 +50,7 @@ <% end %> <% end %> <% if template.archived_at? && can?(:create, template) %> - <%= button_to button_title(title: 'Restore', disabled_with: 'Restoring', icon: svg_icon('rotate', class: 'w-6 h-6')), template_restore_index_path(template), class: 'btn btn-outline btn-sm' %> + <%= button_to button_title(title: 'Restore', disabled_with: 'Restoring', icon: svg_icon('rotate', class: 'w-6 h-6')), template_restore_index_path(template), class: 'btn btn-outline btn-sm flex-1' %> <% end %>
diff --git a/app/views/templates/show.html.erb b/app/views/templates/show.html.erb index dbd7a796..107429ea 100644 --- a/app/views/templates/show.html.erb +++ b/app/views/templates/show.html.erb @@ -1,22 +1,24 @@ <%= render 'title', template: @template %> <% is_show_tabs = @pagy.pages > 1 || params[:status].present? %> <% if !@pagy.count.zero? || params[:q].present? %> -
-

Submissions

-
- <% if params[:q].present? || params[:status].present? || @pagy.pages > 1 %> - <%= render 'shared/search_input' %> - <% end %> - <%= link_to new_template_submissions_export_path(@template), class: 'btn btn-ghost text-base', data: { turbo_frame: 'modal' } do %> - <%= svg_icon('download', class: 'w-6 h-6 stroke-2') %> - Export - <% end %> - <% if !@template.archived_at? && can?(:create, Submission) %> - <%= link_to new_template_submission_path(@template), class: 'white-button !border', data: { turbo_frame: 'modal' } do %> - <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %> - Add +
+
+

Submissions

+
+ <% if params[:q].present? || params[:status].present? || @pagy.pages > 1 %> + <%= render 'shared/search_input' %> <% end %> - <% end %> + <%= link_to new_template_submissions_export_path(@template), class: 'hidden md:flex btn btn-ghost text-base', data: { turbo_frame: 'modal' } do %> + <%= svg_icon('download', class: 'w-6 h-6 stroke-2') %> + Export + <% end %> + <% if !@template.archived_at? && can?(:create, Submission) %> + <%= link_to new_template_submission_path(@template), class: 'white-button !border', data: { turbo_frame: 'modal' } do %> + <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %> + Add + <% end %> + <% end %> +
<% end %>