Skip to content

Commit

Permalink
Update text for "Join this course" button
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Jackson Howe <[email protected]>
Product-Review: Luis Oliveira <[email protected]>
Tested-by: Service Cloud Jenkins <[email protected]>
  • Loading branch information
Luis Oliveira committed Oct 26, 2021
1 parent 741ae8d commit 3aec488
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 19 deletions.
4 changes: 3 additions & 1 deletion app/views/self_enrollments/_already_enrolled.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<% go_to_course_text = @course.elementary_enabled? ? t("Go to Subject") : t("buttons.go_to_course", "Go to the Course") %>

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

Expand All @@ -25,7 +27,7 @@
<% if @course.user_is_student?(@current_user)
# i.e. *current* student, the course has started %>
<a class="btn" href="<%= dashboard_url %>" target="_top"><%= t "buttons.go_to_dashboard", "Go to your Dashboard" %></a>
<a class="btn btn-primary" href="<%= course_url(@course) %>" target="_top"><%= t "buttons.go_to_course", "Go to the Course" %></a>
<a class="btn btn-primary" href="<%= course_url(@course) %>" target="_top"><%= go_to_course_text %></a>
<% else %>
<a class="btn btn-primary" href="<%= dashboard_url %>" target="_top"><%= t "buttons.go_to_dashboard", "Go to your Dashboard" %></a>
<% end %>
Expand Down
4 changes: 3 additions & 1 deletion app/views/self_enrollments/_authenticate.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<% enrollment_cta_text = @course.elementary_enabled? ? t("Enroll in Subject") : t("buttons.enroll_in_course", "Enroll in Course") %>

<form action="<%= self_enrollment_url %>" method="post" id="enroll_form" class="ic-Self-enrollment-form">
<%= registration_summary || content_tag(:div, mt(:getting_started, "You are enrolling in **%{course}**.", :course => @course.name)) %>

Expand All @@ -38,7 +40,7 @@
<a href="<%= privacy_policy_url %>" target="_blank" class="footer-info"><%= t '#site.view_privacy_policy', 'View Privacy Policy' %></a>
</div>
<div class="ic-Self-enrollment-footer__Primary">
<button class="btn btn-primary" type="submit"><%= @confirm_enrollment_url ? t("buttons.next", "Next") : t("buttons.enroll_in_course", "Enroll in Course") %></button>
<button class="btn btn-primary" type="submit"><%= @confirm_enrollment_url ? t("buttons.next", "Next") : enrollment_cta_text %></button>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<% enrollment_cta_text = @course.elementary_enabled? ? t("Enroll in Subject") : t("buttons.enroll_in_course", "Enroll in Course") %>

<form action="<%= self_enrollment_url %>" method="post" id="enroll_form" class="ic-Self-enrollment-form">
<%= registration_summary || content_tag(:div, mt(:getting_started, "You are enrolling in **%{course}**.", :course => @course.name)) %>
<p><%= t("Please enter your %{label_name}:", :label_name => @login_label_name) %></p>
Expand Down Expand Up @@ -71,7 +73,7 @@
<a href="<%= privacy_policy_url %>" target="_blank" class="footer-info"><%= t '#site.view_privacy_policy', 'View Privacy Policy' %></a>
</div>
<div class="ic-Self-enrollment-footer__Primary">
<button class="btn btn-primary" style="visibility: hidden" id="submit_button" type="submit"><%= @confirm_enrollment_url ? t("buttons.next", "Next") : t("buttons.enroll_in_course", "Enroll in Course") %></button>
<button class="btn btn-primary" style="visibility: hidden" id="submit_button" type="submit"><%= @confirm_enrollment_url ? t("buttons.next", "Next") : enrollment_cta_text %></button>
</div>
</div>
</form>
4 changes: 3 additions & 1 deletion app/views/self_enrollments/_confirm_enrollments.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<% enrollment_cta_text = @course.elementary_enabled? ? t("Enroll in Subject") : t("buttons.enroll_in_course", "Enroll in Course") %>

<form action="<%= self_enrollment_url %>" method="post" class="ic-Self-enrollment-form" id="enroll_form">
<input type="hidden" name="initial_action" value="enroll">
<%= registration_summary || content_tag(:div, mt(:getting_started, "You are enrolling in **%{course}**", :course => @course.name)) %>
Expand All @@ -27,7 +29,7 @@
</div>
<div class="ic-Self-enrollment-footer__Primary">
<button class="btn btn-primary" type="submit">
<%= @confirm_enrollment_url ? t("buttons.next", "Next") : t("buttons.enroll_in_course", "Enroll in Course") %>
<%= @confirm_enrollment_url ? t("buttons.next", "Next") : enrollment_cta_text %>
</button>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion app/views/self_enrollments/_successfully_enrolled.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<% go_to_course_text = @course.elementary_enabled? ? t("Go to Subject") : t("buttons.go_to_course", "Go to the Course") %>

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

Expand All @@ -27,7 +29,7 @@
<div class="ic-Self-enrollment-footer__Primary">
<%= @extra_actions %>
<a class="btn" href="<%= dashboard_url(:registration_success => params[:just_created]) %>" target="_top"><%= t "buttons.go_to_dashboard", "Go to your Dashboard" %></a>
<a class="btn btn-primary" href="<%= course_url(@course, :registration_success => params[:just_created]) %>" target="_top"><%= t "buttons.go_to_course", "Go to the Course" %></a>
<a class="btn btn-primary" href="<%= course_url(@course, :registration_success => params[:just_created]) %>" target="_top"><%= go_to_course_text %></a>
</div>
</div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions ui/features/k5_course/react/K5Course.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand All @@ -165,7 +165,7 @@ const ConfirmDropModal = ({isModalOpen, closeModal, courseName, dropLink}) => {
<Modal.Body>
{isPosting ? (
<View as="div" textAlign="center" margin="medium 0">
<Spinner renderTitle={I18n.t('Dropping course')} />
<Spinner renderTitle={I18n.t('Dropping subject')} />
</View>
) : (
<>
Expand All @@ -174,7 +174,7 @@ const ConfirmDropModal = ({isModalOpen, closeModal, courseName, dropLink}) => {
</Heading>
<Text>
{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.'
)}
</Text>
</>
Expand All @@ -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')}
</Button>
</Modal.Footer>
</Modal>
Expand Down Expand Up @@ -250,13 +250,13 @@ export const CourseHeaderHero = forwardRef(
<Flex.Item>
{selfEnrollment?.option === 'enroll' && (
<Button color="primary" renderIcon={IconAddLine} href={selfEnrollment.url}>
{I18n.t('Join this Course')}
{I18n.t('Join this Subject')}
</Button>
)}
{selfEnrollment?.option === 'unenroll' && (
<>
<Button renderIcon={IconXLine} onClick={() => setModalOpen(true)}>
{I18n.t('Drop this Course')}
{I18n.t('Drop this Subject')}
</Button>
<ConfirmDropModal
isModalOpen={isModalOpen}
Expand Down
16 changes: 8 additions & 8 deletions ui/features/k5_course/react/__tests__/K5Course.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ describe('K-5 Subject Course', () => {
url: 'http://enroll_url/'
}
const {getByRole} = render(<K5Course {...defaultProps} selfEnrollment={selfEnrollment} />)
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/')
})
Expand All @@ -409,14 +409,14 @@ describe('K-5 Subject Course', () => {
const {getByRole, getByText} = render(
<K5Course {...defaultProps} selfEnrollment={selfEnrollment} />
)
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()
Expand All @@ -431,19 +431,19 @@ describe('K-5 Subject Course', () => {
const {getByRole, getAllByRole, getByText} = render(
<K5Course {...defaultProps} selfEnrollment={selfEnrollment} />
)
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(<K5Course {...defaultProps} />)
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()
})
})

Expand Down

0 comments on commit 3aec488

Please sign in to comment.