-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* really optimized the controller find()s * tweaked the views a bit to clean them up and make them more pretty
- Loading branch information
Showing
5 changed files
with
74 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,37 @@ | ||
<%# FIXME: This is completely yucky and should be pretty easy to clean up. %> | ||
<% students = @course.students.sort_by &:last_name if @course %> | ||
<% students ||= [] %> | ||
<% enrollments = @course.enrollments %> | ||
<table class='master'> | ||
<thead> | ||
<tr> | ||
<th width='1px'><acronym title="This student has an accommodation in this course">Acm?</acronym></th> | ||
<th colspan='0'>Enrolled Students (<%= @course.enrollments.size %>)</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% if @course.enrollments.blank? %> | ||
<tr class='help'><td colspan='0'>Add students to this course from the list of students --></td></tr> | ||
<% else %> | ||
<% @course.enrollments.sort_by{|e| e.student.last_name}.each do |enrollment| %> | ||
<tr class="<%= cycle('odd', 'even') %>" id="<%= enrollment.student.id %>"> | ||
<td> | ||
<%= check_box_tag enrollment.id, enrollment.id, enrollment.accommodation, | ||
:onclick => remote_function( | ||
:url => { :action => :toggle_accommodation, :id => enrollment.id }, | ||
:loading => "Element.show('spinner')", | ||
:complete => "Element.hide('spinner')" ) %> | ||
</td> | ||
<%= content_tag :td, enrollment.student.full_name %> | ||
<td> | ||
<% form_remote_tag :url => { :action => 'remove_student', :student_id => enrollment.student.id }, | ||
:method => :delete, | ||
:confirm => "Are you sure you want to remove this '#{enrollment.student.full_name}' from this course?", | ||
:loading => "Element.show('spinner')", | ||
:complete => "Element.hide('spinner')" do %> | ||
<%= submit_tag 'Remove', :class => 'smallbtn negative' %> | ||
<% end %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
|
||
<table class='master'> | ||
<thead> | ||
<tr> | ||
<th width='1px'><acronym title="This student has an accommodation in this course">Acm?</acronym></th> | ||
<th colspan='0'>Enrolled Students (<%= enrollments.size %>)</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% if enrollments.blank? %> | ||
<tr class='help'><td colspan='0'>Add students to this course from the list of students --></td></tr> | ||
<% else %> | ||
<% for enrollment in enrollments %> | ||
<tr class="<%= cycle('odd', 'even') %>" id="<%= enrollment.student.id %>"> | ||
<td> | ||
<%= check_box_tag enrollment.id, enrollment.id, enrollment.accommodation, | ||
:onclick => remote_function( | ||
:url => { :action => :toggle_accommodation, :id => enrollment.id }, | ||
:loading => "Element.show('spinner')", | ||
:complete => "Element.hide('spinner')" ) %> | ||
</td> | ||
<%= content_tag :td, enrollment.student.full_name %> | ||
<td> | ||
<% form_remote_tag :url => { :action => 'remove_student', :student_id => enrollment.student.id }, | ||
:method => :delete, | ||
:confirm => "Are you sure you want to remove this '#{enrollment.student.full_name}' from this course?", | ||
:loading => "Element.show('spinner')", | ||
:complete => "Element.hide('spinner')" do %> | ||
<%= submit_tag 'Remove', :class => 'smallbtn negative' %> | ||
<% end %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
<% params[:value] ||= '||Students' %> | ||
|
||
<table id='students' class='master'> | ||
<thead> | ||
<th> | ||
<%= params[:value].split('||')[1] %> <%= "(#{@students.length})" unless @students.blank? %></th> | ||
<th><%= link_to_remote( "Add All", | ||
{:url => { :action => 'add_student', :students => @students }, | ||
:loading => "Element.show('spinner')", | ||
:complete => "Element.hide('spinner')"}, | ||
{:class => 'btn sml positive'}) unless @students.blank? %> | ||
</th> | ||
</thead> | ||
<tbody> | ||
<% if @students.blank? %> | ||
<tr class='help'><td colspan='0'>Choose from a <br /><em>'Class Of'</em><br /> or a <br /><em>'Home Room'</em><br /> above.</td></tr> | ||
<% else %> | ||
<% students = @students.sort_by &:last_name %> | ||
<% for student in students %> | ||
<tr class="<%= cycle('odd', 'even') %>"> | ||
<td colspan='2'><%= link_to_remote student.full_name, | ||
:url => { :action => 'add_student', :student_id => student.id }, | ||
:loading => "Element.show('spinner')", | ||
:complete => "Element.hide('spinner')" | ||
%></td> | ||
</tr> | ||
<% end %> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
<table id='students' class='master'> | ||
<thead> | ||
<th> | ||
<%= params[:value].split('||')[1] %> <%= "(#{@students.length})" unless @students.blank? %></th> | ||
<th><%= link_to_remote( "Add All", | ||
{:url => { :action => 'add_student', :students => @students }, | ||
:loading => "Element.show('spinner')", | ||
:complete => "Element.hide('spinner')"}, | ||
{:class => 'btn sml positive'}) unless @students.blank? %> | ||
</th> | ||
</thead> | ||
<tbody> | ||
<% if @students.blank? %> | ||
<tr class='help'><td colspan='0'>Choose from a <br /><em>'Class Of'</em><br /> or a <br /><em>'Home Room'</em><br /> above.</td></tr> | ||
<% else %> | ||
<% students = @students.sort_by &:last_name %> | ||
<% for student in students %> | ||
<tr class="<%= cycle('odd', 'even') %>"> | ||
<td colspan='2'><%= link_to_remote student.full_name, | ||
:url => { :action => 'add_student', :student_id => student.id }, | ||
:loading => "Element.show('spinner')", | ||
:complete => "Element.hide('spinner')" | ||
%></td> | ||
</tr> | ||
<% end %> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters