From 7e357406879086c3bb9494df3a129a7ad98b4954 Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 17 Dec 2018 12:28:46 -0700 Subject: [PATCH 1/4] Don't validate library card number as email on login --- app/views/devise/sessions/_new.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/devise/sessions/_new.html.erb b/app/views/devise/sessions/_new.html.erb index 1226d711..193eaf31 100644 --- a/app/views/devise/sessions/_new.html.erb +++ b/app/views/devise/sessions/_new.html.erb @@ -11,7 +11,7 @@ <% if @library_card_login %>
<%= label_tag "login_library_card_number", "Library Card Number", class: "screen-reader-text" %> - <%= f.email_field :login, autofocus: true, id: "login_email", placeholder: "#{t('login_signup.library_card_number')} *" %> + <%= f.text_field :login, autofocus: true, id: "login_library_card_number", placeholder: "#{t('login_signup.library_card_number')} *" %>
From 4ca42c4dfc5ee9a48fa1cd213b8e95f76ba82733 Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 17 Dec 2018 12:29:13 -0700 Subject: [PATCH 2/4] Update kclibrary GA id --- app/views/shared/_ga_kclibrary.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shared/_ga_kclibrary.html.erb b/app/views/shared/_ga_kclibrary.html.erb index 080413bf..2278e2c2 100644 --- a/app/views/shared/_ga_kclibrary.html.erb +++ b/app/views/shared/_ga_kclibrary.html.erb @@ -5,7 +5,7 @@ })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); var userGaId = $("#user_ga_id").val(); - ga('create', 'UA-37972615-5', 'auto', { + ga('create', 'UA-37972615-12', 'auto', { userId: userGaId }); From 224ffa21dd53cb6917aea302f477c224698346ce Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 17 Dec 2018 12:49:22 -0700 Subject: [PATCH 3/4] Update cms footer links for kclibrary --- app/assets/stylesheets/partials/_footer.scss | 2 +- .../stylesheets/subdomains/_kclibrary.scss | 16 ++++++++++++---- app/views/shared/_footer.html.erb | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/assets/stylesheets/partials/_footer.scss b/app/assets/stylesheets/partials/_footer.scss index 1c677d74..d6068347 100644 --- a/app/assets/stylesheets/partials/_footer.scss +++ b/app/assets/stylesheets/partials/_footer.scss @@ -42,7 +42,7 @@ ul strong { text-align: left; a { - color: $white !important; + color: $white; } } diff --git a/app/assets/stylesheets/subdomains/_kclibrary.scss b/app/assets/stylesheets/subdomains/_kclibrary.scss index fa999f14..c13a79e9 100644 --- a/app/assets/stylesheets/subdomains/_kclibrary.scss +++ b/app/assets/stylesheets/subdomains/_kclibrary.scss @@ -12,10 +12,6 @@ color: $kc-blue !important; } - .footer-primary { - color: $kc-grey; - } - &.login-new, &.sessions-new, &.registrations-new { @@ -28,6 +24,18 @@ color: $kc-blue; } + .cms_nav { + color: $kc-grey; + + .cms_nav--link { + color: $kc-grey !important; + } + } + + .license { + color: $kc-grey; + } + .course-widget.completed header { background: linear-gradient(to bottom, $kc-blue 0%, $kc-blue 100%); } diff --git a/app/views/shared/_footer.html.erb b/app/views/shared/_footer.html.erb index 3a680a10..bb7620de 100644 --- a/app/views/shared/_footer.html.erb +++ b/app/views/shared/_footer.html.erb @@ -6,7 +6,7 @@ LEARN MORE <% if @footer_pages %> <% @footer_pages.each do |page| %> -
  • <%= link_to page.title, cms_page_path(page) %>
  • +
  • <%= link_to page.title, cms_page_path(page), class: "cms_nav--link" %>
  • <% end %> <% end %> From f3c3d2a0a313f44e475f13e9ca2a07146f7173b0 Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 17 Dec 2018 13:02:04 -0700 Subject: [PATCH 4/4] Update specs to allow log in with library card number --- spec/feature_helper.rb | 16 ++++++++++++++++ spec/features/user_logs_in_spec.rb | 10 +++++----- spec/features/user_visits_profile_page_spec.rb | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/spec/feature_helper.rb b/spec/feature_helper.rb index df669323..4e441b24 100644 --- a/spec/feature_helper.rb +++ b/spec/feature_helper.rb @@ -4,6 +4,8 @@ require "selenium/webdriver" require "webmock/rspec" + +# TODO: Consolidate these 4 methods into one method with keyword args, maybe? def log_in_with(email, password, admin = nil) visit new_user_session_path(admin: admin) find("#login_email").set(email) @@ -11,6 +13,13 @@ def log_in_with(email, password, admin = nil) click_button "Access Courses" end +def library_card_log_in_with(card_number, password) + visit new_user_session_path + find("#login_library_card_number").set(card_number) + find("#login_password").set(password) + click_button "Access Courses" +end + def spanish_log_in_with(email, password) visit new_user_session_path find("#login_email").set(email) @@ -18,6 +27,13 @@ def spanish_log_in_with(email, password) click_button "Accesar Cursos" end +def spanish_library_card_log_in_with(card_number, password) + visit new_user_session_path + find("#login_library_card_number").set(card_number) + find("#login_password").set(password) + click_button "Accesar Cursos" +end + def log_out click_link "Sign Out" end diff --git a/spec/features/user_logs_in_spec.rb b/spec/features/user_logs_in_spec.rb index 0d11d5f5..f0c6032d 100644 --- a/spec/features/user_logs_in_spec.rb +++ b/spec/features/user_logs_in_spec.rb @@ -143,7 +143,7 @@ user = User.last - log_in_with(card_number, card_pin) + library_card_log_in_with(card_number, card_pin) expect(current_path).to eq(root_path) expect(page).to_not have_content("Signed in successfully.") expect(page).to have_content("Use a computer to do almost anything!") @@ -164,13 +164,13 @@ end scenario "with invalid library card number" do - log_in_with("12345", user.library_card_pin) + library_card_log_in_with("12345", user.library_card_pin) expect(current_path).to eq(new_user_session_path) expect(page).to have_content("Invalid Library Card Number or Library Card PIN") end scenario "with invalid pin" do - log_in_with(user.library_card_number, "123") + library_card_log_in_with(user.library_card_number, "123") expect(current_path).to eq(new_user_session_path) expect(page).to have_content("Invalid Library Card Number or Library Card PIN") end @@ -189,13 +189,13 @@ end scenario "with invalid library card number" do - spanish_log_in_with("12345", user.library_card_pin) + spanish_library_card_log_in_with("12345", user.library_card_pin) expect(current_path).to eq(new_user_session_path) expect(page).to have_content("Número de tarjeta de biblioteca o PIN de tarjeta de biblioteca no válidos") end scenario "with invalid pin" do - spanish_log_in_with(user.library_card_number, "123") + spanish_library_card_log_in_with(user.library_card_number, "123") expect(current_path).to eq(new_user_session_path) expect(page).to have_content("Número de tarjeta de biblioteca o PIN de tarjeta de biblioteca no válidos") end diff --git a/spec/features/user_visits_profile_page_spec.rb b/spec/features/user_visits_profile_page_spec.rb index 2bd2a1e4..ab5f7580 100644 --- a/spec/features/user_visits_profile_page_spec.rb +++ b/spec/features/user_visits_profile_page_spec.rb @@ -135,7 +135,7 @@ @spanish = create(:spanish_lang) # English gets created from factories user.update(sign_in_count: 2) # To prevent first time sign in events - log_in_with(user.library_card_number, user.library_card_pin) + library_card_log_in_with(user.library_card_number, user.library_card_pin) end scenario "can view their account options" do