tinyforms/app/views/forms/show.html.erb
Yannick f23d28baf6 Show pagination only when there is more than one page
Added an option to display the pagination configuration only when
the number of pages is greater than one
2020-05-01 14:58:48 +02:00

76 lines
2.5 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 "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>
Set the <code>action</code> of your 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>
</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>