Permalink
Browse files

Implement chat log + Add my own message to log

  • Loading branch information...
1 parent 4942ada commit 03d72f9c6158b6000c83b7c632e9fbeec276be62 @remichaignon remichaignon committed Apr 21, 2012
Showing with 38 additions and 2 deletions.
  1. +19 −1 js/gitchat.js
  2. +1 −1 styles/master.css
  3. +15 −0 styles/master.less
  4. +3 −0 templates/home/chat_log.html
View
@@ -77,7 +77,22 @@ function Gitchat() {
"org":"test_org",
"members":"120"
},
- "home/chat_log": {},
+ "home/chat_log": {
+ "logs": [
+ {
+ "type":"user",
+ "message":"this is a user's message"
+ },
+ {
+ "type":"me",
+ "message":"this is one of my message"
+ },
+ {
+ "type":"bot",
+ "message":"this is a bot's message"
+ }
+ ]
+ },
"home/chat_input": {},
"home/people_list": {
"people": [
@@ -175,7 +190,10 @@ function Gitchat() {
"submit",
"#chat-form",
function(e) {
+ e.preventDefault();
+
// Add message to log
+ $(".chat_log").append("<div class=\"log me\">" + $("#chat-form input").val() + "</div>");
}
)
break;
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -57,6 +57,21 @@ body {
}
.chat_log {
background-color:lighten(#0f0, 30%);
+
+ .log {
+ width:80%;
+ border:1px solid #888;
+
+ &.me {
+ background-color:lighten(#0f0, 40%);
+ }
+ &.user {
+ background-color:#fff;
+ }
+ &.bot {
+ background-color:lighten(#ff0, 40%);
+ }
+ }
}
.chat_input {
background-color:lighten(#ff0, 30%);
@@ -0,0 +1,3 @@
+{{#each logs}}
+ <div class="log {{type}}">{{message}}</div>
+{{/each}}

0 comments on commit 03d72f9

Please sign in to comment.