Skip to content

Commit 49658cd

Browse files
committedFeb 2, 2016
add images and readme
1 parent 8cc5eed commit 49658cd

10 files changed

+17
-9
lines changed
 

‎README.md

+10
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,13 @@ server.js
2929
* Node.js
3030
* Socket.io
3131
* Express
32+
33+
![Alt text](/images/tender_landingpage.png?raw=true "Landing Page")
34+
35+
![Alt text](/images/tender_login.png?raw=true "Log in")
36+
37+
![Alt text](/images/tender_profile.png?raw=true "User's profile")
38+
39+
![Alt text](/images/tender_profile2.png?raw=true "Match Profile")
40+
41+
![Alt text](/images/tender_chat.png?raw=true "Chat socket.io")

‎app/controllers/comments_controller.rb

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ class CommentsController < ApplicationController
44
def chat
55
@match_id = User.find(params[:id])
66
@messages = Message.where(user_id:current_user.id, match_id: params[:id])
7+
@user = User.find(current_user.id)
78
end
89

910
def count

‎app/views/comments/chat.html.erb

+3-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<form class="col s12" id="chat-form">
1818
<div class="row">
1919
<div class="input-field col s4">
20-
<input type="hidden" id="chat-name" value="<%= current_user.first_name%>">
20+
<input type="hidden" id="chat-name" value="<%= @user.first_name%>">
2121
<input type="hidden" value="<%= @match_id.id %>" id="match_id">
2222
<input id="textbox" class="input-filed col s12" placeholder="Enter message here" required>
2323
</div>
@@ -28,7 +28,7 @@
2828
<script type="text/javascript">
2929
var socket = io.connect("http://127.0.0.1:8000", {force_connection: true});
3030

31-
socket.on("welcome", function(){
31+
socket.on("welcome", function(response){
3232
$("#chatbox").append("<div class='chatenter'>" + $("#chat-name").val() +" has entered chatroom</div>")
3333
});
3434

@@ -51,15 +51,12 @@
5151
socket.on("feed", function(response){
5252
for(var i = 0; i < response.messageFeed.length; i++) {
5353
$("#chatbox").append("<p>" + response.messageFeed[i].message + "</p>")
54-
$("#count").append(response.messageFeed.length);
5554
};
5655
var match_id = $("#match_id").val()
5756
$.post("/count", {count: response.messageFeed.length, match_id: match_id}, function(res){
5857
console.log(res.result);
5958
});
6059

6160
});
62-
socket.on("disconnected", function(){
63-
$("#chatbox").append(name + " has left the chatroom");
64-
})
61+
6562
</script>

‎chat/server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ io.sockets.on('connection', function (socket) {
1515
console.log("WE ARE USING SOCKETS!");
1616
console.log(socket.id);
1717

18-
io.emit("welcome");
18+
io.emit("welcome", {userId: socket.id});
1919

2020
socket.emit("feed", {messageFeed: history})
2121

‎config/database.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ default: &default
2323

2424

2525

26-
username: jessicapeng
26+
username: Tomtom
2727
password:
2828

2929
development:
@@ -88,7 +88,7 @@ production:
8888
database: ror_project_production
8989

9090

91-
username: jessicapeng
91+
username: Tomtom
9292
password:
9393

9494

‎images/tender_landingpage.png

3.54 MB
Loading

‎images/tender_login.png

138 KB
Loading

‎images/tender_profile.png

238 KB
Loading

‎images/tender_profile2.png

151 KB
Loading

‎images/tendet_chat.png

63.1 KB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.