CSC/ECE 517 Spring 2018- Project E1803: Introducing a Student View for Instructors: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 117: Line 117:
The user needs to log-in as instructor to view the developed functionality, this won't be visible for other user roles-
The user needs to log-in as instructor to view the developed functionality, this won't be visible for other user roles-


1. Go to Manage > Student View
1. Log into Expertiza as an instructor.


2. Instructor views Expertiza as a student.
2. Click on '''Switch to Student View''' below user name to switch to student view.


3. A revert button appears at the top right corner, to exit the Student view.
[[File:Student_View.PNG]]


4. Clicking the button takes you back to the instructor view.
3. Click on '''Revert to Instructor View'''' below user name to come back to instructor view.


== External Links ==
== External Links ==
# link for forked repository [[https://github.com/akshayravichandran/expertiza]]
# link for forked repository [[https://github.com/akshayravichandran/expertiza]]

Revision as of 23:00, 25 March 2018

Introduction

Background

Expertiza is a web based open source peer reviewing tool developed and maintained by current and past students of North Carolina State University, Raleigh. Our project is to introduce a student view to the instructors. Currently, an instructor sees the following menus across the top:

Home Manage Survey Deployments Assignments Course Evaluation Profile Contact Us

A student sees these menus:

Home Assignments Course Evaluations Profile Contact Us

On the instructor’s Manage menu, one of the options is “Assignments”. Having Assignments appear in two places in the menu is potentially confusing. Manage > Assignments allows the instructor to edit and create assignments. The Assignments menu that both students and instructors see allows them to participate in assignments.

Hence, to avoid confusion, when in instructor view,the following menus are displayed across the top:

Home Manage Survey Deployments Profile Contact Us

When in student view, the following menus are displayed across the top:

Home Assignments Course Evaluations Profile Contact Us

Problem statement

Our aim is to create a student view for instructors, which will allow an instructor to see what the students see without having to actually impersonate a particular student. Also, when in student view an instructor must be able to view only the menu items that a student can view and must also be able to switch back to the instructor view from the student view. Also when in instructor view, an instructor won't be able to view the 'Assignment' and 'Course Evaluation' menu items, which as of now the instructor can see.

Team

  1. Akshay Ravichandran
  2. Krithika Sekhar
  3. Sameer Poudwal

Mentor - Ed Gehringer

Development

expertiza/app/views/shared/_navigation.html.erb

To switch from instructor to student view and to switch back from student to instructor view, the following code was added in the _navigation.html.erb file. When in instructor view there is a link named "Switch to Student View" to switch to student view and when in student view there is a link named "Revert to Instructor View" to switch back to Instructor View.

<% if session[:user].role.instructor? %>
                 <% if session.key?(:student_view) %>
                     <%= link_to "Revert to Instructor View", {controller: "tree_display", action: "revert_to_instructor_view"},
                                 method: :post, :style => "color: white" %>
                 <% else %>
                     <%= link_to "Switch to Student View", {controller: "tree_display", action: "set_student_view"},
                                 method: :post, :style => "color: white" %>
                 <% end %>
             <% end %>

expertiza/app/views/menu_items/_suckerfish.html.erb

Based on whether the instructor or student view is being displayed, appropriate menu items a rendered by adding the following to the _suckerfish.html.erb file.

 display_item_condition = (session[:user].role.instructor?)?(session[:hidden_menu_items].include?item_id)?false:true:true

expertiza/app/controllers/tree_display_controller.rb

To check what all menu items need to displayed based on what view an instructor is in, the following changes were made to the tree_display_controller.rb.

def list
    # check to see which menu items need to be hidden
    if session[:user].role.instructor?
      if session.key?(:student_view)
        set_student_view_hidden_menu_items
      else
        set_instructor_view_hidden_menu_items
      end
    end
    redirect_to controller: :content_pages, action: :view if current_user.nil?
    redirect_to controller: :student_task, action: :list if current_user.try(:student?)
  end

  # sets student_view in session object
  def set_student_view
    session[:student_view] = true
    redirect_back
  end

  # sets hidden_menu_items in session object when in student view
  def set_student_view_hidden_menu_items
    # 35 - Survey Deployments, 37 - Manage Instructor Content
    session[:hidden_menu_items] = [35, 37]
  end

  # destroys student_view in session object
  def revert_to_instructor_view
    session.delete(:student_view)
    redirect_back
  end

  # sets hidden_menu_items in session object when in instructor view
  def set_instructor_view_hidden_menu_items
    # 26 - Assignments, 30 - Course Evaluation
    session[:hidden_menu_items] = [26, 30]
  end

expertiza/config/routes.rb

New post methods are added in config/routes.rb

  resources :tree_display, only: [] do
    collection do
      get :action
      post :list
      post :children_node_ng
      post :children_node_2_ng
      post :bridge_to_is_available
      get :session_last_open_tab
      get :set_session_last_open_tab
      post :set_student_view
      post :revert_to_instructor_view
    end
  end


Testing

The user needs to log-in as instructor to view the developed functionality, this won't be visible for other user roles-

1. Log into Expertiza as an instructor.

2. Click on Switch to Student View below user name to switch to student view.

3. Click on Revert to Instructor View' below user name to come back to instructor view.

External Links

  1. link for forked repository [[1]]