Add course and term names under group listings
Multiple groups with the same name are now better identified with their context names (and term names if they are courses). Test Plan: * Create two courses, with one of them in the Default Term * Create course groups in those courses * Add a student to both course groups * As the student, go to /courses * Make sure the course name appears under the group name * Make sure the term name appears (unless it's in the Default Term) * Do the same for /groups
This commit is contained in:
parent
889e589cec
commit
6a196ab4d1
|
@ -43,6 +43,10 @@
|
|||
<span class="name ellipsis" title=<%= group_name %>>
|
||||
<%= group_name %>
|
||||
</span>
|
||||
<span class="subtitle ellipsis"><%= group.context.name %></span>
|
||||
<% if group.context_type == 'Course' && !group.context.enrollment_term.default_term? %>
|
||||
<span class="subtitle ellipsis"><%= group.context.enrollment_term.name %></span>
|
||||
<% end %>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
<% @groups.each do |group| %>
|
||||
<li>
|
||||
<%= link_to group.name, group_path(group) %>
|
||||
<span class="subtitle"><%= group.context.name %></span>
|
||||
<% if group.context_type == 'Course' && !group.context.enrollment_term.default_term? %>
|
||||
<span class="subtitle"><%= group.context.enrollment_term.name %></span>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
#
|
||||
# Copyright (C) 2014 Instructure, Inc.
|
||||
#
|
||||
# This file is part of Canvas.
|
||||
#
|
||||
# Canvas is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../views_helper')
|
||||
|
||||
describe "/courses/index" do
|
||||
it "should render" do
|
||||
course_with_student
|
||||
view_context
|
||||
assigns[:current_enrollments] = [@enrollment]
|
||||
assigns[:past_enrollments] = []
|
||||
assigns[:future_enrollments] = []
|
||||
render "courses/index"
|
||||
response.should_not be_nil
|
||||
end
|
||||
|
||||
it "should show context name under group name" do
|
||||
course_with_student
|
||||
group_with_user(:user => @user, :group_context => @course)
|
||||
view_context
|
||||
assigns[:current_enrollments] = [@enrollment]
|
||||
assigns[:past_enrollments] = []
|
||||
assigns[:future_enrollments] = []
|
||||
render "courses/index"
|
||||
doc = Nokogiri::HTML.parse(response.body)
|
||||
doc.at_css('#my_groups_table tr:first span.subtitle').text.should == @course.name
|
||||
end
|
||||
end
|
|
@ -30,5 +30,17 @@ describe "/groups/index" do
|
|||
render "groups/index"
|
||||
response.should_not be_nil
|
||||
end
|
||||
end
|
||||
|
||||
it "should show context name under group name" do
|
||||
course_with_student
|
||||
group_with_user(:user => @user, :group_context => @course)
|
||||
view_context
|
||||
assigns[:categories] = []
|
||||
assigns[:students] = [@user]
|
||||
assigns[:memberships] = []
|
||||
assigns[:groups] = [@group]
|
||||
render "groups/index"
|
||||
doc = Nokogiri::HTML.parse(response.body)
|
||||
doc.at_css('ul.context_list li:first span.subtitle').text.should == @course.name
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue