From 83699e26cd738be590d776e292e159ca9c442cb6 Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 16 Aug 2021 13:58:18 -0600 Subject: [PATCH 01/15] Include option for custom Course Index page subheader --- .../admin/custom/translations_helper.rb | 1 + app/views/shared/_course_intro_text.html.erb | 9 ++++ config/locales/en.yml | 2 + config/locales/es.yml | 2 + .../admin/translation_management_spec.rb | 48 +++++++++++++++++++ .../anonymous_user_walkthrough_spec.rb | 16 +++++++ 6 files changed, 78 insertions(+) create mode 100644 spec/features/admin/translation_management_spec.rb diff --git a/app/helpers/admin/custom/translations_helper.rb b/app/helpers/admin/custom/translations_helper.rb index 5162de4f..a361e44c 100644 --- a/app/helpers/admin/custom/translations_helper.rb +++ b/app/helpers/admin/custom/translations_helper.rb @@ -30,6 +30,7 @@ def en_keys texts = { 'home.%s.custom_banner_greeting' => 'Homepage Greeting', 'home.choose_a_course.%s' => 'Course Selection Greeting', + 'home.choose_course_subheader.%s' => 'Course Selection Subheader', 'completed_courses_page.%s.retake_the_quiz' => 'Retake the Quiz Button' } diff --git a/app/views/shared/_course_intro_text.html.erb b/app/views/shared/_course_intro_text.html.erb index d505ee95..ba73c96e 100644 --- a/app/views/shared/_course_intro_text.html.erb +++ b/app/views/shared/_course_intro_text.html.erb @@ -20,6 +20,15 @@

<%= i18n_with_default("home.choose_a_course.#{current_organization.subdomain}") %>

+ + <% custom_subheader = i18n_with_default("home.choose_course_subheader.#{current_organization.subdomain}") %> + + <% unless custom_subheader.blank? %> +

+ <%= custom_subheader %> +

+ <% end %> + <% if current_organization.courses.authenticated_users.exists? %>

<%= t('home.more_courses') %> diff --git a/config/locales/en.yml b/config/locales/en.yml index b93a76b7..173ea536 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -78,6 +78,8 @@ en: ebrpl: "Choose a topic below to start learning or use the search box at the top of the screen." carnegielibrary: "Choose a topic below to start learning or use the search box at the top of the screen." kclibrary: "Choose a course below to start learning or search courses." + choose_course_subheader: + default_org: "" new_to_computers: "If you are new to computers, haven't used them for a while, are a little unsure and uncomfortable, or just need a bit of a refresher, we have the tools to help you tackle technology at your own pace and gain the confidence you need to succeed." search_courses: "Search Courses" trainer_link: "Tools and Resources for Trainers" diff --git a/config/locales/es.yml b/config/locales/es.yml index 1c3b9c96..75f09e16 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -83,6 +83,8 @@ es: pima: "Seleccione un curso de los que aparecen a continuación para comenzar." ebrpl: "Seleccione un tema a continuación para comenzar a aprender o utilice el cuadro de búsqueda en la parte superior de la pantalla." carnegielibrary: "Seleccione un tema a continuación para comenzar a aprender o utilice el cuadro de búsqueda en la parte superior de la pantalla." + choose_course_subheader: + default_org: "" new_to_computers: "Si usted no tiene experiencia con las computadoras, no las ha usado recientemente, no se siente cómodo usándolas, o necesita un repaso, aquí encontrará tutoriales prácticos que le ayudarán a entender cómo usar una computadora, y a adquirir la confianza para usar el internet en su vida diaria." search_courses: "¿Qué le gustaría aprender?" trainer_link: "Herramientas y recursos para instructores" diff --git a/spec/features/admin/translation_management_spec.rb b/spec/features/admin/translation_management_spec.rb new file mode 100644 index 00000000..4d977ebb --- /dev/null +++ b/spec/features/admin/translation_management_spec.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +require 'feature_helper' + +feature 'Admin updates translations' do + let(:organization) { FactoryBot.create(:organization) } + let(:admin) { FactoryBot.create(:user, :admin, organization: organization) } + + before do + switch_to_subdomain(organization.subdomain) + log_in_with admin.email, admin.password + end + + scenario 'Admin sees correct content on custom translations page' do + visit admin_custom_translations_path + + # Page Header + expect(page).to have_content 'Custom Text - English' + + # Table Headers + expect(page).to have_content 'Section' + expect(page).to have_content 'Default Text' + expect(page).to have_content 'Actions' + + # Translation labels + expect(page).to have_content 'Homepage Greeting' + expect(page).to have_content 'Course Selection Greeting' + expect(page).to have_content 'Course Selection Subheader' + expect(page).to have_content 'Retake the Quiz Button' + + # Translation values + expect(page).to have_content 'Choose a course below to start learning or search courses.' + expect(page).to have_content 'Retake the Quiz' + end + + scenario 'Admin can change a translation' do + visit admin_custom_translations_path + + find(:xpath, "//tr[td[contains(.,'Course Selection Subheader')]]/td/a", text: 'Edit').click + expect(current_path).to eq(new_admin_custom_translation_path('en')) + + fill_in 'Course Selection Subheader in English', with: 'New Subheader text' + click_on 'Submit' + + expect(page).to have_content 'Text for Course Selection Subheader updated.' + expect(page).to have_content 'New Subheader text' + end +end diff --git a/spec/features/anonymous_user_walkthrough_spec.rb b/spec/features/anonymous_user_walkthrough_spec.rb index 1d92977a..85aa288d 100644 --- a/spec/features/anonymous_user_walkthrough_spec.rb +++ b/spec/features/anonymous_user_walkthrough_spec.rb @@ -12,6 +12,22 @@ expect(page).to have_content('Choose a course below to start learning or search courses.') end + scenario 'visits home page for subdomain with custom translations' do + org = FactoryBot.create(:organization) + switch_to_subdomain(org.subdomain) + + header_translation_key = "home.choose_a_course.#{org.subdomain}" + subhead_translation_key = "home.choose_course_subheader.#{org.subdomain}" + custom_heading = "Custom Courses Header" + custom_subheading = "Custom course subheader with more info" + FactoryBot.create(:translation, locale: :en, key: header_translation_key, value: custom_heading) + FactoryBot.create(:translation, locale: :en, key: subhead_translation_key, value: custom_subheading) + + visit root_path + expect(page).to have_content custom_heading + expect(page).to have_content custom_subheading + end + scenario 'can visit the customization page' do page = create(:cms_page, title: 'Pricing & Features') visit cms_page_path(page) From f583ab2d53a3ac64128ef6ddf0e0ef11f1183134 Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 16 Aug 2021 14:15:02 -0600 Subject: [PATCH 02/15] Hide login button for AT&T subdomain --- app/assets/stylesheets/subdomains/_att.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/assets/stylesheets/subdomains/_att.scss b/app/assets/stylesheets/subdomains/_att.scss index 7ed6c725..dfab63f8 100644 --- a/app/assets/stylesheets/subdomains/_att.scss +++ b/app/assets/stylesheets/subdomains/_att.scss @@ -9,6 +9,10 @@ .congrats-banner { background-color: $att-light-blue; } + + .login-button-container { + display: none; + } } .att-certificate { From 2f51ba10934bd657575d2d318553e40d54c8ca66 Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 16 Aug 2021 14:17:31 -0600 Subject: [PATCH 03/15] Don't display courses subheader as italic --- app/views/shared/_course_intro_text.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shared/_course_intro_text.html.erb b/app/views/shared/_course_intro_text.html.erb index ba73c96e..4e02793f 100644 --- a/app/views/shared/_course_intro_text.html.erb +++ b/app/views/shared/_course_intro_text.html.erb @@ -24,7 +24,7 @@ <% custom_subheader = i18n_with_default("home.choose_course_subheader.#{current_organization.subdomain}") %> <% unless custom_subheader.blank? %> -

+

<%= custom_subheader %>

<% end %> From 273ef681ea663f98e3fed0091cf12922889bdd27 Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 16 Aug 2021 16:17:22 -0600 Subject: [PATCH 04/15] Add custom PDF for AT&T course completion certificate --- app/assets/stylesheets/pdf.css.scss | 47 +++++++++++++++++++ .../course_completions_controller.rb | 12 ++++- .../custom_certificates/att.pdf.erb | 25 ++++++++++ app/views/course_completions/show.html.erb | 8 ++-- 4 files changed, 86 insertions(+), 6 deletions(-) create mode 100644 app/views/course_completions/custom_certificates/att.pdf.erb diff --git a/app/assets/stylesheets/pdf.css.scss b/app/assets/stylesheets/pdf.css.scss index b12c7590..31def5d8 100644 --- a/app/assets/stylesheets/pdf.css.scss +++ b/app/assets/stylesheets/pdf.css.scss @@ -31,3 +31,50 @@ left: 2.5em; } } + +.att-pdf-cert { + background-color: $att-light-blue; + padding: 2em; + + .cert-box { + height: auto; + text-align: center; + border: none; + padding: 3rem; + background-color: $white; + color: $att-light-blue; + display: flex; + justify-content: space-between; + flex-direction: column; + + p { + color: $att-light-blue; + font-size: 1.5em; + } + + h1 { + color: $att-light-blue; + font-size: 3.5em; + margin: 0 0 1em 0; + } + + .name-fill { + border-bottom: 1px solid $att-light-blue; + width: 75%; + margin: 3em auto 1em auto; + } + + h2 { + color: $att-light-blue; + font-size: 2.5em; + font-weight: lighter; + margin-bottom: 2em; + } + + img { + margin: 2em; + position: relative; + height: 5em; + } + } +} diff --git a/app/controllers/course_completions_controller.rb b/app/controllers/course_completions_controller.rb index 9d13d24e..64d4f9ae 100644 --- a/app/controllers/course_completions_controller.rb +++ b/app/controllers/course_completions_controller.rb @@ -25,7 +25,7 @@ def show format.html format.pdf do @pdf = render_to_string pdf: 'file_name', - template: 'course_completions/show.pdf.erb', + template: pdf_template_path, layout: 'pdf.html.erb', orientation: 'Landscape', page_size: 'Letter', @@ -44,4 +44,14 @@ def show end end + private + + def pdf_template_path + if current_organization.custom_certificate_enabled? + "course_completions/custom_certificates/#{current_organization.subdomain}.pdf.erb" + else + "course_completions/show.pdf.erb" + end + end + end diff --git a/app/views/course_completions/custom_certificates/att.pdf.erb b/app/views/course_completions/custom_certificates/att.pdf.erb new file mode 100644 index 00000000..3510cb8a --- /dev/null +++ b/app/views/course_completions/custom_certificates/att.pdf.erb @@ -0,0 +1,25 @@ +
+
+

<%= t('completed_courses_page.certificate_of_completion') %>

+ +

+ <%= t('certificate.this_award') %> +

+ +
 
+ +

+ <%= t('certificate.has_completed') %> +

+ + <%= content_tag :h2, "#{@course.title}", class: "course" %> + +
+ <%= wicked_pdf_image_tag "att_certificate_logo.png" %> +
+ +
+ <%= t('certificate.att.disclaimer').html_safe %> +
+
+
\ No newline at end of file diff --git a/app/views/course_completions/show.html.erb b/app/views/course_completions/show.html.erb index b37adc48..5c806d14 100644 --- a/app/views/course_completions/show.html.erb +++ b/app/views/course_completions/show.html.erb @@ -17,11 +17,9 @@ <% end %>
- <% if !current_organization.custom_certificate_enabled? %> - <%= link_to(course_completion_path(@course, format: 'pdf')) do %> - <%= button_tag(type: 'button', class: "congrats-button button-color") do %> - <%= t('course_completion_page.download_certificate') %> - <% end %> + <%= link_to(course_completion_path(@course, format: 'pdf')) do %> + <%= button_tag(type: 'button', class: "congrats-button button-color") do %> + <%= t('course_completion_page.download_certificate') %> <% end %> <% end %> From 11405b017cb7cdcf4cde980b72da19065e6f518a Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 16 Aug 2021 16:35:40 -0600 Subject: [PATCH 05/15] Load separate stylesheet for custom pdf downloads --- app/assets/stylesheets/att_pdf.css.scss | 45 +++++++++++++++++++++++ app/assets/stylesheets/pdf.css.scss | 47 ------------------------- app/views/layouts/pdf.html.erb | 6 +++- 3 files changed, 50 insertions(+), 48 deletions(-) create mode 100644 app/assets/stylesheets/att_pdf.css.scss diff --git a/app/assets/stylesheets/att_pdf.css.scss b/app/assets/stylesheets/att_pdf.css.scss new file mode 100644 index 00000000..d396646e --- /dev/null +++ b/app/assets/stylesheets/att_pdf.css.scss @@ -0,0 +1,45 @@ +@import "vars"; + +.att-pdf-cert { + background-color: $att-light-blue; + padding: 2em; + + .cert-box { + height: auto; + text-align: center; + border: none; + padding: 3rem; + background-color: $white; + color: $att-light-blue; + display: flex; + justify-content: space-between; + flex-direction: column; + + p { + font-size: 1.5em; + } + + h1 { + font-size: 3.5em; + margin: 0 0 1em 0; + } + + .name-fill { + border-bottom: 1px solid $att-light-blue; + width: 75%; + margin: 3em auto 1em auto; + } + + h2 { + font-size: 2.5em; + font-weight: lighter; + margin-bottom: 2em; + } + + img { + margin: 2em; + position: relative; + height: 5em; + } + } +} diff --git a/app/assets/stylesheets/pdf.css.scss b/app/assets/stylesheets/pdf.css.scss index 31def5d8..b12c7590 100644 --- a/app/assets/stylesheets/pdf.css.scss +++ b/app/assets/stylesheets/pdf.css.scss @@ -31,50 +31,3 @@ left: 2.5em; } } - -.att-pdf-cert { - background-color: $att-light-blue; - padding: 2em; - - .cert-box { - height: auto; - text-align: center; - border: none; - padding: 3rem; - background-color: $white; - color: $att-light-blue; - display: flex; - justify-content: space-between; - flex-direction: column; - - p { - color: $att-light-blue; - font-size: 1.5em; - } - - h1 { - color: $att-light-blue; - font-size: 3.5em; - margin: 0 0 1em 0; - } - - .name-fill { - border-bottom: 1px solid $att-light-blue; - width: 75%; - margin: 3em auto 1em auto; - } - - h2 { - color: $att-light-blue; - font-size: 2.5em; - font-weight: lighter; - margin-bottom: 2em; - } - - img { - margin: 2em; - position: relative; - height: 5em; - } - } -} diff --git a/app/views/layouts/pdf.html.erb b/app/views/layouts/pdf.html.erb index 0999cbe9..085ee6da 100644 --- a/app/views/layouts/pdf.html.erb +++ b/app/views/layouts/pdf.html.erb @@ -2,7 +2,11 @@ - <%= wicked_pdf_stylesheet_link_tag "pdf" -%> + <% if current_organization.custom_certificate_enabled? %> + <%= wicked_pdf_stylesheet_link_tag "#{current_organization.subdomain}_pdf" -%> + <% else %> + <%= wicked_pdf_stylesheet_link_tag "pdf" -%> + <% end %>
From 85bbe58ee63f14b1dbd08beb3d58db12c402d075 Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 16 Aug 2021 16:41:40 -0600 Subject: [PATCH 06/15] Use namespaced custom pdf stylesheet --- app/assets/stylesheets/application.css.scss | 1 + .../{att_pdf.css.scss => subdomains/pdfs/att.css.scss} | 0 app/views/layouts/pdf.html.erb | 2 +- 3 files changed, 2 insertions(+), 1 deletion(-) rename app/assets/stylesheets/{att_pdf.css.scss => subdomains/pdfs/att.css.scss} (100%) diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 90a71e8e..a6c39ce4 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -20,6 +20,7 @@ @import "components/*"; @import "mixins/*"; @import "subdomains/*"; +@import "subdomains/pdfs/*"; @import "admin/custom/*"; @import "scaffolds"; @import "pdf"; diff --git a/app/assets/stylesheets/att_pdf.css.scss b/app/assets/stylesheets/subdomains/pdfs/att.css.scss similarity index 100% rename from app/assets/stylesheets/att_pdf.css.scss rename to app/assets/stylesheets/subdomains/pdfs/att.css.scss diff --git a/app/views/layouts/pdf.html.erb b/app/views/layouts/pdf.html.erb index 085ee6da..f18fed06 100644 --- a/app/views/layouts/pdf.html.erb +++ b/app/views/layouts/pdf.html.erb @@ -3,7 +3,7 @@ <% if current_organization.custom_certificate_enabled? %> - <%= wicked_pdf_stylesheet_link_tag "#{current_organization.subdomain}_pdf" -%> + <%= wicked_pdf_stylesheet_link_tag "subdomains/pdfs/#{current_organization.subdomain}" -%> <% else %> <%= wicked_pdf_stylesheet_link_tag "pdf" -%> <% end %> From b30fde0e82283bfb8218467bf8800592c7ec6200 Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 16 Aug 2021 16:51:52 -0600 Subject: [PATCH 07/15] Use top level stylesheet for custom PDFs --- app/assets/stylesheets/application.css.scss | 2 +- .../{subdomains/pdfs/att.css.scss => att_pdf.css.scss} | 0 app/views/layouts/pdf.html.erb | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename app/assets/stylesheets/{subdomains/pdfs/att.css.scss => att_pdf.css.scss} (100%) diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index a6c39ce4..85a5c1c4 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -20,7 +20,7 @@ @import "components/*"; @import "mixins/*"; @import "subdomains/*"; -@import "subdomains/pdfs/*"; @import "admin/custom/*"; @import "scaffolds"; @import "pdf"; +@import "att_pdf"; diff --git a/app/assets/stylesheets/subdomains/pdfs/att.css.scss b/app/assets/stylesheets/att_pdf.css.scss similarity index 100% rename from app/assets/stylesheets/subdomains/pdfs/att.css.scss rename to app/assets/stylesheets/att_pdf.css.scss diff --git a/app/views/layouts/pdf.html.erb b/app/views/layouts/pdf.html.erb index f18fed06..085ee6da 100644 --- a/app/views/layouts/pdf.html.erb +++ b/app/views/layouts/pdf.html.erb @@ -3,7 +3,7 @@ <% if current_organization.custom_certificate_enabled? %> - <%= wicked_pdf_stylesheet_link_tag "subdomains/pdfs/#{current_organization.subdomain}" -%> + <%= wicked_pdf_stylesheet_link_tag "#{current_organization.subdomain}_pdf" -%> <% else %> <%= wicked_pdf_stylesheet_link_tag "pdf" -%> <% end %> From 6b28fb503443a8616f73315cbeee2aca625f2352 Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 16 Aug 2021 17:02:52 -0600 Subject: [PATCH 08/15] Move custom PDF styles back into main pdf stylesheet --- app/assets/stylesheets/application.css.scss | 1 - app/assets/stylesheets/att_pdf.css.scss | 45 ------------------- app/assets/stylesheets/pdf.css.scss | 44 ++++++++++++++++++ .../custom_certificates/att.pdf.erb | 2 +- app/views/layouts/pdf.html.erb | 6 +-- 5 files changed, 46 insertions(+), 52 deletions(-) delete mode 100644 app/assets/stylesheets/att_pdf.css.scss diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 85a5c1c4..90a71e8e 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -23,4 +23,3 @@ @import "admin/custom/*"; @import "scaffolds"; @import "pdf"; -@import "att_pdf"; diff --git a/app/assets/stylesheets/att_pdf.css.scss b/app/assets/stylesheets/att_pdf.css.scss deleted file mode 100644 index d396646e..00000000 --- a/app/assets/stylesheets/att_pdf.css.scss +++ /dev/null @@ -1,45 +0,0 @@ -@import "vars"; - -.att-pdf-cert { - background-color: $att-light-blue; - padding: 2em; - - .cert-box { - height: auto; - text-align: center; - border: none; - padding: 3rem; - background-color: $white; - color: $att-light-blue; - display: flex; - justify-content: space-between; - flex-direction: column; - - p { - font-size: 1.5em; - } - - h1 { - font-size: 3.5em; - margin: 0 0 1em 0; - } - - .name-fill { - border-bottom: 1px solid $att-light-blue; - width: 75%; - margin: 3em auto 1em auto; - } - - h2 { - font-size: 2.5em; - font-weight: lighter; - margin-bottom: 2em; - } - - img { - margin: 2em; - position: relative; - height: 5em; - } - } -} diff --git a/app/assets/stylesheets/pdf.css.scss b/app/assets/stylesheets/pdf.css.scss index b12c7590..c61a309e 100644 --- a/app/assets/stylesheets/pdf.css.scss +++ b/app/assets/stylesheets/pdf.css.scss @@ -31,3 +31,47 @@ left: 2.5em; } } + +.att-pdf-cert { + background-color: $att-light-blue; + padding: 2em; + + .att-cert-box { + height: auto; + text-align: center; + border: none; + padding: 3rem; + background-color: $white; + color: $att-light-blue; + display: flex; + justify-content: space-between; + flex-direction: column; + + p { + font-size: 1.5em; + } + + h1 { + font-size: 3.5em; + margin: 0 0 1em 0; + } + + .name-fill { + border-bottom: 1px solid $att-light-blue; + width: 75%; + margin: 3em auto 1em auto; + } + + h2 { + font-size: 2.5em; + font-weight: lighter; + margin-bottom: 2em; + } + + img { + margin: 2em; + position: relative; + height: 5em; + } + } +} diff --git a/app/views/course_completions/custom_certificates/att.pdf.erb b/app/views/course_completions/custom_certificates/att.pdf.erb index 3510cb8a..7f59c85f 100644 --- a/app/views/course_completions/custom_certificates/att.pdf.erb +++ b/app/views/course_completions/custom_certificates/att.pdf.erb @@ -1,5 +1,5 @@
-
+

<%= t('completed_courses_page.certificate_of_completion') %>

diff --git a/app/views/layouts/pdf.html.erb b/app/views/layouts/pdf.html.erb index 085ee6da..0999cbe9 100644 --- a/app/views/layouts/pdf.html.erb +++ b/app/views/layouts/pdf.html.erb @@ -2,11 +2,7 @@ - <% if current_organization.custom_certificate_enabled? %> - <%= wicked_pdf_stylesheet_link_tag "#{current_organization.subdomain}_pdf" -%> - <% else %> - <%= wicked_pdf_stylesheet_link_tag "pdf" -%> - <% end %> + <%= wicked_pdf_stylesheet_link_tag "pdf" -%>

From 1ed10ae5e43be6c5ef9bdad52f0eb82202e0543d Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 16 Aug 2021 17:08:04 -0600 Subject: [PATCH 09/15] Test pdf change --- app/assets/stylesheets/pdf.css.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/stylesheets/pdf.css.scss b/app/assets/stylesheets/pdf.css.scss index c61a309e..92e4cb2d 100644 --- a/app/assets/stylesheets/pdf.css.scss +++ b/app/assets/stylesheets/pdf.css.scss @@ -9,6 +9,7 @@ h1 { font-size: 3.5em; margin: 1.5em 0; + color: red; } h2 { font-size: 2.5em; From 9060fe04f835e457fd7c481cd4b87ec19bb8dfef Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 16 Aug 2021 17:16:18 -0600 Subject: [PATCH 10/15] Try custom subsite pdf stylesheet again --- app/assets/stylesheets/application.css.scss | 1 + app/assets/stylesheets/att_pdf.css.scss | 45 +++++++++++++++++++ app/assets/stylesheets/pdf.css.scss | 45 ------------------- .../custom_certificates/att.pdf.erb | 2 +- app/views/layouts/pdf.html.erb | 6 ++- 5 files changed, 52 insertions(+), 47 deletions(-) create mode 100644 app/assets/stylesheets/att_pdf.css.scss diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 90a71e8e..85a5c1c4 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -23,3 +23,4 @@ @import "admin/custom/*"; @import "scaffolds"; @import "pdf"; +@import "att_pdf"; diff --git a/app/assets/stylesheets/att_pdf.css.scss b/app/assets/stylesheets/att_pdf.css.scss new file mode 100644 index 00000000..d396646e --- /dev/null +++ b/app/assets/stylesheets/att_pdf.css.scss @@ -0,0 +1,45 @@ +@import "vars"; + +.att-pdf-cert { + background-color: $att-light-blue; + padding: 2em; + + .cert-box { + height: auto; + text-align: center; + border: none; + padding: 3rem; + background-color: $white; + color: $att-light-blue; + display: flex; + justify-content: space-between; + flex-direction: column; + + p { + font-size: 1.5em; + } + + h1 { + font-size: 3.5em; + margin: 0 0 1em 0; + } + + .name-fill { + border-bottom: 1px solid $att-light-blue; + width: 75%; + margin: 3em auto 1em auto; + } + + h2 { + font-size: 2.5em; + font-weight: lighter; + margin-bottom: 2em; + } + + img { + margin: 2em; + position: relative; + height: 5em; + } + } +} diff --git a/app/assets/stylesheets/pdf.css.scss b/app/assets/stylesheets/pdf.css.scss index 92e4cb2d..b12c7590 100644 --- a/app/assets/stylesheets/pdf.css.scss +++ b/app/assets/stylesheets/pdf.css.scss @@ -9,7 +9,6 @@ h1 { font-size: 3.5em; margin: 1.5em 0; - color: red; } h2 { font-size: 2.5em; @@ -32,47 +31,3 @@ left: 2.5em; } } - -.att-pdf-cert { - background-color: $att-light-blue; - padding: 2em; - - .att-cert-box { - height: auto; - text-align: center; - border: none; - padding: 3rem; - background-color: $white; - color: $att-light-blue; - display: flex; - justify-content: space-between; - flex-direction: column; - - p { - font-size: 1.5em; - } - - h1 { - font-size: 3.5em; - margin: 0 0 1em 0; - } - - .name-fill { - border-bottom: 1px solid $att-light-blue; - width: 75%; - margin: 3em auto 1em auto; - } - - h2 { - font-size: 2.5em; - font-weight: lighter; - margin-bottom: 2em; - } - - img { - margin: 2em; - position: relative; - height: 5em; - } - } -} diff --git a/app/views/course_completions/custom_certificates/att.pdf.erb b/app/views/course_completions/custom_certificates/att.pdf.erb index 7f59c85f..3510cb8a 100644 --- a/app/views/course_completions/custom_certificates/att.pdf.erb +++ b/app/views/course_completions/custom_certificates/att.pdf.erb @@ -1,5 +1,5 @@
-
+

<%= t('completed_courses_page.certificate_of_completion') %>

diff --git a/app/views/layouts/pdf.html.erb b/app/views/layouts/pdf.html.erb index 0999cbe9..085ee6da 100644 --- a/app/views/layouts/pdf.html.erb +++ b/app/views/layouts/pdf.html.erb @@ -2,7 +2,11 @@ - <%= wicked_pdf_stylesheet_link_tag "pdf" -%> + <% if current_organization.custom_certificate_enabled? %> + <%= wicked_pdf_stylesheet_link_tag "#{current_organization.subdomain}_pdf" -%> + <% else %> + <%= wicked_pdf_stylesheet_link_tag "pdf" -%> + <% end %>

From a94ea75ce4bbcbd1b41ad99d50b11c9526a35cd0 Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 16 Aug 2021 17:23:05 -0600 Subject: [PATCH 11/15] Force asset rebuild --- config/deploy.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index 9ce6d735..4c26bc7f 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -79,7 +79,6 @@ set :linked_dirs, fetch(:linked_dirs, []).push( 'log', 'tmp/pids', - 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', From 1739d14ccb41b491104e3b066a2a9a4d837234bf Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 16 Aug 2021 17:32:37 -0600 Subject: [PATCH 12/15] Manually add pdf stylesheets to precompile list --- config/initializers/assets.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 03d0d655..1e787702 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -16,3 +16,5 @@ # folder are already added. # Rails.application.config.assets.precompile += %w( admin.js admin.css ) Rails.application.config.assets.precompile += %w(ckeditor/*) + +Rails.application.config.assets.precompile += ['pdf.css', 'att_pdf.css'] \ No newline at end of file From d60fcf4feaac01df2ca58780b66fb913f8b16f23 Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 16 Aug 2021 17:35:54 -0600 Subject: [PATCH 13/15] PDF color change test --- app/assets/stylesheets/pdf.css.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/pdf.css.scss b/app/assets/stylesheets/pdf.css.scss index b12c7590..c4951bca 100644 --- a/app/assets/stylesheets/pdf.css.scss +++ b/app/assets/stylesheets/pdf.css.scss @@ -5,7 +5,7 @@ border-color: $teal; height: 43.5em; text-align: center; - color: $dark-grey; + color: $red; h1 { font-size: 3.5em; margin: 1.5em 0; From f6f8e98eb3159420a399b5016abbf575223b0815 Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 16 Aug 2021 17:38:07 -0600 Subject: [PATCH 14/15] Revert PDF stylesheet change --- app/assets/stylesheets/pdf.css.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/app/assets/stylesheets/pdf.css.scss b/app/assets/stylesheets/pdf.css.scss index c4951bca..f9fc9f79 100644 --- a/app/assets/stylesheets/pdf.css.scss +++ b/app/assets/stylesheets/pdf.css.scss @@ -5,7 +5,6 @@ border-color: $teal; height: 43.5em; text-align: center; - color: $red; h1 { font-size: 3.5em; margin: 1.5em 0; From 609adbbccb3d39dbdffdf017ec48d8ec82e5d083 Mon Sep 17 00:00:00 2001 From: Tom Reis Date: Mon, 16 Aug 2021 17:42:29 -0600 Subject: [PATCH 15/15] Make default certificate text gray again --- app/assets/stylesheets/pdf.css.scss | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/assets/stylesheets/pdf.css.scss b/app/assets/stylesheets/pdf.css.scss index f9fc9f79..08c0adc0 100644 --- a/app/assets/stylesheets/pdf.css.scss +++ b/app/assets/stylesheets/pdf.css.scss @@ -5,10 +5,13 @@ border-color: $teal; height: 43.5em; text-align: center; + color: $grey; + h1 { font-size: 3.5em; margin: 1.5em 0; } + h2 { font-size: 2.5em; margin: 0.5em 0; @@ -20,10 +23,12 @@ color: $teal; } } + p { font-size: 1.5em; margin: 0.2em 0; } + img { position: absolute; bottom: 2em;