make banner have link to accept course invitation

Test Plan
- Create a course and add a student to it
- As the student navigate to the course
- A banner should render with a link to join the course
- Clicking the link should enroll the student in the course and refresh
  the page

fixes WOKE-86

Change-Id: Ied59e8683550d2337c10584ffccf14edf0f471a7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/217176
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Tested-by: Jenkins
This commit is contained in:
Matthew Lemon 2019-11-13 16:19:50 -07:00 committed by Steven Burnett
parent 8483304dcf
commit 6c6250861d
1 changed files with 7 additions and 4 deletions

View File

@ -948,13 +948,16 @@ class ApplicationController < ActionController::Base
case state
when :invited
if @context_enrollment.available_at
flash[:html_notice] = mt "You'll need to accept the enrollment invitation before you can fully participate in this course, starting on %{date}.",
:date => datetime_string(@context_enrollment.available_at)
flash[:html_notice] = t("You'll need to *accept the enrollment invitation* before you can fully participate in this course, starting on %{date}.",
:wrapper => view_context.link_to('\1', '#', 'data-method' => 'POST', 'data-url' => course_enrollment_invitation_url(@context, accept: true)),
:date => datetime_string(@context_enrollment.available_at))
else
flash[:html_notice] = mt "You'll need to accept the enrollment invitation before you can fully participate in this course."
flash[:html_notice] = t("You'll need to *accept the enrollment invitation* before you can fully participate in this course.",
:wrapper => view_context.link_to('\1', '#', 'data-method' => 'POST', 'data-url' => course_enrollment_invitation_url(@context, accept: true)))
end
when :accepted
flash[:html_notice] = t("This course hasnt started yet. You will not be able to participate in this course until %{date}.", :date => datetime_string(@context_enrollment.available_at))
flash[:html_notice] = t("This course hasnt started yet. You will not be able to participate in this course until %{date}.",
:date => datetime_string(@context_enrollment.available_at))
end
end
end