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 b12c7590..08c0adc0 100644 --- a/app/assets/stylesheets/pdf.css.scss +++ b/app/assets/stylesheets/pdf.css.scss @@ -5,11 +5,13 @@ border-color: $teal; height: 43.5em; text-align: center; - color: $dark-grey; + color: $grey; + h1 { font-size: 3.5em; margin: 1.5em 0; } + h2 { font-size: 2.5em; margin: 0.5em 0; @@ -21,10 +23,12 @@ color: $teal; } } + p { font-size: 1.5em; margin: 0.2em 0; } + img { position: absolute; bottom: 2em; 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 { 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/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/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 %> 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 %>
diff --git a/app/views/shared/_course_intro_text.html.erb b/app/views/shared/_course_intro_text.html.erb index d505ee95..4e02793f 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/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', 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 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)