Skip to content

Commit

Permalink
Fixes pastie
Browse files Browse the repository at this point in the history
Signed-off-by: Akash Manohar J <akash@akash.im>
  • Loading branch information
HashNuke committed Apr 11, 2012
1 parent 42e95cb commit c0d0fab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions app/assets/javascripts/backbone/kandan.js.coffee
Expand Up @@ -100,15 +100,16 @@ window.Kandan =
template = JST['current_user']
currentUser = Kandan.Helpers.Users.currentUser()
$(".header .user").html template({
gravatar_hash: currentUser.gravatar_hash,
gravatarHash: currentUser.gravatar_hash,
name: "#{currentUser.first_name} #{currentUser.last_name}"
})

init: ->
@setCurrentUser()
channels = new Kandan.Collections.Channels()
channels.fetch({success: (channelsCollection)=>
@initBroadcasterAndSubscribe()
activeUsers = new Kandan.Collections.ActiveUsers()
activeUsers.fetch({success: @onFetchActiveUsers(channelsCollection)})
channels.fetch({
success: (channelsCollection)=>
@initBroadcasterAndSubscribe()
activeUsers = new Kandan.Collections.ActiveUsers()
activeUsers.fetch({success: @onFetchActiveUsers(channelsCollection)})
})
4 changes: 2 additions & 2 deletions app/assets/javascripts/backbone/plugins/pastie.js.coffee
Expand Up @@ -16,14 +16,14 @@ class Kandan.Plugins.Pastie
originalLength = content.length
content = content.split("/n").slice(0, @options.maxPreviewLines) if content.split("\n") > @options.maxPreviewLines
content = content.substring(0, @options.maxPreviewLength) if content.length > @options.maxPreviewLines
return "#{content}..." if content.length == originalLength
return "#{content}..." if content.length != originalLength
content


@init: ->
Kandan.Modifiers.register @options.regex, (message, state) =>
url = "/channels/#{message.channel_id}/activities/#{message.id}"
message.content = @options.template({preview: (message.content), messageLink: url})
message.content = @options.template({preview: @truncate(message.content), messageLink: url})
return Kandan.Helpers.Activities.build_from_message_template(message)

# Kandan.Plugins.register "Kandan.Plugins.Pastie"
2 changes: 1 addition & 1 deletion app/assets/templates/current_user.jst.eco
@@ -1,2 +1,2 @@
<img src="http://gravatar.com/avatar/<%= @gravatar_hash %>?s=25&d=http://bushi.do/images/profile.png"/>
<img src="http://gravatar.com/avatar/<%= @gravatarHash %>?s=25&d=http://bushi.do/images/profile.png"/>
<span><%= @name %></span>

0 comments on commit c0d0fab

Please sign in to comment.