From 4319d86c06be167c4ee663f8257256a39b97ac33 Mon Sep 17 00:00:00 2001 From: Ben Halpern Date: Thu, 18 Apr 2019 15:34:50 -0400 Subject: [PATCH] Remove extra param and add message for prefill (#2487) * Remove extra param and add message for prefill * Fix test for /new non-logged-in * Fix /new test --- .../initializeBaseTracking.js.erb | 3 - app/assets/stylesheets/article_form.scss | 19 +++- app/controllers/application_controller.rb | 4 +- app/views/articles/new.html.erb | 1 + .../registrations/_registration_form.html.erb | 104 ++++++++++++------ app/views/layouts/_styles.html.erb | 2 +- spec/requests/editor_spec.rb | 3 +- 7 files changed, 93 insertions(+), 43 deletions(-) diff --git a/app/assets/javascripts/initializers/initializeBaseTracking.js.erb b/app/assets/javascripts/initializers/initializeBaseTracking.js.erb index 1883349de..14d0147e2 100644 --- a/app/assets/javascripts/initializers/initializeBaseTracking.js.erb +++ b/app/assets/javascripts/initializers/initializeBaseTracking.js.erb @@ -13,9 +13,6 @@ function initializeBaseTracking() { if (window.ga && ga.create) { ga('create', '<%= ApplicationConfig["GA_TRACKING_ID"] %>', 'auto'); ga('send', 'pageview', location.pathname + location.search); - if (document.location.search.indexOf('newly-registered-user=true') > -1) { - ga('send', 'event', 'registration', 'New user registration', location.pathname, null); - } clearInterval(waitingOnGA); logImpressions(); } diff --git a/app/assets/stylesheets/article_form.scss b/app/assets/stylesheets/article_form.scss index f56c9b08f..a05f86a3f 100644 --- a/app/assets/stylesheets/article_form.scss +++ b/app/assets/stylesheets/article_form.scss @@ -444,13 +444,28 @@ text-align:center; .registration-rainbow { .rainbow-logo { - height: calc(170px + 2vw); - width: calc(170px + 2vw); + height: calc(170px + 1vw); + width: calc(170px + 1vw); transform: rotate(6deg); border-radius: 18px; margin-top: 26px; } } + .prefill-non-logged-in-message { + background: lighten($yellow, 12%); + border-radius: 8px; + padding: 10px 0px; + border: 3px solid $yellow; + .rainbow-logo { + height: calc(100px + 1vw); + width: calc(100px + 1vw); + margin-top: 26px; + } + p { + font-size: 1.1em; + padding: 15px; + } + } h1{ font-size:calc(30px + 1vw); font-weight:800; diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b2baaf6da..2d40358cc 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -36,9 +36,7 @@ class ApplicationController < ActionController::Base end def after_sign_in_path_for(resource) - location = request.env["omniauth.origin"] || stored_location_for(resource) || "/dashboard" - context_param = resource.created_at > 40.seconds.ago ? "?newly-registered-user=true" : "?returning-user=true" - location + context_param + request.env["omniauth.origin"] || stored_location_for(resource) || "/dashboard" end def raise_banned diff --git a/app/views/articles/new.html.erb b/app/views/articles/new.html.erb index 181a40efe..a5864ac80 100644 --- a/app/views/articles/new.html.erb +++ b/app/views/articles/new.html.erb @@ -8,5 +8,6 @@ <%= render "articles/markdown_form" %> <% end %> <% else %> + <% @new_article_not_logged_in = true %> <%= render "devise/registrations/registration_form" %> <% end %> diff --git a/app/views/devise/registrations/_registration_form.html.erb b/app/views/devise/registrations/_registration_form.html.erb index 6e1a3d475..ba8f1dfaf 100644 --- a/app/views/devise/registrations/_registration_form.html.erb +++ b/app/views/devise/registrations/_registration_form.html.erb @@ -1,38 +1,78 @@
-
- -
+
+ +
+

+ Welcome to <%= ApplicationConfig["COMMUNITY_NAME"] %> +

+

+ Sign in below to compose your post and share it with the community. +

+
+ <% else %> +
+ - -
-

Great to have you

+ +
+

Great to have you

+ <% end %>