show course name with group in conversations search. fixes #5795
Change-Id: I091fea931eba141aabe5c044ad06c8cdd3368415 Reviewed-on: https://gerrit.instructure.com/5907 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: Jon Jensen <jon@instructure.com>
This commit is contained in:
parent
5ecdfa444f
commit
ec1a042a5e
|
@ -1507,6 +1507,9 @@ I18n.scoped 'conversations', (I18n) ->
|
|||
$img = $('<img class="avatar" />')
|
||||
$img.attr('src', data.avatar_url)
|
||||
$node.append($img)
|
||||
context_name = if data.context_name then data.context_name else ''
|
||||
context_name = if context_name.length < 40 then context_name else context_name.substr(0, 40) + '...'
|
||||
$context_name = if data.context_name then $('<span />', class: 'context_name').text("(#{context_name})") else ''
|
||||
$b = $('<b />')
|
||||
$b.text(data.name)
|
||||
$span = $('<span />')
|
||||
|
@ -1514,7 +1517,7 @@ I18n.scoped 'conversations', (I18n) ->
|
|||
$span.text(MessageInbox.context_list(data))
|
||||
else if data.type and data.user_count?
|
||||
$span.text(I18n.t('people_count', 'person', {count: data.user_count}))
|
||||
$node.append($b, $span)
|
||||
$node.append($b, $context_name, $span)
|
||||
$node.attr('title', data.name)
|
||||
$node.data('id', data.id)
|
||||
$node.data('user_data', data)
|
||||
|
|
|
@ -602,7 +602,7 @@ class ConversationsController < ApplicationController
|
|||
@contexts[:courses][course.id] = {:id => course.id, :name => course.name, :type => :course, :active => true, :can_add_notes => can_add_notes_to?(course) }
|
||||
end
|
||||
@current_user.messageable_groups.each do |group|
|
||||
@contexts[:groups][group.id] = {:id => group.id, :name => group.name, :type => :group, :active => group.active? }
|
||||
@contexts[:groups][group.id] = {:id => group.id, :name => group.name, :type => :group, :active => group.active?, :context_name => group.context.name }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -626,11 +626,13 @@ class ConversationsController < ApplicationController
|
|||
select{ |context| context[:active] }.
|
||||
sort_by{ |context| context[:name] }.
|
||||
map{ |context|
|
||||
{:id => "#{context[:type]}_#{context[:id]}",
|
||||
ret = {:id => "#{context[:type]}_#{context[:id]}",
|
||||
:name => context[:name],
|
||||
:avatar_url => avatar_url,
|
||||
:type => :context,
|
||||
:user_count => (context[:type] == :course ? course_user_counts : group_user_counts)[context[:id]]}
|
||||
ret[:context_name] = context[:context_name] unless context[:context_name].nil?
|
||||
ret
|
||||
}.
|
||||
reject{ |context|
|
||||
exclude.include?(context[:id])
|
||||
|
|
|
@ -793,14 +793,19 @@ li.purple .label_icon, .purple.label_icon
|
|||
margin-right: 6px
|
||||
background: transparent url(/images/messages/avatar-sprites.png) 0 0 no-repeat
|
||||
b, span
|
||||
display: block
|
||||
white-space: nowrap
|
||||
overflow: hidden
|
||||
b
|
||||
color: #000
|
||||
text-shadow: none
|
||||
span.context_name
|
||||
display: inline
|
||||
padding-left: 6px
|
||||
position: relative
|
||||
bottom: 1px
|
||||
span
|
||||
color: #2571bd
|
||||
display: block
|
||||
font-weight: bold
|
||||
font-size: 0.8em
|
||||
li.context img.avatar, li.context.active.expanded img.avatar
|
||||
|
|
|
@ -688,9 +688,7 @@
|
|||
if (this.list_expanded()) {
|
||||
post_data.context = this.stack[this.stack.length - 1][0].data('id');
|
||||
}
|
||||
if ((_ref = post_data.per_page) != null) {
|
||||
_ref;
|
||||
} else {
|
||||
if ((_ref = post_data.per_page) == null) {
|
||||
post_data.per_page = typeof (_base = this.options).limiter === "function" ? _base.limiter({
|
||||
level: this.stack.length
|
||||
}) : void 0;
|
||||
|
@ -2019,7 +2017,7 @@
|
|||
no_results: I18n.t('no_results', 'No results found')
|
||||
},
|
||||
populator: function($node, data, options) {
|
||||
var $b, $img, $span;
|
||||
var $b, $context_name, $img, $span, context_name;
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
|
@ -2028,6 +2026,11 @@
|
|||
$img.attr('src', data.avatar_url);
|
||||
$node.append($img);
|
||||
}
|
||||
context_name = data.context_name ? data.context_name : '';
|
||||
context_name = context_name.length < 40 ? context_name : context_name.substr(0, 40) + '...';
|
||||
$context_name = data.context_name ? $('<span />', {
|
||||
"class": 'context_name'
|
||||
}).text("(" + context_name + ")") : '';
|
||||
$b = $('<b />');
|
||||
$b.text(data.name);
|
||||
$span = $('<span />');
|
||||
|
@ -2038,7 +2041,7 @@
|
|||
count: data.user_count
|
||||
}));
|
||||
}
|
||||
$node.append($b, $span);
|
||||
$node.append($b, $context_name, $span);
|
||||
$node.attr('title', data.name);
|
||||
$node.data('id', data.id);
|
||||
$node.data('user_data', data);
|
||||
|
|
|
@ -355,7 +355,7 @@ describe ConversationsController, :type => :integration do
|
|||
json.each { |c| c.delete("avatar_url") }
|
||||
json.should eql [
|
||||
{"id" => "course_#{@course.id}", "name" => "the course", "type" => "context", "user_count" => 6},
|
||||
{"id" => "group_#{@group.id}", "name" => "the group", "type" => "context", "user_count" => 3},
|
||||
{"id" => "group_#{@group.id}", "name" => "the group", "type" => "context", "user_count" => 3, "context_name" => "the course"},
|
||||
{"id" => @bob.id, "name" => "bob", "common_courses" => {@course.id.to_s => ["StudentEnrollment"]}, "common_groups" => {@group.id.to_s => ["Member"]}},
|
||||
{"id" => @joe.id, "name" => "joe", "common_courses" => {@course.id.to_s => ["StudentEnrollment"]}, "common_groups" => {@group.id.to_s => ["Member"]}},
|
||||
{"id" => @me.id, "name" => @me.name, "common_courses" => {@course.id.to_s => ["TeacherEnrollment"]}, "common_groups" => {@group.id.to_s => ["Member"]}},
|
||||
|
|
Loading…
Reference in New Issue