canvas-lms/app/views/outcomes/user_outcome_results.html.erb

130 lines
4.5 KiB
Plaintext
Raw Normal View History

<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>
<% provide :right_side do %>
<div class="rs-margin-bottom">
<% chain = (@context.account_chain rescue [@domain_root_account]).select{|a| can_do(a, @current_user, :manage) }; %>
<% if !chain.empty? %>
<%= before_label :see_results, "See %{user_name}'s results for", :user_name => @user.short_name %>
<ul>
<% chain.each do |account| %>
<li><a href="<%= context_url(account, :context_user_outcomes_results_url, @user.id) %>"><%= account.name %></a></li>
<% end %>
</ul>
<% end %>
</div>
<div class="show_all_artificts">
<a href="#" class="btn button-sidebar-wide" id="show_all_artifacts_link"><%= t "#buttons.show_all_artifacts", "Show All Artifacts" %></a>
</div>
<% end %>
<style>
#outcomes th {
background-color: #444;
color: #eee;
padding: 5px 5px;
font-size: 1.2em;
text-align: center;
}
#outcomes th.outcome {
text-align: <%= direction('left') %>;
}
#outcomes td {
padding: 2px 5px;
text-align: center;
border-bottom: 1px dotted #ccc;
}
#outcomes .short_description {
text-align: <%= direction('left') %>;
min-width: 150px;
}
#outcomes .attempts .sub_attempt {
font-size: 0.8em;
}
#outcomes .latest_score {
white-space: nowrap;
}
#outcomes .out_of {
font-size: 0.8em;
}
#outcomes .latest_score.mastery {
background-color: #efe;
}
#outcomes .latest_score {
background-color: #fee;
}
#outcomes td#outcome_results {
text-align: <%= direction('left') %>;
}
</style>
<% js_bundle 'user_outcome_results' %>
Accessibility: Fix and add to heading structure across Canvas Fixes CNVS-14293 Test plan: Visit the following pages and verify that each: - has an unaltered visual appearance - has exactly one level 1 heading which can be navigated to by screen readers - When appropriate (I.E. when the length or organization of the page warrents it) has lower level headings which can be navigated to by screen readers - when lower level headings are present, heading levels proceed in order, and logically The following pages should be verified to confirm they meet the above criteria. Note that the URL fragments provided may not be reachable on all installs, and should be modified appropriately. - /courses/1/assignments - /courses/1/assignments/18 - /courses/1/discussion_topics (Sections should be level 2, individual discussions level 3.) - /courses/1/users/prior - /courses/1/pages/front-page - /courses/1/pages/front-page/revisions - /courses/1/assignments/syllabus - /courses/1/outcomes - /courses/1/rubrics - /courses/1/quizzes/11/take?preview=1 - /courses/1/quizzes/11/moderate - /courses/1/question_banks - /courses/1/modules - /courses/1/statistics - /courses/1/confirm_action?event=conclude - /courses/1/copy - /courses/1/content_migrations - /courses/1/content_exports - /courses/1/content_exports - /profile/communication - /users/2/user_notes - /courses/1/users/1/usage - /courses/1/announcements - An additional heading can be seen by loading the page when no announcements exist. - /courses/1/pages - /courses/1/files - /courses/1/quizzes - /courses/1/settings - /dashboard/files - /courses/1/outcomes/users/1 Change-Id: I26d7dba115105c36026758cf55644139116224ec Reviewed-on: https://gerrit.instructure.com/37669 Tested-by: Jenkins <jenkins@instructure.com> QA-Review: Nathan Rogowski <nathan@instructure.com> Reviewed-by: Ryan Florence <ryanf@instructure.com> Product-Review: Simon Williams <simon@instructure.com>
2014-07-09 00:32:57 +08:00
<h1 class="screenreader-only"><%= t :outcomes_for, "Outcomes for %{user_name}", :user_name => @user.name %></h1>
<table id="outcomes">
<thead>
<tr>
<th class="outcome"><%= t "short_title.outcome", "Outcome" %></th>
<th><%= t "short_title.attempts", "Attempts" %></th>
<th><%= t "short_title.latest_score", "Latest Score" %></th>
<th><%= t "short_title.average_percent", "Avg Percent" %></th>
</thead>
<tbody>
<% @outcomes.each do |outcome| %>
<tr>
<td class="short_description"><%= outcome.short_description %></td>
<% results = @results_for_outcome[outcome.id] || [] %>
<td class="attempts">
<%= t :attempts_from_artifacts, "%{attempts} *from %{artifacts}*", :wrapper => '<div class="sub_attempt">\1</div>', :attempts => t(:attempts, "attempt", :count => results.map{|r| [1, r.attempt || 0].max }.sum), :artifacts => t(:artifacts, "artifact", :count => results.length) %>
</td>
<td class="latest_score <%= 'mastery' if results[-1] && results[-1].mastery %>" title="<%= (results[-1] && results[-1].mastery) ? t(:mastery, "Mastery on latest attempt") : t(:no_mastery, "No Mastery on latest attempt") %>">
<% if results.empty? %>
-
<% else %>
<% if results[-1].possible %>
<%= t :score_out_of_possible, "%{score}* out of %{possible}*", :score => results[-1].score, :possible => results[-1].possible, :wrapper => '<span class="out_of">\1</span>' %>
<% else %>
<%= results[-1].score %><span class="out_of"></span>
<% end %>
<% end %>
</td>
<td class="avg_percent">
<% results_with_percent = results.select { |r| r.percent.present? }
if results_with_percent.empty? %>
-
<% else %>
<%= results_with_percent.map(&:percent).sum.to_f * 100.0 / results.length.to_f %>%
<% end %>
</td>
</tr>
<% unless results.empty? %>
<tr class="artifact_details" style="display: none;">
<td colspan="4" id="outcome_results">
<ul id="outcome_results_list">
<% results.each do |result| %>
<%= render :partial => "outcome_result", :locals => { :outcome_result => result, :show_results_link => false } %>
<% end %>
</ul>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<%= render :partial => "shared/rubric_criterion_dialog" %>