diff --git a/app/helpers/wive_helper.rb b/app/helpers/wive_helper.rb index 530485e..f560a95 100644 --- a/app/helpers/wive_helper.rb +++ b/app/helpers/wive_helper.rb @@ -1,11 +1,11 @@ module WiveHelper def wive username, opts = {} - room_name = opts[:room_name].blank? ? "window.location.hostname + window.location.pathname" : "'#{opts[:room_name]}'" + room_name = opts[:room_name].blank? ? "#{request.host}/#{request.path}" : "#{opts[:room_name]}" link_url = opts[:link_url] image_url = opts[:image_url] if image_url.blank? - image_url = image_url("letter-#{username.first}.png", class: "icon") + image_url = image_url("letter-#{username.first.downcase}.png", class: "icon") end render :partial => 'shared/wive', locals: {username: username, room_name: room_name, link_url: link_url, image_url: image_url} diff --git a/app/views/shared/_wive.html.erb b/app/views/shared/_wive.html.erb index c9ffc76..8bf9150 100644 --- a/app/views/shared/_wive.html.erb +++ b/app/views/shared/_wive.html.erb @@ -24,17 +24,19 @@ var element = ' '; var socket = io.connect('<%= Wive.server %>'); - socket.emit('user_and_room', '<%= username%>', <%= room_name %>, '<%= image_url %>', '<%= link_url%>'); + socket.emit('user_and_room', '<%= username%>', '<%= room_name %>', '<%= image_url %>', '<%= link_url%>'); socket.on('room_update', function(users){ $('#participants-list').empty(); $.each(users, function(index, value){ - element = element.replace('{{link_url}}', value['link_url']); - element = element.replace('{{username}}', value['username']); - element = element.replace('{{username}}', value['username']); - element = element.replace('{{image_url}}', value['image_url']); - $('#participants-list').append($('