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 <rkuss@instructure.com> Reviewed-by: Jackson Howe <jackson.howe@instructure.com> Product-Review: Luis Oliveira <luis.oliveira@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit is contained in:
parent
741ae8d333
commit
3aec488ad7
|
@ -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>
|
||||
|
||||
|
@ -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 %>
|
||||
|
|
|
@ -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)) %>
|
||||
|
||||
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
@ -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>
|
||||
|
|
|
@ -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)) %>
|
||||
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
|
|
@ -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}) => {
|
|||
<Modal.Body>
|
||||
{isPosting ? (
|
||||
<View as="div" textAlign="center" margin="medium 0">
|
||||
<Spinner renderTitle={I18n.t('Dropping course')} />
|
||||
<Spinner renderTitle={I18n.t('Dropping subject')} />
|
||||
</View>
|
||||
) : (
|
||||
<>
|
||||
|
@ -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>
|
||||
</>
|
||||
|
@ -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>
|
||||
|
@ -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}
|
||||
|
|
|
@ -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/')
|
||||
})
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue