Add test form in development mode
This helps to test submissions in development mode
This commit is contained in:
parent
94966a9933
commit
c1b9f8e701
@ -1,7 +1,7 @@
|
|||||||
require 'google/apis/sheets_v4'
|
require 'google/apis/sheets_v4'
|
||||||
require 'google/api_client/client_secrets'
|
require 'google/api_client/client_secrets'
|
||||||
class FormsController < ApplicationController
|
class FormsController < ApplicationController
|
||||||
before_action :require_login
|
before_action :require_login, except: [:form]
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@form = current_user.forms.build
|
@form = current_user.forms.build
|
||||||
@ -25,6 +25,12 @@ class FormsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if Rails.env.development?
|
||||||
|
def form
|
||||||
|
@form = Form.find_by!(token: params[:id])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def form_params
|
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>
|
@ -2,6 +2,9 @@ Rails.application.routes.draw do
|
|||||||
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
|
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
|
||||||
|
|
||||||
resources :forms do
|
resources :forms do
|
||||||
|
if Rails.env.development?
|
||||||
|
member { get :form }
|
||||||
|
end
|
||||||
resources :submissions
|
resources :submissions
|
||||||
end
|
end
|
||||||
# short link for submission file uploads
|
# short link for submission file uploads
|
||||||
|
Loading…
x
Reference in New Issue
Block a user