avatar fix
This commit is contained in:
parent
4b45f63eda
commit
3e8b1f1119
|
@ -112,11 +112,16 @@ class Admin::TicketsApiController < ApplicationController
|
||||||
r = {"query" => qu.query, "responses" => []}
|
r = {"query" => qu.query, "responses" => []}
|
||||||
r["responses"] = qu.ticket_query_responses.asc(:created_at).collect do |qr|
|
r["responses"] = qu.ticket_query_responses.asc(:created_at).collect do |qr|
|
||||||
user = User.find(qr.response_by) rescue nil
|
user = User.find(qr.response_by) rescue nil
|
||||||
|
if user.member_profile.avatar.nil? || user.member_profile.avatar.thumb.url == "thumb_person.png"
|
||||||
|
avatar = "http://" + request.host_with_port + "/assets/thumb_person.png"
|
||||||
|
else
|
||||||
|
avatar = "http://" + request.host_with_port + user.member_profile.avatar.thumb.url
|
||||||
|
end
|
||||||
{
|
{
|
||||||
"response" => qr.response,
|
"response" => qr.response,
|
||||||
"response_time" => qr.created_at,
|
"response_time" => qr.created_at,
|
||||||
"response_by" => (user.name if !user.nil?),
|
"response_by" => (user.name if !user.nil?),
|
||||||
"avatar" => ("http://" + request.host_with_port + user.member_profile.avatar.thumb.url if !user.member_profile.avatar.nil?)
|
"avatar" => avatar
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
response["ticket"]["queries"] << r
|
response["ticket"]["queries"] << r
|
||||||
|
|
|
@ -2,7 +2,13 @@
|
||||||
<div class="ticket-response-meta">
|
<div class="ticket-response-meta">
|
||||||
<div class="ticket-response-author">
|
<div class="ticket-response-author">
|
||||||
<% user = User.find(response.response_by) rescue nil %>
|
<% user = User.find(response.response_by) rescue nil %>
|
||||||
<img class="ticket-response-avatar" src="<%= user.member_profile.avatar.thumb.url if !user.member_profile.avatar.nil? %>" />
|
<% if user.member_profile.avatar.nil? || user.member_profile.avatar.thumb.url == "thumb_person.png"
|
||||||
|
avatar = "/assets/thumb_person.png"
|
||||||
|
else
|
||||||
|
avatar = user.member_profile.avatar.thumb.url
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<img class="ticket-response-avatar" src="<%= avatar %>" />
|
||||||
<span class="ticket-response-name"><%= user.name if !user.nil? %></span>
|
<span class="ticket-response-name"><%= user.name if !user.nil? %></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="ticket-response-created-date">
|
<div class="ticket-response-created-date">
|
||||||
|
|
Loading…
Reference in New Issue