Permalink
Browse files

Minor tweaks to the assignment <-> evaluation workflow

 * It is now possible to easily move between assignments and their evaluations
 * Added an "Evaluate" button to the edit assignments view.  Closes #17
 * Corrected some small issues with the assignment edit page
 * Added an integration test for assignments (still a lot of work to do on this)
  • Loading branch information...
1 parent 408a00e commit e6998024187052986d9cd465bbf32f0fb07a122e @rnhurt committed Sep 14, 2009
@@ -32,7 +32,11 @@ def create
if @assignment.save
flash[:notice] = "Assignment '#{@assignment.name}' was created successfully."
- redirect_to :action => :show, :id => @assignment.course_term.id
+ if params["evaluations"]
+ redirect_to :action => "show", :id => @assignment.course_term.id, :controller => "evaluations"
+ else
+ redirect_to :action => "show", :id => @assignment.course_term.id
+ end
else
@course_term = CourseTerm.find(@assignment.course_term_id)
render :action => "edit"
@@ -44,7 +48,11 @@ def update
if @assignment.update_attributes(params[:assignment])
flash[:notice] = "Assignment '#{@assignment.name}' was updated successfully."
- redirect_to :action => :show, :id => @assignment.course_term.id
+ if params["evaluations"]
+ redirect_to :action => "show", :id => @assignment.course_term.id, :controller => "evaluations"
+ else
+ redirect_to :action => "show", :id => @assignment.course_term.id
+ end
else
@course_term = CourseTerm.find(params[:assignment][:course_term_id])
render :action => "edit"
@@ -12,6 +12,7 @@
<tr><td colspan='0'>
<%= link_to 'Add Assignment',
new_assignment_path( :course_term_id => @course_term.id ),
+ :id => "add_assignment",
:class => 'btn positive' %>
</td>
</tr>
@@ -28,13 +28,13 @@
<%= f.label :due_date %>
<%= f.hidden_field :due_date %>
<span id='due_date' class='scal tinyscal'></span>
- <%= f.hidden_field :due_date %>
<input id='default_due_date' type='hidden'
value='<%= @assignment.due_date? ? @assignment.due_date.to_s(:long) : DateTime.now.to_s(:long) %>' />
<div class='spacer'>
- <%= submit_tag 'Save', :class=> 'btn positive' %>
+ <%= submit_tag "Save", :name => "assignments", :class=> 'btn positive' %>
<%= link_to 'Cancel', assignment_path(@course_term), :class => 'btn standard' %>
+ <%= submit_tag "Evaluate", :name => "evaluations", :class=> "btn standard" %>
</div>
</fieldset>
<% end %>
@@ -17,7 +17,9 @@
<% else %>
<% for assignment in assignments %>
<th width='50' class='grade nosort' id='<%= assignment.id %>'>
- <div class='assign-name'><%= h assignment.name %></div>
+ <div class='assign-name'>
+ <%= link_to assignment.name, edit_assignment_path(assignment.id) %>
+ </div>
<div class='assign-points'>
<%= link_to_function assignment.possible_points,
"$$('[id*=a#{assignment.id}]').each(function(g) { g.value = #{assignment.possible_points}; g.onchange(); });" %>
@@ -0,0 +1,25 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class AssignmentTest < ActionController::IntegrationTest
+ def setup
+ visit root_path
+ click_link "log in"
+ fill_in "login", :with => "teachera"
+ fill_in "password", :with => "teachera"
+ click_button "Login"
+ assert_contain "Login successful!"
+ end
+
+ test "enter a new assignment" do
+ visit assignments_path
+ click_link "English"
+ click_link "add_assignment"
+ fill_in "assignment_name", :with => "Spelling Test"
+ fill_in "assignment_possible_points", :with => "100"
+ fill_in "assignment_due_date", :with => Time.now.strftime("%Y-%m-%d 00:00:01")
+ select "Test", :from => "assignment_assignment_category_id"
+ click_button "Save"
+ assert_contain "Assignment 'Spelling Test' was created successfully."
+ end
+
+end

0 comments on commit e699802

Please sign in to comment.