From 5947cd393e7b6aee619dfa85edf43d73def323f4 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Mon, 13 Apr 2020 15:13:01 +0200 Subject: [PATCH 1/6] Actually link the google auth button --- app/views/sessions/new.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index 3f34469..257d009 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -6,10 +6,10 @@

Login

-
+ <%= link_to auth_at_provider_url(provider: 'google'), class: 'button google' do %> Login with Google -
+ <% end %>

As tinyforms builds on Google Sheets.
From 64031261c56fcd5b562eb40d44d2755218049956 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Mon, 13 Apr 2020 15:18:14 +0200 Subject: [PATCH 2/6] Configurable google auth callback URL --- config/initializers/sorcery.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/sorcery.rb b/config/initializers/sorcery.rb index 4beedb8..3e76ca2 100644 --- a/config/initializers/sorcery.rb +++ b/config/initializers/sorcery.rb @@ -152,7 +152,7 @@ Rails.application.config.sorcery.configure do |config| # config.google.key = ENV['GOOGLE_CLIENT_ID'] config.google.secret = ENV['GOOGLE_CLIENT_SECRET'] - config.google.callback_url = "http://localhost:3000/oauth/callback?provider=google" + config.google.callback_url = (ENV['GOOGLE_AUTH_CALLBACK_URL'] || "http://localhost:3000/oauth/callback?provider=google") config.google.user_info_mapping = {:email => "email", :name => "name", :google_id => "id"} config.google.scope = "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/spreadsheets" config.google.auth_url = '/o/oauth2/auth?access_type=offline&include_granted_scopes=true' From 80771e74150e68b2c6765fba382f924b89fcae62 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Mon, 13 Apr 2020 16:14:21 +0200 Subject: [PATCH 3/6] Disable demo submit button and add link to contact --- app/javascript/demo.js | 7 +++++-- app/views/home/demo.html.erb | 6 ++++-- config/routes.rb | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/javascript/demo.js b/app/javascript/demo.js index 09fee25..b23fc05 100644 --- a/app/javascript/demo.js +++ b/app/javascript/demo.js @@ -3,10 +3,13 @@ document.addEventListener('DOMContentLoaded', function() { if (!demoForm) { return; } + demoForm.addEventListener('submit', function(e) { + var submitButton = document.getElementById('demo-submit'); + submitButton.innerText = 'loading...'; + submitButton.disabled = 'true' + }); demoForm.addEventListener('tinyforms:submitted', function(e) { - console.log(e); - console.log(e.detail); var name = document.getElementById('demo-submission-name'); var demoFields = document.getElementById('demo-fields'); var demoSucess = document.getElementById('demo-success'); diff --git a/app/views/home/demo.html.erb b/app/views/home/demo.html.erb index dfbdac7..8b86836 100644 --- a/app/views/home/demo.html.erb +++ b/app/views/home/demo.html.erb @@ -15,7 +15,9 @@

See your entry in the spreadsheet?!

- <%= link_to "Get started now", signup_url, class: 'button' %> + <%= link_to "Create your form now!", signup_url, class: 'button' %> +
+ or got <%= link_to 'further questions?', contact_url %>

@@ -68,7 +70,7 @@
- +
diff --git a/config/routes.rb b/config/routes.rb index dfdec49..6aa0b7e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -22,5 +22,6 @@ Rails.application.routes.draw do get '/auth' => 'sessions#auth', as: :auth get '/demo' => 'home#demo', as: :demo + get '/contact' => 'home#contact', as: :contact root 'home#index' end From 7917e921ad3e38a4c16de7aa3a61fb46f28072f9 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Mon, 13 Apr 2020 16:14:45 +0200 Subject: [PATCH 4/6] Use help route to redirect to notion hosted help center This makes it easier for us later change the URL --- app/views/layouts/_header.html.erb | 2 +- config/routes.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index d08b511..a154b74 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -15,7 +15,7 @@