Add support to choose the sheet within google spreadsheets
This commit is contained in:
@@ -55,6 +55,6 @@ class FormsController < ApplicationController
|
||||
private
|
||||
|
||||
def form_params
|
||||
params.require(:form).permit(:title, :thank_you_url, :backend_name, :airtable_table, :airtable_api_key, :airtable_app_key)
|
||||
params.require(:form).permit(:title, :thank_you_url, :backend_name, :google_spreadsheet_sheet, :airtable_table, :airtable_api_key, :airtable_app_key)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,9 +38,10 @@ class Form < ApplicationRecord
|
||||
backend_name == 'airtable'
|
||||
end
|
||||
|
||||
def google
|
||||
backend_name == 'google'
|
||||
def google?
|
||||
backend_name == 'google_sheets'
|
||||
end
|
||||
def google; google?; end # TODO: remove this alias
|
||||
|
||||
def backend
|
||||
@backend ||= SpreadsheetBackends.const_get(backend_name.camelize).new(self)
|
||||
|
||||
@@ -52,6 +52,19 @@
|
||||
<p class="help">The URL where the user will be redirected after submission</p>
|
||||
</div>
|
||||
|
||||
<% if @form.google? %>
|
||||
|
||||
<div class="field">
|
||||
<label class="label">Sheet</label>
|
||||
<div class="control">
|
||||
<%= f.text_field :google_spreadsheet_sheet, class: 'input', autocomplete: 'off' %>
|
||||
</div>
|
||||
<p class="help">Which sheet within the spreadsheet should be used? Defaults to the first sheet. - make sure you enter the name exactly like in your spreadsheet.</p>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
<% if @form.airtable? %>
|
||||
|
||||
<div class="field">
|
||||
|
||||
Reference in New Issue
Block a user