course top nav link goes to /courses

also added groups to /courses page
if user has current groups

closes #7378
refs PS-703

test plan:
  1. login to canvas with enrollments
  2. click the Courses link at the top
  3. you should be taken to /courses and see all of
     your enrollments and not back to the dashboard
  4. add the user to a group or a few groups
  5. log back in with that user and click on the same
     link but it should now say Users & Groups
  6. you should see My Groups with links to your
     active groups just like the enrollments

Change-Id: I1e5058b0a9693f7d7050279934bf8ebca1a6495a
Reviewed-on: https://gerrit.instructure.com/25120
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brandon Broschinsky <brandonbr@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Product-Review: Jake Sorce <jake@instructure.com>
This commit is contained in:
Jake Sorce 2013-10-08 13:18:40 -06:00
parent c6a2709564
commit 9c6d811d83
4 changed files with 52 additions and 12 deletions

View File

@ -2,7 +2,7 @@
<% content_for :auto_discovery do %>
<% if @current_user %>
<%= auto_discovery_link_tag(:atom, feeds_user_format_path(@current_user.feed_code, :atom), {:title => t('titles.rss.course_announcements', "Course Announcements Atom Feed")}) %>
<%= auto_discovery_link_tag(:atom, feeds_user_format_path(@current_user.feed_code, :atom), {:title => t('titles.rss.course_announcements', "Course Announcements Atom Feed")}) %>
<% end %>
<% end %>
@ -29,6 +29,22 @@
</ul>
<% end %>
<% unless @current_user.current_groups.empty? %>
<h2><%= t('headings.my_groups', %{My Groups}) %></h2>
<ul class="unstyled_list context_list current_groups">
<% @current_user.current_groups.each do |group| %>
<% group_name = group.name %>
<li>
<a href=<%= group_path(group) %>>
<span class="name ellipsis" title=<%= group_name %>>
<%= group_name %>
</span>
</a>
</li>
<% end %>
</ul>
<% end %>
<% unless @past_enrollments.empty? %>
<h2><%= t('headings.past_enrollments', %{Past Enrollments}) %></h2>
<ul class="unstyled_list context_list past_enrollments">

View File

@ -1,4 +1,4 @@
<a href="<%= dashboard_path %>" class="menu-item-title">
<a href="<%= courses_path %>" class="menu-item-title">
<%= @current_user.menu_data[:group_memberships_count].zero? ? t('links.courses', "Courses") : t('links.courses_and_groups', "Courses & Groups") -%>
<span class="menu-item-title-icon"></span> <i class="icon-mini-arrow-down"></i></a>
<div class="menu-item-drop">

View File

@ -250,5 +250,17 @@ describe "courses" do
login_as(@student.name)
f('#menu').should_not include_text('Courses')
end
it "should display user groups on courses page" do
group = Group.create!(:name => "group1", :context => @course)
group.add_user(@student)
login_as(@student.name)
get '/courses'
content = f('#content')
content.should include_text('My Groups')
content.should include_text('group1')
end
end
end

View File

@ -221,7 +221,7 @@ describe "dashboard" do
group = Group.create!(:name => "group1", :context => @course)
group.add_user(@user)
@course.update_attributes(:start_at => 2.days.from_now, :conclude_at => 4.days.from_now, :restrict_enrollments_to_course_dates => false)
Enrollment.update_all(:created_at => 1.minute.ago)
Enrollment.update_all(:created_at => 1.minute.ago)
get "/"
@ -232,6 +232,18 @@ describe "dashboard" do
course_menu.should include_text(group.name)
end
it "should go to /courses when the courses nav item is clicked" do
@course.update_attributes(:start_at => 2.days.from_now, :conclude_at => 4.days.from_now, :restrict_enrollments_to_course_dates => false)
Enrollment.update_all(:created_at => 1.minute.ago)
get '/'
keep_trying_until do
f('#courses_menu_item a').click
driver.current_url.should include('courses')
end
end
it "should display scheduled web conference in stream" do
PluginSetting.create!(:name => "wimba", :settings => {"domain" => "wimba.instructure.com"})
@ -251,24 +263,24 @@ describe "dashboard" do
it "should display calendar events in the coming up list" do
calendar_event_model({
:title => "super fun party",
:description => 'celebrating stuff',
:start_at => 5.minutes.from_now,
:end_at => 10.minutes.from_now
:title => "super fun party",
:description => 'celebrating stuff',
:start_at => 5.minutes.from_now,
:end_at => 10.minutes.from_now
})
get "/"
f('div.events_list .event a').should include_text(@event.title)
end
it "should display quiz submissions with essay questions as submitted in coming up list" do
quiz_with_graded_submission([:question_data => {:id => 31,
:name => "Quiz Essay Question 1",
:question_type => 'essay_question',
:question_text => 'qq1',
quiz_with_graded_submission([:question_data => {:id => 31,
:name => "Quiz Essay Question 1",
:question_type => 'essay_question',
:question_text => 'qq1',
:points_possible => 10}],
{:user => @student, :course => @course}) do
{
"question_31" => "<p>abeawebawebae</p>",
"question_31" => "<p>abeawebawebae</p>",
"question_text" => "qq1"
}
end