Skip to content

Commit

Permalink
Merge pull request #673 from lakeskysea/render
Browse files Browse the repository at this point in the history
Updated render style towards Rails 3
  • Loading branch information
benjaminvialle committed Feb 19, 2012
2 parents 504a786 + 1c4bdc0 commit b39fad5
Show file tree
Hide file tree
Showing 24 changed files with 94 additions and 94 deletions.
2 changes: 1 addition & 1 deletion app/controllers/admins_controller.rb
Expand Up @@ -25,7 +25,7 @@ def update
# update_attributes supplied by ActiveRecords
if !@user.update_attributes(attrs)
flash[:error] = I18n.t("admins.update.error")
render :action => :edit
render :edit
else
flash[:success] = I18n.t("admins.update.success",
:user_name => @user.user_name)
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/annotation_categories_controller.rb
Expand Up @@ -23,10 +23,10 @@ def add_annotation_category
@annotation_category.update_attributes(params[:annotation_category])
@annotation_category.assignment = @assignment
if !@annotation_category.save
render :action => 'new_annotation_category_error'
render :new_annotation_category_error
return
end
render :action => 'insert_new_annotation_category'
render :insert_new_annotation_category
return
end
end
Expand Down Expand Up @@ -57,11 +57,11 @@ def add_annotation_text
@annotation_text.update_attributes(params[:annotation_text])
@annotation_text.annotation_category = @annotation_category
if !@annotation_text.save
render :action => 'new_annotation_text_error'
render :new_annotation_text_error
return
end
@assignment = Assignment.find(params[:assignment_id])
render :action => 'insert_new_annotation_text'
render :insert_new_annotation_text
return
end
end
Expand Down
16 changes: 8 additions & 8 deletions app/controllers/assignments_controller.rb
Expand Up @@ -55,7 +55,7 @@ def student_interface
end
redirect_to :action => 'student_interface', :id => @assignment.id
else
render :action => 'student_interface', :layout => 'no_menu_header'
render :student_interface, :layout => 'no_menu_header'
return
end
else
Expand Down Expand Up @@ -128,12 +128,12 @@ def index
end
end

render :action => "student_assignment_list"
render :student_assignment_list
return
elsif current_user.ta?
render :action => "grader_index"
render :grader_index
else
render :action => 'index'
render :index
end
end

Expand Down Expand Up @@ -175,7 +175,7 @@ def update
rescue Exception, RuntimeError => e
@assignment.errors.add(:base, I18n.t("assignment.error",
:message => e.message))
render :action => 'edit', :id => @assignment.id
render :edit, :id => @assignment.id
return
end

Expand All @@ -184,7 +184,7 @@ def update
redirect_to :action => 'edit', :id => params[:id]
return
else
render :action => 'edit', :id => @assignment.id
render :edit, :id => @assignment.id
end
end

Expand All @@ -203,7 +203,7 @@ def new
# set default value if web submits are allowed
@assignment.allow_web_submits =
!MarkusConfigurator.markus_config_repository_external_submits_only?
render :action => 'new'
render :new
end

# Called after a new assignment form is submitted.
Expand All @@ -219,7 +219,7 @@ def create
if !@assignment.save
@assignments = Assignment.all
@sections = Section.all
render :action => :new
render :new
return
end
if params[:persist_groups_assignment]
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/automated_tests_controller.rb
Expand Up @@ -22,7 +22,7 @@ def index
}
Process.detach(child_pid) unless child_pid.nil?
end
render :action => 'test_replace',
render :test_replace,
:locals => {:test_result_files => @test_result_files,
:result => @result}
end
Expand Down Expand Up @@ -50,7 +50,7 @@ def update
redirect_to :action => 'manage',
:assignment_id => params[:assignment_id]
else
render :action => 'manage'
render :manage
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/flexible_criteria_controller.rb
Expand Up @@ -17,7 +17,7 @@ def edit
def update
@criterion = FlexibleCriterion.find(params[:id])
if !@criterion.update_attributes(params[:flexible_criterion])
render :action => 'errors'
render :errors
return
end
flash.now[:success] = I18n.t('criterion_saved_success')
Expand All @@ -40,11 +40,11 @@ def new
@criterion.position = new_position
if !@criterion.update_attributes(params[:flexible_criterion])
@errors = @criterion.errors
render :action => 'add_criterion_error'
render :add_criterion_error
return
end
@criteria.reload
render :action => 'create_and_edit'
render :create_and_edit
end
end

Expand Down
12 changes: 6 additions & 6 deletions app/controllers/graders_controller.rb
Expand Up @@ -265,7 +265,7 @@ def randomly_assign_graders_to_criteria(criteria, grader_ids)
end
groupings = groupings.uniq
construct_all_rows(groupings, graders, criteria)
render :action => "modify_criteria"
render :modify_criteria
end

def randomly_assign_graders(groupings, grader_ids)
Expand All @@ -283,7 +283,7 @@ def randomly_assign_graders(groupings, grader_ids)
criterion.save
end
construct_all_rows(groupings, graders, criteria)
render :action => "modify_groupings"
render :modify_groupings
end

def add_graders(groupings, grader_ids)
Expand All @@ -298,7 +298,7 @@ def add_graders(groupings, grader_ids)
criterion.save
end
construct_all_rows(groupings, graders, criteria)
render :action => "modify_groupings"
render :modify_groupings
end

def add_graders_to_criteria(criteria, graders)
Expand All @@ -317,7 +317,7 @@ def add_graders_to_criteria(criteria, graders)
grouping.save
end
construct_all_rows(groupings, graders, criteria)
render :action => "modify_criteria"
render :modify_criteria
end

def remove_graders_from_criteria(criteria, params)
Expand All @@ -342,7 +342,7 @@ def remove_graders_from_criteria(criteria, params)
grouping.save
end
construct_all_rows(groupings , all_graders, criteria)
render :action => "modify_criteria"
render :modify_criteria
end

# Removes the graders contained in params from the groupings given
Expand All @@ -365,7 +365,7 @@ def remove_graders(groupings, params)
criterion.save
end
construct_all_rows(groupings, Ta.all, @assignment.get_criteria)
render :action => "modify_groupings"
render :modify_groupings
end

def construct_all_rows(groupings, graders, criteria)
Expand Down
18 changes: 9 additions & 9 deletions app/controllers/groups_controller.rb
Expand Up @@ -31,7 +31,7 @@ def new
new_grouping_data = @assignment.add_group(params[:new_group_name])
rescue Exception => e
@error = e.message
render :action => 'error_single'
render :error_single
return
end
@new_grouping = construct_table_row(new_grouping_data, @assignment)
Expand All @@ -46,11 +46,11 @@ def remove_group
@removed_groupings = []
if grouping.has_submission?
@errors.push(grouping.group.group_name)
render :action => "delete_groupings"
render :delete_groupings
else
grouping.delete_grouping
@removed_groupings.push(grouping)
render :action => "delete_groupings"
render :delete_groupings
end
end

Expand Down Expand Up @@ -277,7 +277,7 @@ def global_actions
when "assign"
if grouping_ids.length != 1
@error = I18n.t("assignment.group.select_only_one_group")
render :action => 'error_single'
render :error_single
elsif student_ids
add_members(student_ids, grouping_ids[0], @assignment)
return
Expand All @@ -300,7 +300,7 @@ def invalidate_groupings(groupings)
grouping.invalidate_grouping
end
@groupings_data = construct_table_rows(groupings, @assignment)
render :action => "modify_groupings"
render :modify_groupings
end

# Given a list of grouping, sets their group status to valid if possible
Expand All @@ -309,7 +309,7 @@ def validate_groupings(groupings)
grouping.validate_grouping
end
@groupings_data = construct_table_rows(groupings, @assignment)
render :action => "modify_groupings"
render :modify_groupings
end

# Deletes the given list of groupings if possible
Expand All @@ -324,7 +324,7 @@ def delete_groupings(groupings)
@removed_groupings.push(grouping)
end
end
render :action => "delete_groupings"
render :delete_groupings
end

# Adds the students given in student_ids to the grouping given in grouping_id
Expand All @@ -346,7 +346,7 @@ def add_members(student_ids, grouping_id, assignment)
:group => group_name)
end

render :action => "add_members"
render :add_members
return
end

Expand Down Expand Up @@ -414,7 +414,7 @@ def remove_members(groupings, params)
end
@students_data = construct_student_table_rows(all_members, @assignment)
@groupings_data = construct_table_rows(groupings, @assignment)
render :action => "remove_members"
render :remove_members
end

#Removes the given student membership from the given grouping
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/main_controller.rb
Expand Up @@ -136,7 +136,7 @@ def index
return
end
@assignments = Assignment.find(:all)
render :action => 'index', :layout => 'content'
render :index, :layout => 'content'
end

def about
Expand All @@ -153,7 +153,7 @@ def reset_api_key
else
render :file => "#{::Rails.root.to_s}/public/404.html", :status => 404 and return
end
render :action => 'api_key_replace', :locals => {:user => @current_user }
render :api_key_replace, :locals => {:user => @current_user }
end

# Render 404 error (page not found) if no other route matches.
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/notes_controller.rb
Expand Up @@ -59,7 +59,7 @@ def create
redirect_to :action => 'index'
else
new_retrieve
render :action => "new"
render :new
end
end

Expand Down Expand Up @@ -93,7 +93,7 @@ def update
flash[:success] = I18n.t('notes.update.success')
redirect_to :action => 'index'
else
render :action => 'edit'
render :edit
end
end

Expand Down
6 changes: 3 additions & 3 deletions app/controllers/rubrics_controller.rb
Expand Up @@ -14,7 +14,7 @@ def edit
def update
@criterion = RubricCriterion.find(params[:id])
if !@criterion.update_attributes(params[:rubric_criterion])
render :action => 'errors'
render :errors
return
end
flash.now[:success] = I18n.t('criterion_saved_success')
Expand All @@ -40,11 +40,11 @@ def create
@criterion.position = new_position
if !@criterion.update_attributes(params[:rubric_criterion])
@errors = @criterion.errors
render :action => 'add_criterion_error'
render :add_criterion_error
return
end
@criteria.reload
render :action => 'create_and_edit'
render :create_and_edit
end

def destroy
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/sections_controller.rb
Expand Up @@ -24,7 +24,7 @@ def create
return
else
flash[:error] = I18n.t('section.create.error')
render :action => 'new'
render :new
end
end

Expand All @@ -42,7 +42,7 @@ def update
redirect_to :action => 'index'
else
flash[:error] = I18n.t('section.update.error')
render :action => 'edit'
render :edit
end
end

Expand Down
6 changes: 3 additions & 3 deletions app/controllers/students_controller.rb
Expand Up @@ -37,7 +37,7 @@ def update
if !@user.update_attributes(attrs)
flash[:error] = I18n.t("students.update.error")
@sections = Section.find(:all, :order => "name")
render :action => :edit
render :edit
else
flash[:success] = I18n.t("students.update.success",
:user_name => @user.user_name)
Expand Down Expand Up @@ -70,7 +70,7 @@ def bulk_modify
end
rescue RuntimeError => e
@error = e.message
render :action => 'display_error'
render :display_error
end
end

Expand All @@ -91,7 +91,7 @@ def create
else
@sections = Section.find(:all, :order => "name")
flash[:error] = I18n.t('students.create.error')
render :action => 'new'
render :new
end
end

Expand Down

0 comments on commit b39fad5

Please sign in to comment.