From 3aec488ad7601b677d576d48dc82d337f3670fd6 Mon Sep 17 00:00:00 2001 From: Luis Oliveira Date: Fri, 22 Oct 2021 03:17:38 -0300 Subject: [PATCH] Update text for "Join this course" button closes: LS-2735 flag=none test plan: - Enable K5 mode - Create a public self-enrollment enabled course - Visit that course - Check that the buttons for joining (in the confirmation and auth screens too) all refer to the subject as such, and not as course. E.g: Join this Subject instead of Join this Course Change-Id: I3f81e86cf9b7720006d9e9a74b5281c246295ad2 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276568 QA-Review: Robin Kuss Reviewed-by: Jackson Howe Product-Review: Luis Oliveira Tested-by: Service Cloud Jenkins --- .../self_enrollments/_already_enrolled.html.erb | 4 +++- .../self_enrollments/_authenticate.html.erb | 4 +++- .../_authenticate_or_register.html.erb | 4 +++- .../_confirm_enrollments.html.erb | 4 +++- .../_successfully_enrolled.html.erb | 4 +++- ui/features/k5_course/react/K5Course.js | 12 ++++++------ .../k5_course/react/__tests__/K5Course.test.js | 16 ++++++++-------- 7 files changed, 29 insertions(+), 19 deletions(-) diff --git a/app/views/self_enrollments/_already_enrolled.html.erb b/app/views/self_enrollments/_already_enrolled.html.erb index d4d63e01de857..ed57c264d67e3 100644 --- a/app/views/self_enrollments/_already_enrolled.html.erb +++ b/app/views/self_enrollments/_already_enrolled.html.erb @@ -16,6 +16,8 @@ # with this program. If not, see . %> +<% go_to_course_text = @course.elementary_enabled? ? t("Go to Subject") : t("buttons.go_to_course", "Go to the Course") %> +

<%= mt :already_enrolled, "You are already enrolled in **%{course}**.", :course => @course.name %>

@@ -25,7 +27,7 @@ <% if @course.user_is_student?(@current_user) # i.e. *current* student, the course has started %> <%= t "buttons.go_to_dashboard", "Go to your Dashboard" %> - <%= t "buttons.go_to_course", "Go to the Course" %> + <%= go_to_course_text %> <% else %> <%= t "buttons.go_to_dashboard", "Go to your Dashboard" %> <% end %> diff --git a/app/views/self_enrollments/_authenticate.html.erb b/app/views/self_enrollments/_authenticate.html.erb index c030a9d06f37d..cd45eab4e1e67 100644 --- a/app/views/self_enrollments/_authenticate.html.erb +++ b/app/views/self_enrollments/_authenticate.html.erb @@ -16,6 +16,8 @@ # with this program. If not, see . %> +<% enrollment_cta_text = @course.elementary_enabled? ? t("Enroll in Subject") : t("buttons.enroll_in_course", "Enroll in Course") %> +
<%= registration_summary || content_tag(:div, mt(:getting_started, "You are enrolling in **%{course}**.", :course => @course.name)) %> @@ -38,7 +40,7 @@ <%= t '#site.view_privacy_policy', 'View Privacy Policy' %>
diff --git a/app/views/self_enrollments/_authenticate_or_register.html.erb b/app/views/self_enrollments/_authenticate_or_register.html.erb index 6b3b588a9f774..3d9144f193f31 100644 --- a/app/views/self_enrollments/_authenticate_or_register.html.erb +++ b/app/views/self_enrollments/_authenticate_or_register.html.erb @@ -16,6 +16,8 @@ # with this program. If not, see . %> +<% enrollment_cta_text = @course.elementary_enabled? ? t("Enroll in Subject") : t("buttons.enroll_in_course", "Enroll in Course") %> + <%= registration_summary || content_tag(:div, mt(:getting_started, "You are enrolling in **%{course}**.", :course => @course.name)) %>

<%= t("Please enter your %{label_name}:", :label_name => @login_label_name) %>

@@ -71,7 +73,7 @@ <%= t '#site.view_privacy_policy', 'View Privacy Policy' %> diff --git a/app/views/self_enrollments/_confirm_enrollments.html.erb b/app/views/self_enrollments/_confirm_enrollments.html.erb index edd6ba24ac6e6..2ef87b75ef39a 100644 --- a/app/views/self_enrollments/_confirm_enrollments.html.erb +++ b/app/views/self_enrollments/_confirm_enrollments.html.erb @@ -16,6 +16,8 @@ # with this program. If not, see . %> +<% enrollment_cta_text = @course.elementary_enabled? ? t("Enroll in Subject") : t("buttons.enroll_in_course", "Enroll in Course") %> +
<%= registration_summary || content_tag(:div, mt(:getting_started, "You are enrolling in **%{course}**", :course => @course.name)) %> @@ -27,7 +29,7 @@ diff --git a/app/views/self_enrollments/_successfully_enrolled.html.erb b/app/views/self_enrollments/_successfully_enrolled.html.erb index 92fac1cff6322..9585fdcb809d9 100644 --- a/app/views/self_enrollments/_successfully_enrolled.html.erb +++ b/app/views/self_enrollments/_successfully_enrolled.html.erb @@ -16,6 +16,8 @@ # with this program. If not, see . %> +<% go_to_course_text = @course.elementary_enabled? ? t("Go to Subject") : t("buttons.go_to_course", "Go to the Course") %> +

<%= mt :already_enrolled, "You have successfully enrolled in **%{course}**.", :course => @course.name %>

@@ -27,7 +29,7 @@
diff --git a/ui/features/k5_course/react/K5Course.js b/ui/features/k5_course/react/K5Course.js index 1864c2ea8b1f7..4bee2d52e709d 100644 --- a/ui/features/k5_course/react/K5Course.js +++ b/ui/features/k5_course/react/K5Course.js @@ -151,7 +151,7 @@ const ConfirmDropModal = ({isModalOpen, closeModal, courseName, dropLink}) => { closeModal() window.location.reload() }) - .catch(err => showFlashError(I18n.t('Unable to drop the course'))(err)) + .catch(err => showFlashError(I18n.t('Unable to drop the subject'))(err)) .finally(() => setPosting(false)) } @@ -165,7 +165,7 @@ const ConfirmDropModal = ({isModalOpen, closeModal, courseName, dropLink}) => { {isPosting ? ( - + ) : ( <> @@ -174,7 +174,7 @@ const ConfirmDropModal = ({isModalOpen, closeModal, courseName, dropLink}) => { {I18n.t( - 'Are you sure you want to unenroll in this course? You will no longer be able to see the course roster or communicate directly with the teachers, and you will no longer see course events in your stream and as notifications.' + 'Are you sure you want to unenroll in this subject? You will no longer be able to see the subject roster or communicate directly with the teachers, and you will no longer see subject events in your stream and as notifications.' )} @@ -194,7 +194,7 @@ const ConfirmDropModal = ({isModalOpen, closeModal, courseName, dropLink}) => { onClick={handleConfirm} interaction={!isPosting ? 'enabled' : 'disabled'} > - {I18n.t('Drop this Course')} + {I18n.t('Drop this Subject')} @@ -250,13 +250,13 @@ export const CourseHeaderHero = forwardRef( {selfEnrollment?.option === 'enroll' && ( )} {selfEnrollment?.option === 'unenroll' && ( <> { url: 'http://enroll_url/' } const {getByRole} = render() - const button = getByRole('link', {name: 'Join this Course'}) + const button = getByRole('link', {name: 'Join this Subject'}) expect(button).toBeInTheDocument() expect(button.href).toBe('http://enroll_url/') }) @@ -409,14 +409,14 @@ describe('K-5 Subject Course', () => { const {getByRole, getByText} = render( ) - const button = getByRole('button', {name: 'Drop this Course'}) + const button = getByRole('button', {name: 'Drop this Subject'}) expect(button).toBeInTheDocument() act(() => button.click()) expect(getByText('Drop Arts and Crafts')).toBeInTheDocument() expect(getByText('Confirm Unenrollment')).toBeInTheDocument() expect( getByText( - 'Are you sure you want to unenroll in this course? You will no longer be able to see the course roster or communicate directly with the teachers, and you will no longer see course events in your stream and as notifications.' + 'Are you sure you want to unenroll in this subject? You will no longer be able to see the subject roster or communicate directly with the teachers, and you will no longer see subject events in your stream and as notifications.' ) ).toBeInTheDocument() expect(getByRole('button', {name: 'Cancel'})).toBeInTheDocument() @@ -431,19 +431,19 @@ describe('K-5 Subject Course', () => { const {getByRole, getAllByRole, getByText} = render( ) - const openModalButton = getByRole('button', {name: 'Drop this Course'}) + const openModalButton = getByRole('button', {name: 'Drop this Subject'}) act(() => openModalButton.click()) - const dropButton = getAllByRole('button', {name: 'Drop this Course'})[1] + const dropButton = getAllByRole('button', {name: 'Drop this Subject'})[1] act(() => dropButton.click()) - expect(getByText('Dropping course')).toBeInTheDocument() + expect(getByText('Dropping subject')).toBeInTheDocument() expect(fetchMock.called(selfEnrollment.url)).toBeTruthy() }) it('renders neither if selfEnrollment is nil', () => { const {getByText, queryByText} = render() expect(getByText('Arts and Crafts')).toBeInTheDocument() - expect(queryByText('Join this Course')).not.toBeInTheDocument() - expect(queryByText('Drop this Course')).not.toBeInTheDocument() + expect(queryByText('Join this Subject')).not.toBeInTheDocument() + expect(queryByText('Drop this Subject')).not.toBeInTheDocument() }) })