tinyforms/app/views/forms/show.html.erb
2020-07-22 16:29:16 +02:00

82 lines
2.8 KiB
Plaintext

<div class="container">
<div class="is-pulled-right">
<%= link_to image_tag("#{@form.backend_name}-icon.svg", alt: @form.backend_name.humanize), @form.spreadsheet_url %>
</div>
<nav class="breadcrumb is-small has-bullet-separator" aria-label="breadcrumbs">
<ul>
<li>
<%= link_to forms_url do %>
<span class="icon is-small"><i class="fas fa-home" aria-hidden="true"></i></span>
Forms
<% end %>
</li>
<li><%= link_to "Setup", setup_form_url %></li>
<li><%= link_to "Settings", edit_form_url %></li>
<li><%= link_to "#{@form.backend_name.humanize} document", @form.spreadsheet_url %></li>
</ul>
</nav>
<h1 class="title">
<%= @form.title %>
</h1>
<% if @form.submissions.empty? %>
<div class="columns is-centered">
<div class="column is-two-thirds">
<h3 class="title">One more step:</h3>
<p>Your document has been successfuly configured. \o/</p>
<p>
Now set the <code>action</code> of your HTML online form to <code><%= submission_url(@form) %></code> and make sure your fields have proper <code>name</code> attributes.
</p>
<h4 class="subtitle" style="margin-top:1em">Example:</h4>
<pre><code class="language-html">
<%= html_escape_once render('form_example', form: @form) %>
</code></pre>
<p>
If you prefer to submit the form using JavaScript/AJAX have a look at our <a href="https://www.notion.so/JavaScript-Library-442071548edd4cd1af9c7d8edb3d42cb">JavaScript library</a> and our <a href="https://www.notion.so/Tinyforms-API-7862355e22ce4bbead5de3b635cda55e">API</a>.
</p>
<p>
If you need help, <%= link_to "we're here!", help_url %>
</p>
<p style="margin-top:15px">
And if you do not want to deal with your form at all, have a look at our <%= link_to 'form building service', form_building_service_url %>.
</p>
<hr>
<h4 class="subtitle" style="margin-top:1em">The above example in action:</h4>
<iframe src="<%= form_submitter_url(@form) %>" style="width:100%;height:320px" scrolling="no"></iframe>
</div>
</div>
<% else %>
<div class="box table-wrapper is-clearfix" style="clear:both">
<table class="submission-table table is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<% @form.spreadsheet_headers.each do |value| %>
<th><%= value %></th>
<% end %>
</tr>
</thead>
<tbody>
<% @submissions.each do |submission| %>
<tr>
<% @form.spreadsheet_headers.each do |column| %>
<td><%= submission.data[column] %></td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
</div>
<%== pagy_bulma_nav(@pagy) if @pagy.pages > 1 %>
<% end %>
</div>