Added chat window details popover.
This commit is contained in:
parent
3b47640d01
commit
698f69d1b0
4 changed files with 51 additions and 10 deletions
|
@ -366,14 +366,8 @@ class ChatWindow extends App.Controller
|
||||||
@isAgentTyping = false
|
@isAgentTyping = false
|
||||||
@resetUnreadMessages()
|
@resetUnreadMessages()
|
||||||
|
|
||||||
chat = App.Chat.find(@session.chat_id)
|
@chat = App.Chat.find(@session.chat_id)
|
||||||
@name = "#{chat.displayName()} [##{@session.id}]"
|
@name = "#{@chat.displayName()} ##{@session.id}"
|
||||||
@title = ''
|
|
||||||
if @session && @session.preferences && @session.preferences.geo_ip
|
|
||||||
if @session.preferences.geo_ip.country_name
|
|
||||||
@title += @session.preferences.geo_ip.country_name
|
|
||||||
if @session.preferences.geo_ip.city_name
|
|
||||||
@title += " #{@session.preferences.geo_ip.city_name}"
|
|
||||||
|
|
||||||
@on 'layout-change', @scrollToBottom
|
@on 'layout-change', @scrollToBottom
|
||||||
|
|
||||||
|
@ -407,7 +401,6 @@ class ChatWindow extends App.Controller
|
||||||
render: ->
|
render: ->
|
||||||
@html App.view('customer_chat/chat_window')
|
@html App.view('customer_chat/chat_window')
|
||||||
name: @name
|
name: @name
|
||||||
title: @title
|
|
||||||
|
|
||||||
@el.one 'transitionend', @onTransitionend
|
@el.one 'transitionend', @onTransitionend
|
||||||
|
|
||||||
|
@ -435,6 +428,21 @@ class ChatWindow extends App.Controller
|
||||||
@input.html(phrase)
|
@input.html(phrase)
|
||||||
@sendMessage(1600)
|
@sendMessage(1600)
|
||||||
|
|
||||||
|
@$('.js-info').popover(
|
||||||
|
trigger: 'hover'
|
||||||
|
html: true
|
||||||
|
animation: false
|
||||||
|
delay: 0
|
||||||
|
placement: 'bottom'
|
||||||
|
container: 'body' # place in body do prevent it from animating
|
||||||
|
title: ->
|
||||||
|
App.i18n.translateContent('Details')
|
||||||
|
content: =>
|
||||||
|
App.view('customer_chat/chat_window_info')(
|
||||||
|
session: @session
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
focus: =>
|
focus: =>
|
||||||
@input.focus()
|
@input.focus()
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<%- @Icon('small-dot', 'icon-status-modified-inner-circle') %>
|
<%- @Icon('small-dot', 'icon-status-modified-inner-circle') %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chat-name" title="<%= @title %>">
|
<div class="chat-name">
|
||||||
<%= @name %> <div class="status-badge js-info">
|
<%= @name %> <div class="status-badge js-info">
|
||||||
<div class="info-badge"><%- @Icon('info') %></div>
|
<div class="info-badge"><%- @Icon('info') %></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<ul>
|
||||||
|
<% if @session: %>
|
||||||
|
<li><%- @T('Created at') %>: <%- @Ttimestamp(@session.created_at) %>
|
||||||
|
<% end %>
|
||||||
|
<% if @session && @session.preferences: %>
|
||||||
|
<% if @session.preferences.geo_ip: %>
|
||||||
|
<li>GeoIP: <%= @session.preferences.geo_ip.country_name %> <%= @session.preferences.geo_ip.city_name %>
|
||||||
|
<% end %>
|
||||||
|
<% if @session.preferences.remote_ip: %>
|
||||||
|
<li>IP: <%= @session.preferences.remote_ip %>
|
||||||
|
<% end %>
|
||||||
|
<% if @session.preferences.dns_name: %>
|
||||||
|
<li>DNS: <%= @session.preferences.dns_name %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
|
@ -10,6 +10,22 @@ class Sessions::Event::ChatSessionInit < Sessions::Event::ChatBase
|
||||||
geo_ip = Service::GeoIp.location(@remote_ip)
|
geo_ip = Service::GeoIp.location(@remote_ip)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# dns lookup
|
||||||
|
dns_name = nil
|
||||||
|
if @remote_ip
|
||||||
|
begin
|
||||||
|
dns = Resolv::DNS.new
|
||||||
|
dns.timeouts = 3
|
||||||
|
result = dns.getname @remote_ip
|
||||||
|
if result
|
||||||
|
dns_name = result.to_s
|
||||||
|
end
|
||||||
|
rescue => e
|
||||||
|
Rails.logger.error e.message
|
||||||
|
Rails.logger.error e.backtrace.inspect
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# create chat session
|
# create chat session
|
||||||
chat_session = Chat::Session.create(
|
chat_session = Chat::Session.create(
|
||||||
chat_id: @payload['data']['chat_id'],
|
chat_id: @payload['data']['chat_id'],
|
||||||
|
@ -19,6 +35,7 @@ class Sessions::Event::ChatSessionInit < Sessions::Event::ChatBase
|
||||||
participants: [@client_id],
|
participants: [@client_id],
|
||||||
remote_ip: @remote_ip,
|
remote_ip: @remote_ip,
|
||||||
geo_ip: geo_ip,
|
geo_ip: geo_ip,
|
||||||
|
dns_name: dns_name,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue