Form blank state

This commit is contained in:
bumi 2020-04-26 19:14:47 +02:00
parent 8fb3fb7175
commit d9b8ea5b09
3 changed files with 54 additions and 22 deletions

View File

@ -6,6 +6,6 @@
<%= text_field_tag header %>
</p>
<% end %>
...
<%= submit_tag 'Submit' %>
...
<input type="submit" value="Submit">
</form>

View File

@ -7,5 +7,5 @@
</p>
<% end %>
...
<%= submit_tag 'Submit' %>
<input type="submit" value="Submit">
</form>

View File

@ -18,24 +18,56 @@
<%= @form.title %>
</h1>
<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>
<% if @form.submissions.empty? %>
<div class="columns is-centered">
<div class="column is-two-thirds">
<h3 class="title">Setup your online form:</h3>
<p>
Your form submission URL: <code><%= submission_url(@form) %></code>
</p>
<p>
Set the <code>action</code> of your online form to this URL and make sure your fields have proper <code>name</code> attributes.
</p>
<h4 class="subtitle" style="margin-top:1em">Example:</h4>
<pre><code class="html">
<%= html_escape_once render('form_example', form: @form) %>
</code></pre>
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.0.0/build/styles/default.min.css">
<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.0.0/build/highlight.min.js"></script>
<p>
Let us know if you need <%= link_to 'help', help_url %> - we also build the form for you!
</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 %>
</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>
</tbody>
</table>
</div>
<% end %>
</div>