Skip to content

Commit

Permalink
Merge branch 'report_card_summary'
Browse files Browse the repository at this point in the history
  • Loading branch information
rnhurt committed Feb 21, 2010
2 parents 631ec8a + 6b43f48 commit f39a993
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 8 deletions.
15 changes: 9 additions & 6 deletions app/controllers/evaluations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,31 @@ def show
format.js {
# OPTIMIZE: Could this be moved to individual *.js.erb files??
case params[:tab]
when "assignments"
when 'assignments'
@assignments = Assignment.paginate_by_course_term_id(@course_term,
:per_page => 6,
:page => params[:page],
:order => "due_date DESC, created_at ASC",
:include => :assignment_evaluations)
@scalerange = ScaleRange.find_all_by_grading_scale_id(@course_term.course.grading_scale_id)

render :partial => "assignments"
render :partial => 'assignments'

when "skills"
when 'skills'
@ctskills = @course_term.course_term_skills.paginate(
:per_page => 5,
:page => params[:page],
:include => [:supporting_skill, :supporting_skill_evaluations])

render :partial => "skills"
render :partial => 'skills'

when"comments"
when 'comments'
@quick_comments = Comment.quick.active

render :partial => "comments"
render :partial => 'comments'

when 'summary'
render :partial => 'summary'
else
end
}
Expand Down
1 change: 1 addition & 0 deletions app/views/evaluations/_form_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ window.processPage = function(mode) {
} else if (mode == 'comments'){
controlKeyboard('comments_grid');
restrictSubmit('comments_grid');
} else if (mode == 'summary'){
} else { alert("WARNING - mode not defined: " + mode); }

$('loading').hide();
Expand Down
38 changes: 38 additions & 0 deletions app/views/evaluations/_summary.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<table class="simple box">

<% @course_term.students.each do |student| %>
<% grade = @course_term.calculate_grade(student) %>
<thead>
<tr>
<td>
<%= h "#{grade[:letter]} (#{grade[:score].round}%) - #{student.full_name}" %>
</td>
<td></td><td></td>
</tr>
</thead>
<tr>
<td colspan="3">
"<%= h @course_term.comments(student) %>"
</td>
</tr>


<% @course_term.course_term_skills.in_groups_of(3, "blah") do |row_ctskills| %>
<tr>
<% for ctskill in row_ctskills %>
<% score = ctskill.score(student) %>
<td>
<%= score.empty? ? "&nbsp;&nbsp;" : score %>
<%= h " \"#{ctskill.supporting_skill.description}\"" %>
</td>
<% end %>
</tr>
<% end %>

<tr class="spacer"><td colspan="3">&nbsp;</td></tr>
<% end %>

</table>


<%= javascript_tag "this.processPage('summary');" %>
12 changes: 10 additions & 2 deletions app/views/evaluations/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
<li class="tab"><a href="#assignments">Assignments</a></li>
<li class="tab"><a href="#skills">Supporting Skills</a></li>
<li class="tab"><a href="#comments">Comments</a></li>
<li class="tab"><a href="#summary">Summary</a></li>
</ul>

<div id="assignments"></div>
<div id="skills"></div>
<div id="comments"></div>
<div id="summary"></div>

<%= link_to_remote '', { :update => "assignments",
:method => "get",
Expand All @@ -33,6 +35,12 @@
:url => { :tab => "comments", :controller => "evaluations", :action => "show", :id => @course_term.id } },
:id => 'tab_comments' -%>
<%= link_to_remote '', { :update => "summary",
:method => "get",
:loading => "show_message('summary')",
:url => { :tab => "summary", :controller => "evaluations", :action => "show", :id => @course_term.id } },
:id => 'tab_summary' -%>

<div id="loading" class="box" style="display:none;text-align:center;">
<span id="loading_message">Loading data ...</span><br />
<img alt="" src="/images/ajax-loader.gif"/>
Expand All @@ -43,10 +51,10 @@
// Build the graphical tabs
new Control.Tabs("evaluations", {
afterChange: function(container){
if (container.empty()) {$('tab_' + container.id).onclick();}}
// Only load empty tabs; always refresh the 'summary' tab
if (container.empty() || container.id == 'summary') {$('tab_' + container.id).onclick();}}
});


// Center the "loading" animation
element = $('loading');
var offsets = document.viewport.getScrollOffsets();
Expand Down
4 changes: 4 additions & 0 deletions public/stylesheets/local.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ tr.help:hover td{background-color: #009900;}
.paginate {text-align: center;}
div.fixed-table { max-height:500px; overflow:auto; }

table.simple thead {background-color: #C3D9FF; font-weight: bold;}



/*** Forms ***/
.spacer {padding-left:80px; color:#555555; padding-top: 20px;}
fieldset {border:none; margin:0px; padding:0px;}
Expand Down

0 comments on commit f39a993

Please sign in to comment.