Skip to content

Commit

Permalink
Merge ff7a9e3 into d2144d1
Browse files Browse the repository at this point in the history
  • Loading branch information
Druotic committed Nov 6, 2014
2 parents d2144d1 + ff7a9e3 commit 7c5ec52
Show file tree
Hide file tree
Showing 37 changed files with 277 additions and 266 deletions.
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Expand Up @@ -106,7 +106,7 @@ def denied(reason=nil)

private
def record_not_found
redirect_to :controller => :tree_display,:action => :list
redirect_to tree_display_index_path
end

end
10 changes: 5 additions & 5 deletions app/controllers/assignment_controller.rb
Expand Up @@ -41,7 +41,7 @@ def copy
redirect_to :action => 'edit', :id => @assignment.id
else
flash[:error] = 'The assignment was not able to be copied. Please check the original assignment for missing information.'
redirect_to :action => 'list', :controller => 'tree_display'
redirect_to tree_display_index_path
end
end

Expand Down Expand Up @@ -71,7 +71,7 @@ def toggle_access
assignment.private = !assignment.private
assignment.save

redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
end

# This functions finds the epoch time in seconds of the due_at parameter and finds the difference of it
Expand Down Expand Up @@ -778,7 +778,7 @@ def delete
end
end
undo_link("Assignment: \"#{@assignment.name}\" has deleted successfully. ")
redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
end

#--------------------------------------------------------------------------------------------------------------------
Expand All @@ -800,7 +800,7 @@ def toggle_access
@assignment.private = !@assignment.private
@assignment.save
undo_link("Assignment \"#{@assignment.name}\" has been made private successfully. ")
redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
end

#--------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -843,7 +843,7 @@ def remove_assignment_from_course
newpath = assignment.get_path rescue nil
FileHelper.update_file_location(oldpath,newpath)
undo_link("Assignment \"#{@assignment.name}\" has been removed from course successfully. ")
redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
end

:private
Expand Down
10 changes: 5 additions & 5 deletions app/controllers/assignments_controller.rb
Expand Up @@ -14,7 +14,7 @@ def toggle_access
assignment = Assignment.find(params[:id])
assignment.private = !assignment.private
assignment.save
redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
end

def new
Expand Down Expand Up @@ -45,7 +45,7 @@ def create
# flash[:success] = 'Assignment was successfully created.'
# redirect_to controller: :assignments, action: :edit, id: @assignment.id
#AAD#
redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
undo_link("Assignment \"#{@assignment.name}\" has been created successfully. ")
#AAD#
else
Expand Down Expand Up @@ -339,7 +339,7 @@ def copy
redirect_to :action => 'edit', :id => new_assign.id
else
flash[:error] = 'The assignment was not able to be copied. Please check the original assignment for missing information.'
redirect_to :action => 'list', :controller => 'tree_display'
redirect_to tree_display_index_path
end
end

Expand Down Expand Up @@ -378,7 +378,7 @@ def delete
end
end

redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
end

def list
Expand Down Expand Up @@ -421,7 +421,7 @@ def remove_assignment_from_course
assignment.save
newpath = assignment.get_path rescue nil
FileHelper.update_file_location(oldpath, newpath)
redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
end

def copy_assignment_questionnaire (old_assign, new_assign)
Expand Down
10 changes: 5 additions & 5 deletions app/controllers/course_controller.rb
Expand Up @@ -47,7 +47,7 @@ def update
end
@course.update_attributes(params[:course])
undo_link("Course \"#{@course.name}\" has been updated successfully. ")
redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
end

def copy
Expand All @@ -69,7 +69,7 @@ def copy

rescue
flash[:error] = 'The course was not able to be copied: '+$!
redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
end
end

Expand All @@ -88,7 +88,7 @@ def create
end
FileHelper.create_directory(@course)
undo_link("Course \"#{@course.name}\" has been created successfully. ")
redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
rescue
flash[:error] = $! #"The following error occurred while saving the course: #"+
redirect_to :action => 'new'
Expand All @@ -111,7 +111,7 @@ def delete
#}
@course.destroy
undo_link("Course \"#{@course.name}\" has been deleted successfully. ")
redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
end

def toggle_access
Expand All @@ -124,7 +124,7 @@ def toggle_access
end
@access = @course.private == true ? "private" : "public"
undo_link("Course \"#{@course.name}\" has been made #{@access} successfully. ")
redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
end

def view_teaching_assistants
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/lottery_controller.rb
Expand Up @@ -284,7 +284,7 @@ def run_intelligent_bid
end
flash[:notice] = "Please go to the topics section of edit assignment, to check if the assignments were done"
end
redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
end

#delete all the waitlist entries for the user
Expand Down
14 changes: 7 additions & 7 deletions app/controllers/questionnaires_controller.rb
Expand Up @@ -65,7 +65,7 @@ def copy
redirect_to :back
rescue
flash[:error] = 'The questionnaire was not able to be copied. Please check the original course for missing information.'+$!
redirect_to :action => 'list', :controller => 'tree_display'
redirect_to tree_display_index_path
end
end

Expand Down Expand Up @@ -94,7 +94,7 @@ def delete
end
end

redirect_to :action => 'list', :controller => 'tree_display'
redirect_to tree_display_index_path
end

def view
Expand Down Expand Up @@ -254,7 +254,7 @@ def create_questionnaire
end
save

redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
end
end

Expand Down Expand Up @@ -333,7 +333,7 @@ def create
@questionnaire.instructor_id = session[:user].id
end
save
redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
end

def update
Expand All @@ -345,7 +345,7 @@ def update
end

if @questionnaire.update_attributes(params[:questionnaire])
redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
else
render 'edit'
end
Expand Down Expand Up @@ -373,7 +373,7 @@ def toggle_access
@questionnaire.save
@access = @questionnaire.private == true ? "private" : "public"
undo_link("Questionnaire \"#{@questionnaire.name}\" has been made #{@access} successfully. ")
redirect_to :controller => 'tree_display', :action => 'list'
redirect_to tree_display_index_path
end

private
Expand Down Expand Up @@ -651,7 +651,7 @@ def clone_questionnaire_details(questions)
rescue

flash[:error] = 'The questionnaire was not able to be copied. Please check the original course for missing information.'+$!
redirect_to :action => 'list', :controller => 'tree_display'
redirect_to tree_display_index_path
end
end
end
125 changes: 44 additions & 81 deletions app/controllers/tree_display_controller.rb
@@ -1,89 +1,35 @@
class TreeDisplayController < ApplicationController
helper :application

# Database group names - used to translate from session variable string syntax to database label syntax
@@Groups = {
'Questionnaires' => 'Questionnaires',
'Review rubrics' => 'Review',
'Metareview rubrics' => 'Metareview',
'Teammate review rubrics' => 'Teammate Review',
'Author feedbacks' => 'Author Feedback',
'Global survey' => 'Global Survey',
'Surveys' => 'Survey',
'Course evaluations' => 'Course Evaluation',
'Courses' => 'Courses',
'Bookmarkrating' => 'Bookmarkrating',
'Assignments' => 'Assignments'
}

def action_allowed?
true
end

# direct access to questionnaires
def goto_questionnaires
node_object = TreeFolder.find_by_name('Questionnaires')
session[:root] = FolderNode.find_by_node_object_id(node_object.id).id
redirect_to :controller => 'tree_display', :action => 'list'
end

# direct access to review rubrics
def goto_review_rubrics
node_object = TreeFolder.find_by_name('Review')
session[:root] = FolderNode.find_by_node_object_id(node_object.id).id
redirect_to :controller => 'tree_display', :action => 'list'
end

# direct access to metareview rubrics
def goto_metareview_rubrics
node_object = TreeFolder.find_by_name('Metareview')
session[:root] = FolderNode.find_by_node_object_id(node_object.id).id
redirect_to :controller => 'tree_display', :action => 'list'
end

# direct access to teammate review rubrics
def goto_teammatereview_rubrics
node_object = TreeFolder.find_by_name('Teammate Review')
session[:root] = FolderNode.find_by_node_object_id(node_object.id).id
redirect_to :controller => 'tree_display', :action => 'list'
end

# direct access to author feedbacks
def goto_author_feedbacks
node_object = TreeFolder.find_by_name('Author Feedback')
session[:root] = FolderNode.find_by_node_object_id(node_object.id).id
redirect_to :controller => 'tree_display', :action => 'list'
end

# direct access to global survey
def goto_global_survey
node_object = TreeFolder.find_by_name('Global Survey')
session[:root] = FolderNode.find_by_node_object_id(node_object.id).id
redirect_to :controller => 'tree_display', :action => 'list'
end

# direct access to surveys
def goto_surveys
node_object = TreeFolder.find_by_name('Survey')
session[:root] = FolderNode.find_by_node_object_id(node_object.id).id
redirect_to :controller => 'tree_display', :action => 'list'
end

# direct access to course evaluations
def goto_course_evaluations
node_object = TreeFolder.find_by_name('Course Evaluation')
session[:root] = FolderNode.find_by_node_object_id(node_object.id).id
redirect_to :controller => 'tree_display', :action => 'list'
end

# direct access to courses
def goto_courses
node_object = TreeFolder.find_by_name('Courses')
session[:root] = FolderNode.find_by_node_object_id(node_object.id).id
redirect_to :controller => 'tree_display', :action => 'list'
end

def goto_bookmarkrating_rubrics
node_object = TreeFolder.find_by_name('Bookmarkrating')
session[:root] = FolderNode.find_by_node_object_id(node_object.id).id
redirect_to :controller => 'tree_display', :action => 'list'
end
# called when the display is requested
def index
session[:root] = params[:root]
group = getGroup session[:menu]

# direct access to assignments
def goto_assignments
node_object = TreeFolder.find_by_name('Assignments')
session[:root] = FolderNode.find_by_node_object_id(node_object.id).id
redirect_to :controller => 'tree_display', :action => 'list'
end
node_object = TreeFolder.find_by_name(group)
if not group.blank? and not node_object.blank?
session[:root] = FolderNode.find_by_node_object_id(node_object.id).id
end

# called when the display is requested
# ajbudlon, July 3rd 2008
def list
redirect_to controller: :student_task, action: :list if current_user.student?
if params[:commit] == 'Search'
search_node_root = {'Q' => 1, 'C' => 2, 'A' => 3}
Expand All @@ -104,7 +50,7 @@ def list

@search = search_string

display = params[:display] #|| session[:display]
display = params[:display]
if display
@sortvar = display[:sortvar]
@sortorder = display[:sortorder]
Expand All @@ -119,11 +65,21 @@ def list
else
@child_nodes = FolderNode.get()
end
locals search: @search,
sortvar: @sortvar,
sortorder: @sortorder,
root_node: @root_node,
child_nodes: @child_nodes,
filternode: params[:filternode],
searchnode: params[:searchnode]
end

def drill
session[:root] = params[:root]
redirect_to :controller => 'tree_display', :action => 'list'
private

# render local variable hash for view
# reference: http://thepugautomatic.com/2013/05/locals/
def locals(values)
render locals: values
end

def filter
Expand All @@ -147,4 +103,11 @@ def filter
return qid
end

def getGroup menu
if menu and menu.selected
# first menu item is most specific/nested menu selected item in dropdown menus
menu_item_label= MenuItem.where(name: menu.selected).first.label
end
@@Groups[menu_item_label]
end
end
2 changes: 1 addition & 1 deletion app/helpers/auth_helper.rb
Expand Up @@ -2,7 +2,7 @@ module AuthHelper
def self.get_home_action(user)
user.role.get_home_action
rescue
'drill'
'index'
end

def self.get_home_controller(user)
Expand Down
2 changes: 1 addition & 1 deletion app/views/questionnaires/view.html.erb
Expand Up @@ -45,4 +45,4 @@

<BR/>
<%= link_to 'Edit', :action => 'edit', :id => @questionnaire %> |
<%= link_to "Back", :controller => 'tree_display', :action => 'list' %>
<%= link_to "Back", tree_display_index_path %>

0 comments on commit 7c5ec52

Please sign in to comment.