diff --git a/app/controllers/forms_controller.rb b/app/controllers/forms_controller.rb index a3d57c0..924395a 100644 --- a/app/controllers/forms_controller.rb +++ b/app/controllers/forms_controller.rb @@ -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 diff --git a/app/views/forms/form.html.erb b/app/views/forms/form.html.erb new file mode 100644 index 0000000..22d1502 --- /dev/null +++ b/app/views/forms/form.html.erb @@ -0,0 +1,22 @@ +

<%= @form.title %>

+

+ <%= link_to 'Google spreadsheet', @form.google_spreadsheet_url %> +

+
+ +

+ + +

+

+ + + + +

+

+ + +

+ +
diff --git a/config/routes.rb b/config/routes.rb index e647883..7e54f35 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 resources :forms do + if Rails.env.development? + member { get :form } + end resources :submissions end # short link for submission file uploads