From fb371b6be70e3f968630781bdfdf099f53bff004 Mon Sep 17 00:00:00 2001 From: Jennifer Stern Date: Wed, 29 Jul 2015 16:50:08 -0500 Subject: [PATCH] Revert "Make it so students see "My Grades" and teachers see "Gradebook" in course menu" fixes CNVS-22235 This reverts commit e413f8292d70e761bbc3a9b3b44e0beb7d75dc31. Change-Id: I49ada900ceef526f82ef37b6ff5febfe7298eda5 Reviewed-on: https://gerrit.instructure.com/59572 Tested-by: Jenkins Reviewed-by: Ryan Shaw Product-Review: Jennifer Stern QA-Review: Erin Hallmark --- app/controllers/gradebooks_controller.rb | 13 +------------ app/models/course.rb | 10 ++-------- spec/apis/v1/tabs_api_spec.rb | 2 +- spec/selenium/links_spec.rb | 4 ++-- 4 files changed, 6 insertions(+), 23 deletions(-) diff --git a/app/controllers/gradebooks_controller.rb b/app/controllers/gradebooks_controller.rb index 3906f3e4aba..636e50b7267 100644 --- a/app/controllers/gradebooks_controller.rb +++ b/app/controllers/gradebooks_controller.rb @@ -29,22 +29,11 @@ class GradebooksController < ApplicationController batch_jobs_in_actions :only => :update_submission, :batch => { :priority => Delayed::LOW_PRIORITY } - before_filter :add_grades_crumb - + add_crumb(proc { t '#crumbs.grades', "Grades" }) { |c| c.send :named_context_url, c.instance_variable_get("@context"), :context_grades_url } before_filter { |c| c.active_tab = "grades" } MAX_POST_GRADES_TOOLS = 10 - def add_grades_crumb - if @context.grants_any_right?(@current_user, :manage_grades, :view_all_grades) && !params[:id] - crumb_label = t "Gradebook" - else - crumb_label = t "My Grades" - end - add_crumb(crumb_label, named_context_url(@context, :context_grades_url)) - end - private :add_grades_crumb - def grade_summary @presenter = GradeSummaryPresenter.new(@context, @current_user, params[:id]) # do this as the very first thing, if the current user is a teacher in the course and they are not trying to view another user's grades, redirect them to the gradebook diff --git a/app/models/course.rb b/app/models/course.rb index eea2d25650e..50bcd62af81 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -2357,10 +2357,10 @@ class Course < ActiveRecord::Base :icon => 'icon-discussion' }, { :id => TAB_GRADES, - :label => t("My Grades"), + :label => t('#tabs.grades', "Grades"), :css_class => 'grades', :href => :course_grades_path, - :screenreader => t("Course Grades") + :screenreader => t('#tabs.course_grades', "Course Grades") }, { :id => TAB_PEOPLE, :label => t('#tabs.people', "People"), @@ -2528,12 +2528,6 @@ class Course < ActiveRecord::Base tabs.delete_if { |t| t[:hidden] && t[:external] } unless opts[:api] && self.grants_right?(user, :read_as_admin) tabs.delete_if { |t| t[:id] == TAB_GRADES } unless self.grants_any_right?(user, opts[:session], :read_grades, :view_all_grades, :manage_grades) tabs.detect { |t| t[:id] == TAB_GRADES }[:manageable] = true if self.grants_any_right?(user, opts[:session], :view_all_grades, :manage_grades) - - grades_tab = tabs.find { |t| t[:id] == TAB_GRADES } - if !grades_tab.nil? && self.grants_any_right?(user, opts[:session], :view_all_grades, :manage_grades) - grades_tab[:label] = t('Gradebook') - end - tabs.delete_if { |t| t[:id] == TAB_PEOPLE } unless self.grants_any_right?(user, opts[:session], :read_roster, :manage_students, :manage_admin_users) tabs.detect { |t| t[:id] == TAB_PEOPLE }[:manageable] = true if self.grants_any_right?(user, opts[:session], :manage_students, :manage_admin_users) tabs.delete_if { |t| t[:id] == TAB_FILES } unless self.grants_any_right?(user, opts[:session], :read, :manage_files) diff --git a/spec/apis/v1/tabs_api_spec.rb b/spec/apis/v1/tabs_api_spec.rb index 30ae59db9c4..a0d09a2dff3 100644 --- a/spec/apis/v1/tabs_api_spec.rb +++ b/spec/apis/v1/tabs_api_spec.rb @@ -80,7 +80,7 @@ describe TabsController, type: :request do "full_url" => "#{HostUrl.protocol}://#{HostUrl.context_host(@course)}/courses/#{@course.id}/grades", "position" => 5, "visibility" => "public", - "label" => "Gradebook", + "label" => "Grades", "type" => "internal" }, { diff --git a/spec/selenium/links_spec.rb b/spec/selenium/links_spec.rb index 712f11a1645..30e466e2c8f 100644 --- a/spec/selenium/links_spec.rb +++ b/spec/selenium/links_spec.rb @@ -40,7 +40,7 @@ describe "links", priority: "2" do it "should navigate user to gradebook page after grades link is clicked" do link = find_link('.grades') - validate_breadcrumb_link(link, 'Gradebook') + validate_breadcrumb_link(link, 'Grades') end it "should navigate user to users page after people link is clicked" do @@ -110,7 +110,7 @@ describe "links", priority: "2" do end it "should navigate user to gradebook page after grades link is clicked" do - validate_breadcrumb_link(f('#grades_menu_item a'), 'Gradebook') + validate_breadcrumb_link(f('#grades_menu_item a'), 'Grades') end it "should navigate user to the calendar page after calender link is clicked" do