-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds /me plugin * Adds link plugin * Changes the way activities are rendered * Cleans up the broadcaster * Fixes modifier * Adds template helpers * Adds base and message templates for activities Caveats: Inline formatting doesnt work with history [fixing it] Signed-off-by: Akash Manohar J <[email protected]>
- Loading branch information
Showing
13 changed files
with
89 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
app/assets/javascripts/backbone/helpers/activities.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class Kandan.Helpers.Activities | ||
|
||
# TODO document this | ||
@ACTIVE_STATE: "ACTIVE" | ||
@HISTORY_STATE: "HISTORY" | ||
|
||
@build_from_base_template: (activity)-> | ||
JST['activity_base']({activity: activity}) | ||
|
||
@build_from_message_template: (activity)-> | ||
JST['message']({activity: activity}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Kandan.Plugins.Link | ||
|
||
@regex: /http:\S*/g | ||
|
||
@init: ()-> | ||
Kandan.Modifiers.register @regex, (message, state)=> | ||
message.content = message.content.replace @regex, '<a target="_blank" href="$1">$1</a>' | ||
return Kandan.Helpers.Activities.build_from_message_template(message) | ||
|
||
Kandan.Plugins.register "Kandan.Plugins.Link" |
10 changes: 10 additions & 0 deletions
10
app/assets/javascripts/backbone/plugins/me_announce.js.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Kandan.Plugins.MeAnnounce | ||
|
||
@regex: /^\/me / | ||
|
||
@init: ()-> | ||
Kandan.Modifiers.register @regex, (message, state)=> | ||
message.content = message.content.replace @regex, "#{message.user.first_name} " | ||
return Kandan.Helpers.Activities.build_from_base_template(message) | ||
|
||
Kandan.Plugins.register "Kandan.Plugins.MeAnnounce" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= @activity.content %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= @activity.user.first_name %>: <%= @activity.content %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<%= @activity.get('user').first_name %> <%= @activity.get('action') %> | ||
<%= @activity.user.first_name %> <%= @activity.action %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace :bushido do | ||
task :install => :environment do | ||
channel = Channel.new :name => "Lobby" | ||
if channel.save | ||
puts "Created the default channel" | ||
else | ||
puts "Error creating the default channel" | ||
end | ||
end | ||
end |