Permalink
Browse files

Add ICH templates for join/part/nick actions.

Note that earlier commit broke html parsing -- need to rectify that.
  • Loading branch information...
akavlie committed Jan 29, 2012
1 parent 32c62c7 commit f808b158222b7b9b02eed1a24f4819de7b4e66d8
Showing with 19 additions and 6 deletions.
  1. +9 −4 assets/js/views/message.js
  2. +10 −2 views/templates.jade
View
@@ -36,13 +36,18 @@ var MessageView = Backbone.View.extend({
var html = '';
switch (type) {
case 'join':
- html = '<span class="join_img"></span><b>' + this.model.get('nick') + '</b> joined the channel';
- break;
case 'part':
- html = '<span class="part_img"></span><b>' + this.model.get('nick') + '</b> left the channel';
+ html = ich.join_part({
+ type: type,
+ nick: this.model.get('nick'),
+ action: type === 'join' ? 'joined' : 'left'
+ });
break;
case 'nick':
- html = '<b>' + this.model.get('oldNick') + '</b> is now known as ' + this.model.get('newNick');
+ html = ich.nick({
+ oldNick: this.model.get('oldNick'),
+ newNick: this.model.get('newNick')
+ });
break;
}
return html;
View
@@ -87,13 +87,14 @@ script(id="image_embed", type="text/html")
script(id="youtube_embed", type="text/html")
.embed
- iframe(width="420", height="315", src="http://www.youtube.com/embed/{{video_id}}?rel=0", frameborder="0", allowfullscreen)
+ iframe(width="420", height="315", frameborder="0", allowfullscreen,
+ src="http://www.youtube.com/embed/{{video_id}}?rel=0")
script(id="action", type="text/html")
.chat_action
b * {{user}}&nbsp;
span {{content}}
- .chat_time
+ .chat-time
span {{renderedTime}}
script(id="message", type="text/html")
@@ -103,3 +104,10 @@ script(id="message", type="text/html")
span {{content}}
.chat-time
span {{renderedTime}}
+
+script(id="join_part", type="text/html")
+ span(class="{{type}}_img")
+ span <b>{{nick}}</b> {{action}} the channel
+
+script(id="nick", type="text/html")
+ span <b>{{oldNick}}</b> is now known as {{newNick}}

0 comments on commit f808b15

Please sign in to comment.