various i18n fixes
these weren't getting translated, since the I18n.t calls would only happen when the files were first loaded test plan: 1. run canvas w/ RAILS_LOAD_ALL_LOCALES=true 2. switch to spanish 3. as a student, confirm that peer review tooltips are translated 4. as a teacher, go to a student's grade summary page 1. use a screenreader 2. confirm "pass"/"fail" are translated 3. confirm submission types for ungraded assignments are translated 5. on an assignment with multiple due dates, confirm that the "Multiple Due Dates" link is translated Change-Id: I5599caac628a0d4b962ff2a5fe74ba24374fb33b Reviewed-on: https://gerrit.instructure.com/42784 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Simon Williams <simon@instructure.com> QA-Review: Sean Lewis <slewis@instructure.com> Product-Review: Jon Jensen <jon@instructure.com>
This commit is contained in:
parent
daf2e51c9a
commit
4fb6d79e4c
|
@ -17,16 +17,19 @@
|
|||
#
|
||||
|
||||
module AssignmentsHelper
|
||||
PEER_REVIEW_LINK_OPTIONS = {
|
||||
completed: {
|
||||
def completed_link_options
|
||||
{
|
||||
class: 'pass',
|
||||
title: I18n.t('tooltips.finished', 'finished'),
|
||||
},
|
||||
in_progress: {
|
||||
class: 'warning',
|
||||
title: I18n.t('tooltips.incomplete', 'incomplete'),
|
||||
title: I18n.t('tooltips.finished', 'finished')
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def in_progress_link_options
|
||||
{
|
||||
class: 'warning',
|
||||
title: I18n.t('tooltips.incomplete', 'incomplete')
|
||||
}
|
||||
end
|
||||
|
||||
def multiple_due_dates(assignment)
|
||||
# can use this method as the single source of rendering multiple due dates
|
||||
|
@ -36,7 +39,7 @@ module AssignmentsHelper
|
|||
end
|
||||
|
||||
def student_peer_review_link_for(context, assignment, assessment)
|
||||
link_options = assessment.completed? ? PEER_REVIEW_LINK_OPTIONS[:completed] : PEER_REVIEW_LINK_OPTIONS[:in_progress]
|
||||
link_options = assessment.completed? ? completed_link_options : in_progress_link_options
|
||||
link_to assessment.asset_user_name, context_url(context, :context_assignment_submission_url, assignment.id, assessment.asset.user_id), link_options
|
||||
end
|
||||
|
||||
|
|
|
@ -17,43 +17,54 @@
|
|||
#
|
||||
|
||||
module GradebooksHelper
|
||||
UNGRADED_SUBMISSION_ICON_ATTRIBUTES = {
|
||||
'online_url' => {
|
||||
:icon_class => 'icon-link',
|
||||
:screenreader_text => I18n.t('icons.online_url_submission', 'Online Url Submission')
|
||||
},
|
||||
'online_text_entry' => {
|
||||
:icon_class => 'icon-text',
|
||||
:screenreader_text => I18n.t('icons.text_entry_submission', 'Text Entry Submission')
|
||||
},
|
||||
'online_upload' => {
|
||||
:icon_class => 'icon-document',
|
||||
:screenreader_text => I18n.t('icons.file_upload_submission', 'File Upload Submission')
|
||||
},
|
||||
'discussion_topic' => {
|
||||
:icon_class => 'icon-discussion',
|
||||
:screenreader_text => I18n.t('icons.discussion_submission', 'Discussion Submission')
|
||||
},
|
||||
'online_quiz' => {
|
||||
:icon_class => 'icon-quiz',
|
||||
:screenreader_text => I18n.t('icons.quiz_submission', 'Quiz Submission')
|
||||
},
|
||||
'media_recording' => {
|
||||
:icon_class => 'icon-filmstrip',
|
||||
:screenreader_text => I18n.t('icons.media_submission', 'Media Submission')
|
||||
},
|
||||
}
|
||||
def ungraded_submission_icon_attributes_for(submission_type)
|
||||
case submission_type
|
||||
when 'online_url'
|
||||
{
|
||||
:icon_class => 'icon-link',
|
||||
:screenreader_text => I18n.t('icons.online_url_submission', 'Online Url Submission')
|
||||
}
|
||||
when 'online_text_entry'
|
||||
{
|
||||
:icon_class => 'icon-text',
|
||||
:screenreader_text => I18n.t('icons.text_entry_submission', 'Text Entry Submission')
|
||||
}
|
||||
when 'online_upload'
|
||||
{
|
||||
:icon_class => 'icon-document',
|
||||
:screenreader_text => I18n.t('icons.file_upload_submission', 'File Upload Submission')
|
||||
}
|
||||
when 'discussion_topic'
|
||||
{
|
||||
:icon_class => 'icon-discussion',
|
||||
:screenreader_text => I18n.t('icons.discussion_submission', 'Discussion Submission')
|
||||
}
|
||||
when 'online_quiz'
|
||||
{
|
||||
:icon_class => 'icon-quiz',
|
||||
:screenreader_text => I18n.t('icons.quiz_submission', 'Quiz Submission')
|
||||
}
|
||||
when 'media_recording'
|
||||
{
|
||||
:icon_class => 'icon-filmstrip',
|
||||
:screenreader_text => I18n.t('icons.media_submission', 'Media Submission')
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
PASS_FAIL_ICON_ATTRIBUTES = {
|
||||
pass: {
|
||||
def pass_icon_attributes
|
||||
{
|
||||
icon_class: 'icon-check',
|
||||
screenreader_text: I18n.t('#gradebooks.grades.complete', 'Complete'),
|
||||
},
|
||||
fail: {
|
||||
}
|
||||
end
|
||||
|
||||
def fail_icon_attributes
|
||||
{
|
||||
icon_class: 'icon-x',
|
||||
screenreader_text: I18n.t('#gradebooks.grades.incomplete', 'Incomplete'),
|
||||
},
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def display_grade(grade)
|
||||
grade.blank? ? "--" : grade
|
||||
|
@ -84,7 +95,7 @@ module GradebooksHelper
|
|||
end
|
||||
|
||||
def ungraded_submission_display(submission_type)
|
||||
sub_score = UNGRADED_SUBMISSION_ICON_ATTRIBUTES[submission_type]
|
||||
sub_score = ungraded_submission_icon_attributes_for(submission_type)
|
||||
if sub_score
|
||||
screenreadable_icon(sub_score, %w{submission_icon})
|
||||
else
|
||||
|
@ -94,9 +105,9 @@ module GradebooksHelper
|
|||
|
||||
def pass_fail_icon(score, grade)
|
||||
if score && score > 0 || grade == "complete"
|
||||
icon_attrs = PASS_FAIL_ICON_ATTRIBUTES[:pass]
|
||||
icon_attrs = pass_icon_attributes
|
||||
else
|
||||
icon_attrs = PASS_FAIL_ICON_ATTRIBUTES[:fail]
|
||||
icon_attrs = fail_icon_attributes
|
||||
end
|
||||
screenreadable_icon(icon_attrs, %w{graded_icon})
|
||||
end
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
class OverrideTooltipPresenter < OverrideListPresenter
|
||||
|
||||
DEFAULT_MAX_DATES = 10
|
||||
DEFAULT_LINK_TEXT = I18n.t('#assignments.multiple_due_dates', 'Multiple Due Dates')
|
||||
|
||||
def initialize(assignment=nil, user=nil, opts={})
|
||||
super(assignment, user)
|
||||
@opts = opts
|
||||
end
|
||||
|
||||
def default_link_text
|
||||
I18n.t('#assignments.multiple_due_dates', 'Multiple Due Dates')
|
||||
end
|
||||
|
||||
def link_text
|
||||
@opts[:text] || self.class::DEFAULT_LINK_TEXT
|
||||
@opts[:text] || default_link_text
|
||||
end
|
||||
|
||||
def link_href
|
||||
|
@ -59,4 +62,4 @@ class OverrideTooltipPresenter < OverrideListPresenter
|
|||
}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue