rename to templates
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<div class="max-w-6xl mx-auto px-2 py-3">
|
||||
<%= link_to 'Create Flow', new_flow_path, data: { turbo_frame: :modal } %>
|
||||
<% @flows.each do |flow| %>
|
||||
<%= link_to 'Create Template', new_template_path, data: { turbo_frame: :modal } %>
|
||||
<% @templates.each do |template| %>
|
||||
<div>
|
||||
<%= flow.name %> |
|
||||
<a href="<%= flow_path(flow) %>">edit</a> |
|
||||
<a href="<%= flow_submissions_path(flow) %>">submissions</a> |
|
||||
<%= template.name %> |
|
||||
<a href="<%= template_path(template) %>">edit</a> |
|
||||
<a href="<%= template_submissions_path(template) %>">submissions</a> |
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<%= render 'shared/turbo_modal', title: 'New Flow' do %>
|
||||
<%= form_for @flow, data: { turbo_frame: :_top } do |f| %>
|
||||
<div class="form-control my-6">
|
||||
<%= f.text_field :name, required: true, placeholder: 'Flow Name', class: 'base-input' %>
|
||||
</div>
|
||||
<div class="form-control mt-4">
|
||||
<%= f.button button_title('Create'), class: 'base-button' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -7,8 +7,8 @@
|
||||
<%= csrf_meta_tags %>
|
||||
<%= csp_meta_tag %>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<%= javascript_pack_tag 'flow', defer: true %>
|
||||
<%= stylesheet_pack_tag 'flow', media: 'all' %>
|
||||
<%= javascript_pack_tag 'form', defer: true %>
|
||||
<%= stylesheet_pack_tag 'form', media: 'all' %>
|
||||
<%= yield :head %>
|
||||
</head>
|
||||
<body class="font-sans antialiased font-normal leading-normal bg-white text-gray-700">
|
||||
@@ -1,9 +0,0 @@
|
||||
You have been invited to submit flow <%= @flow.name %>
|
||||
<%= form_for @submission, url: start_flow_path(@flow.slug), data: { turbo_frame: :_top }, method: :put do |f| %>
|
||||
Provide youe email to start
|
||||
<div>
|
||||
<%= f.label :email %>
|
||||
<%= f.email_field :email, required: true %>
|
||||
</div>
|
||||
<%= f.button button_title %>
|
||||
<% end %>
|
||||
@@ -1,5 +1,5 @@
|
||||
<p>
|
||||
Form has been submitted alredy by ypu - thanks!
|
||||
</p>
|
||||
<%= button_to button_title('Send copy to Email'), send_submission_email_index_path, params: { flow_slug: @flow.slug, email: params[:email] }, form: { onsubmit: 'event.submitter.disabled = true' } %>
|
||||
<%= button_to button_title('Send copy to Email'), send_submission_email_index_path, params: { template_slug: @template.slug, email: params[:email] }, form: { onsubmit: 'event.submitter.disabled = true' } %>
|
||||
<%# do not allow donwload for securetiy reaosn<a href="">Download documets</a> %>
|
||||
@@ -0,0 +1,9 @@
|
||||
You have been invited to submit template <%= @template.name %>
|
||||
<%= form_for @submission, url: start_form_path(@template.slug), data: { turbo_frame: :_top }, method: :put do |f| %>
|
||||
Provide youe email to start
|
||||
<div>
|
||||
<%= f.label :email %>
|
||||
<%= f.email_field :email, required: true %>
|
||||
</div>
|
||||
<%= f.button button_title %>
|
||||
<% end %>
|
||||
@@ -1,4 +1,4 @@
|
||||
<p>Hi there</p>
|
||||
<p>You have been invited to submit a form:</p>
|
||||
<p><%= link_to 'Submit', submit_flow_index_url(slug: @submission.slug) %></p>
|
||||
<p><%= link_to 'Submit', submit_form_index_url(slug: @submission.slug) %></p>
|
||||
<p>If you didn't request this, please ignore this email.</p>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Submissions
|
||||
Flow <%= @flow.name %>
|
||||
template <%= @template.name %>
|
||||
Copy share link:
|
||||
<input autocomplete="off" type="text" class="w-full" value="<%= start_flow_url(slug: @flow.slug) %>" disabled>
|
||||
<a href="<%= new_flow_submission_path(@flow) %>" class="bg-green-600" data-turbo-frame="modal">Add Recepients</a>
|
||||
<input autocomplete="off" type="text" class="w-full" value="<%= start_form_url(slug: @template.slug) %>" disabled>
|
||||
<a href="<%= new_template_submission_path(@template) %>" class="bg-green-600" data-turbo-frame="modal">Add Recepients</a>
|
||||
<table>
|
||||
<tr>
|
||||
<th>
|
||||
@@ -32,7 +32,7 @@ Copy share link:
|
||||
</td>
|
||||
<td>
|
||||
copy link<br>
|
||||
<%= link_to 'View', submission_path(@flow) %>
|
||||
<%= link_to 'View', submission_path(@template) %>
|
||||
<%= button_to 'Remove', submission_path(submission), method: :delete, data: { turbo_confirm: 'Are you sure?' } %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<%= render 'shared/turbo_modal' do %>
|
||||
<%= form_for '', url: flow_submissions_path(@flow), data: { turbo_frame: :_top } do |f| %>
|
||||
<%= form_for '', url: template_submissions_path(@template), data: { turbo_frame: :_top } do |f| %>
|
||||
<div>
|
||||
<%= f.label :emails %>
|
||||
<%= f.text_area :emails, required: true %>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Flow: <%= @submission.flow.name %>
|
||||
template: <%= @submission.template.name %>
|
||||
Sub: <%= @submission.slug %>
|
||||
Copy share link:
|
||||
<input autocomplete="off" type="text" class="w-full" value="<%= submit_flow_url(slug: @submission.slug) %>" disabled>
|
||||
<% @submission.flow.fields.each do |field| %>
|
||||
<input autocomplete="off" type="text" class="w-full" value="<%= submit_form_url(slug: @submission.slug) %>" disabled>
|
||||
<% @submission.template.fields.each do |field| %>
|
||||
<div>
|
||||
<%= field['name'] %>:
|
||||
<% if ['image', 'signature'].include?(field['type']) %>
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<% attachment_field_uuids = @submission.flow.fields.select { |f| f['type'].in?(%w[image signature attachment]) }.pluck('uuid') %>
|
||||
<% attachments = ActiveStorage::Attachment.where(uuid: @submission.values.values_at(*attachment_field_uuids).flatten).preload(:blob) %>
|
||||
<flow-view class="mx-auto block" style="max-width: 1000px">
|
||||
<% @submission.flow.schema.each do |item| %>
|
||||
<% document = @submission.flow.documents.find { |a| a.uuid == item['attachment_uuid'] } %>
|
||||
<% document.preview_images.sort_by { |a| a.filename.base.to_i }.each_with_index do |page, index| %>
|
||||
<div class="relative">
|
||||
<img src="<%= page.url %>" width="<%= page.metadata['width'] %>" height="<%= page.metadata['height'] %>" loading="lazy">
|
||||
<div id="page-<%= [document.uuid, index].join('-') %>" class="top-0 bottom-0 left-0 right-0 absolute"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="sticky bottom-8 w-full">
|
||||
<div class="bg-white mx-8 md:mx-32 border p-4 rounded">
|
||||
<flow-form data-submission-slug="<%= @submission.slug %>" data-attachments="<%= attachments.to_json(only: %i[uuid], methods: %i[url filename content_type]) %>" data-fields="<%= @submission.flow.fields.to_json %>" data-values="<%= @submission.values.to_json %>" data-authenticity-token="<%= form_authenticity_token %>"></flow-form>
|
||||
</div>
|
||||
</div>
|
||||
</flow-view>
|
||||
@@ -0,0 +1,18 @@
|
||||
<% attachment_field_uuids = @submission.template.fields.select { |f| f['type'].in?(%w[image signature attachment]) }.pluck('uuid') %>
|
||||
<% attachments = ActiveStorage::Attachment.where(uuid: @submission.values.values_at(*attachment_field_uuids).flatten).preload(:blob) %>
|
||||
<div class="mx-auto block" style="max-width: 1000px">
|
||||
<% @submission.template.schema.each do |item| %>
|
||||
<% document = @submission.template.documents.find { |a| a.uuid == item['attachment_uuid'] } %>
|
||||
<% document.preview_images.sort_by { |a| a.filename.base.to_i }.each_with_index do |page, index| %>
|
||||
<div class="relative">
|
||||
<img src="<%= page.url %>" width="<%= page.metadata['width'] %>" height="<%= page.metadata['height'] %>" loading="lazy">
|
||||
<div id="page-<%= [document.uuid, index].join('-') %>" class="top-0 bottom-0 left-0 right-0 absolute"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="sticky bottom-8 w-full">
|
||||
<div class="bg-white mx-8 md:mx-32 border p-4 rounded">
|
||||
<submission-form data-submission-slug="<%= @submission.slug %>" data-attachments="<%= attachments.to_json(only: %i[uuid], methods: %i[url filename content_type]) %>" data-fields="<%= @submission.template.fields.to_json %>" data-values="<%= @submission.values.to_json %>" data-authenticity-token="<%= form_authenticity_token %>"></submission-form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,10 @@
|
||||
<%= render 'shared/turbo_modal', title: 'New Template' do %>
|
||||
<%= form_for @template, data: { turbo_frame: :_top } do |f| %>
|
||||
<div class="form-control my-6">
|
||||
<%= f.text_field :name, required: true, placeholder: 'Template Name', class: 'base-input' %>
|
||||
</div>
|
||||
<div class="form-control mt-4">
|
||||
<%= f.button button_title('Create'), class: 'base-button' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -11,6 +11,6 @@
|
||||
<%= stylesheet_pack_tag 'application', media: 'all' %>
|
||||
</head>
|
||||
<body class="h-full" data>
|
||||
<flow-builder data-flow="<%= @flow.to_json(include: { documents: { include: { preview_images: { methods: %i[url metadata filename] } } } }) %>"></flow-builder>
|
||||
<template-builder data-template="<%= @template.to_json(include: { documents: { include: { preview_images: { methods: %i[url metadata filename] } } } }) %>"></template-builder>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user