add avatars to roster pages
In courses and groups, add the avatar picture below each user's name. test plan: - enable avatars on an account - load a course roster - make sure avatar pictures appear correctly - load a group roster - make sure avatar pictures appear correctly - disable avatars on the account - load the course roster - make sure avatar pictures appear correctly Change-Id: Ib1f91edb153b42a20a3212aa5d12d5383d8b3325 Reviewed-on: https://gerrit.instructure.com/9024 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: Ryan Shaw <ryan@instructure.com>
This commit is contained in:
parent
e5cc031f25
commit
8cd7a22309
|
@ -37,6 +37,10 @@
|
|||
margin-left: 10px;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
.roster div.avatar {
|
||||
float: left;
|
||||
padding-right: 5px;
|
||||
}
|
||||
.fill_height_div {
|
||||
overflow: auto;
|
||||
}
|
||||
|
@ -51,8 +55,13 @@
|
|||
<table>
|
||||
<% @primary_users[@primary_users.keys.first].each do |student| %>
|
||||
<tr class="user" id="user_<%= student.id %>">
|
||||
<td style="vertical-align: top;">
|
||||
<% if service_enabled?(:avatars) %>
|
||||
<div class="avatar"><%= avatar(student.id, @context.asset_string, 30) %></div>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<a href="<%= context_url(@context, :context_user_url, student.id) %>" class="user_name"><%= can_do(@context, @current_user, :manage_students) ? student.name : student.short_name %></a>
|
||||
<div><a href="<%= context_url(@context, :context_user_url, student.id) %>" class="user_name"><%= can_do(@context, @current_user, :manage_students) ? student.name : student.short_name %></a></div>
|
||||
<% if can_do(@context, @current_user, :manage_students) %>
|
||||
<div class="more_info">
|
||||
<div class="short_name"><%= student.short_name %></div>
|
||||
|
@ -64,6 +73,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div style="clear: left;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
@ -77,8 +87,13 @@
|
|||
<table>
|
||||
<% @secondary_users[@secondary_users.keys.first].each do |teacher| %>
|
||||
<tr class="user" id="user_<%= teacher.id %>">
|
||||
<td style="vertical-align: top;">
|
||||
<% if service_enabled?(:avatars) %>
|
||||
<div class="avatar"><%= avatar(teacher.id, @context.asset_string, 30) %></div>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<a href="<%= context_url(@context, :context_user_url, teacher.id) %>" class="user_name"><%= teacher.name %></a>
|
||||
<div><a href="<%= context_url(@context, :context_user_url, teacher.id) %>" class="user_name"><%= teacher.name %></a></div>
|
||||
<% if can_do(@context, @current_user, :manage_admin_users) %>
|
||||
<div class="more_info">
|
||||
<div class="short_name"><%= teacher.short_name %></div>
|
||||
|
@ -90,6 +105,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div style="clear: left;"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
#
|
||||
# Copyright (C) 2011 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__) + '/../apis/api_spec_helper')
|
||||
|
||||
describe ContextController, :type => :integration do
|
||||
it "should not include user avatars if avatars are not enabled" do
|
||||
course_with_student_logged_in(:active_all => true)
|
||||
get "/courses/#{@course.id}/users"
|
||||
response.should be_success
|
||||
page = Nokogiri::HTML(response.body)
|
||||
page.css(".roster .user").length.should == 2
|
||||
page.css(".roster .user .avatar").length.should == 0
|
||||
end
|
||||
it "should include user avatars if avatars are enabled" do
|
||||
course_with_student_logged_in(:active_all => true)
|
||||
@account = Account.default
|
||||
@account.enable_service(:avatars)
|
||||
@account.save!
|
||||
@account.service_enabled?(:avatars).should be_true
|
||||
get "/courses/#{@course.id}/users"
|
||||
response.should be_success
|
||||
|
||||
page = Nokogiri::HTML(response.body)
|
||||
page.css(".roster .user").length.should == 2
|
||||
page.css(".roster .user div.avatar").length.should == 2
|
||||
page.css(".roster .user div.avatar img")[0]['src'].should match(/\/images\/users\/#{@user.id}/)
|
||||
page.css(".roster .user div.avatar img")[1]['src'].should match(/\/images\/users\/#{@teacher.id}/)
|
||||
|
||||
@group = @course.groups.create!(:name => "sub-group")
|
||||
@group.add_user(@user)
|
||||
get "/groups/#{@group.id}/users"
|
||||
response.should be_success
|
||||
|
||||
page = Nokogiri::HTML(response.body)
|
||||
page.css(".roster .user").length.should == 2
|
||||
page.css(".roster .user div.avatar").length.should == 2
|
||||
page.css(".roster .user div.avatar img")[0]['src'].should match(/\/images\/users\/#{@user.id}/)
|
||||
page.css(".roster .user div.avatar img")[1]['src'].should match(/\/images\/users\/#{@teacher.id}/)
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue