Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added Offering Summary
  • Loading branch information
ryansouza committed Mar 19, 2012
1 parent 0f501ef commit 34a54ab
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 14 deletions.
10 changes: 10 additions & 0 deletions app/models/offering.rb
Expand Up @@ -238,4 +238,14 @@ def self.content_to_outcome_mapping_row_total
10
end


def summed_mappings
outcomes.map do |outcome|
objectives.
includes(:mappings).
where(mappings: {outcome_id: outcome, value: 1}).count
end
end


end
11 changes: 11 additions & 0 deletions app/views/offerings/_summary.html.erb
@@ -0,0 +1,11 @@
<div id="offering-summary">
<% if offering.is_complete? :details %>
<%= render partial: 'offerings/details/summary', locals: {offering: offering} %>
<% end %>
<% if offering.is_complete? :objectives %>
<%= render partial: 'offerings/objectives/summary', locals: {offering: offering} %>
<% end %>
<% if offering.is_complete? :content %>
<%= render partial: 'offerings/content/summary', locals: {offering: offering} %>
<% end %>
</div>
13 changes: 12 additions & 1 deletion app/views/offerings/content/_summary.html.erb
@@ -1 +1,12 @@
Nothing here but us words
<div class="row summary content">
<div class="title span2">
<h2 class="middle">Content</h2>
</div>
<div class="span5">
<ul class="horizontal-list">
<% offering.content_groups.each do |cg| %>
<li><%= cg.content.count %><br><%= cg.name %></li>
<% end %>
</ul></div>
</div>

24 changes: 22 additions & 2 deletions app/views/offerings/details/_summary.html.erb
@@ -1,2 +1,22 @@
Nothing here but us words

<div class="row details summary">
<div class="span2">
<dl class="">
<dt>CRN #</dt>
<dd><%= offering.crn %></dd>
<dt>Section(s)</dt>
<dd><%= offering.section %></dd>
<dt>Credits</dt>
<dd><%= offering.credits %></dd>
<dt>Location</dt>
<dd><%= offering.location %></dd>

</dl></div>
<div class="span5">
<dl class="padded">
<dt>Description</dt>
<dd><%= offering.description %></dd>
<dt>Primary Textbook</dt>
<dd><%= offering.textbook %></dd>
</dl>
</div>
</div>
7 changes: 6 additions & 1 deletion app/views/offerings/importing/edit.html.erb
Expand Up @@ -43,7 +43,12 @@
</p>

<br>
<h3>Offering summary goes here<h3>

<div class="row">
<div class="span8 offset2">
<%= render partial: 'offerings/summary', locals: {offering: @recent_offering_choice} %>
</div>
</div>

<% end %>
Expand Down
29 changes: 28 additions & 1 deletion app/views/offerings/objectives/_summary.html
@@ -1,2 +1,29 @@
Nothing here but us words
<div class="row summary objectives">
<div class="title span2">
<h2 class="middle">Objectives</h2>
</div>
<div class="span5">
<table class="table">
<thead>
<tr>
<th colspan="11" style="text-align: center">
<%= offering.objectives.count %> objectives meeting outcomes
</th>
</tr>
<tr>
<% offering.outcomes.each do |outcome| %>
<th class="col-outcome"><%= outcome.key %></th>
<% end %>
</tr>
</thead>
<tbody>
<tr>
<% offering.summed_mappings.each do |value| %>
<td class="col-oucome"><%= value %></td>
<% end %>
</tr>
</tbody>
</table>
</div>
</div>

11 changes: 2 additions & 9 deletions app/views/offerings/show.html.erb
Expand Up @@ -2,15 +2,8 @@

<div class="row">
<div id="offering-summary" class="span8 offset1">
<% if @offering.is_complete? :details %>
<%= render 'offerings/details/summary' %>
<% end %>
<% if @offering.is_complete? :objectives %>
<%= render 'offerings/objectives/summary' %>
<% end %>
<% if @offering.is_complete? :content %>
<%= render 'offerings/content/summary' %>
<% end %>
<%= render partial: 'summary', locals: {offering: @offering} %>
&nbsp;<br>
</div>

<!--Sidebar-->
Expand Down

0 comments on commit 34a54ab

Please sign in to comment.