Add test form in development mode
This helps to test submissions in development mode
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
require 'google/apis/sheets_v4'
|
||||
require 'google/api_client/client_secrets'
|
||||
class FormsController < ApplicationController
|
||||
before_action :require_login
|
||||
before_action :require_login, except: [:form]
|
||||
|
||||
def new
|
||||
@form = current_user.forms.build
|
||||
@@ -25,6 +25,12 @@ class FormsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
if Rails.env.development?
|
||||
def form
|
||||
@form = Form.find_by!(token: params[:id])
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def form_params
|
||||
|
||||
22
app/views/forms/form.html.erb
Normal file
22
app/views/forms/form.html.erb
Normal file
@@ -0,0 +1,22 @@
|
||||
<h1><%= @form.title %></h1>
|
||||
<p>
|
||||
<%= link_to 'Google spreadsheet', @form.google_spreadsheet_url %>
|
||||
</p>
|
||||
<form method="post" action="<%= submission_url(@form) %>" enctype="multipart/form-data">
|
||||
|
||||
<p>
|
||||
<label>Text</label>
|
||||
<input type="text" name="text">
|
||||
</p>
|
||||
<p>
|
||||
<label>Array</label>
|
||||
<input type="checkbox" name="array[]" value="1">
|
||||
<input type="checkbox" name="array[]" value="2">
|
||||
<input type="checkbox" name="array[]" value="3">
|
||||
</p>
|
||||
<p>
|
||||
<label>File</label>
|
||||
<input type="file" name="file">
|
||||
</p>
|
||||
<input type="submit" value="senden">
|
||||
</form>
|
||||
Reference in New Issue
Block a user