Skip to content

Commit

Permalink
Merges master and solves conflicts
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 12, 2012
2 parents e868f93 + 58a8728 commit 0ed1646
Show file tree
Hide file tree
Showing 33 changed files with 481 additions and 92 deletions.
18 changes: 10 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ source 'https://rubygems.org'

# Core gems
gem 'rails', '3.2.2'

# Database adapters
gem 'pg'
# Uncomment this is you want to use sqlite locally
# gem 'sqlite3-ruby', :require => 'sqlite3'

# Auth/Bushido gems
gem 'devise'
Expand Down Expand Up @@ -31,12 +35,10 @@ group :assets do
gem 'uglifier', '>= 1.0.3'
end

#gem 'tane', :path => "/remote/tane", :group => :development

# Test gems, obviously
group :test do
gem 'rspec-rails'
gem 'shoulda-matchers'
gem 'factory_girl_rails'
# gem 'jasmine', :git => "https://github.com/pivotal/jasmine-gem.git", :branch => "1.2.rc1", :group => [:development, :test]
end
# group :test do
# gem 'rspec-rails'
# gem 'shoulda-matchers'
# gem 'factory_girl_rails'
# gem 'jasmine', :git => "https://github.com/pivotal/jasmine-gem.git", :branch => "1.2.rc1", :group => [:development, :test]
# end
23 changes: 0 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ GEM
devise_bushido_authenticatable (1.0.3)
devise (= 1.5.3)
rubycas-client (>= 2.2.1)
diff-lcs (1.1.3)
eco (1.0.0)
coffee-script
eco-source
Expand All @@ -85,11 +84,6 @@ GEM
eventmachine (0.12.10)
execjs (1.3.0)
multi_json (~> 1.0)
factory_girl (2.6.1)
activesupport (>= 2.3.9)
factory_girl_rails (1.7.0)
factory_girl (~> 2.6.0)
railties (>= 3.0.0)
highline (1.6.11)
hike (1.2.1)
httparty (0.8.1)
Expand Down Expand Up @@ -149,27 +143,13 @@ GEM
remotipart (1.0.2)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
rspec-mocks (~> 2.8.0)
rspec-core (2.8.0)
rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.8.0)
rspec-rails (2.8.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec (~> 2.8.0)
rubycas-client (2.3.8)
activesupport
sass (3.1.15)
sass-rails (3.2.4)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
shoulda-matchers (1.0.0)
sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
Expand Down Expand Up @@ -205,15 +185,12 @@ DEPENDENCIES
devise_bushido_authenticatable
eco
execjs
factory_girl_rails
jquery-rails
kaminari
paperclip
pg
rails (= 3.2.2)
remotipart
rspec-rails
sass-rails (~> 3.2.3)
shoulda-matchers
thin
uglifier (>= 1.0.3)
185 changes: 185 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: bundle exec rails server thin -p $PORT -e $RACK_ENV
70 changes: 67 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,70 @@
Kandan
=========
Kandan - Modern Open Source Chat
================================
The slickest chat app out there. Open-source and well-supported to boot.

A Bushido chat application
![](http://github.com/Bushido/kandan/raw/master/public/preview.png)

Standard Features
=================
These are features that work out of the box on any provider:

* Easy deploy to CloudFuji, CloudFoundry, Heroku, dotCloud, etc.
* Collaborative team chat
* Unlimited channels
* Embed formats for images and youtube videos with requests for others (twitter, facebook, g+, etc.)
* Synchronized sound player - play any audio-tag compatible url for the whole channel (Pending :P)
* /me command!
* Highly extensible plugin format

CloudFuji Extended Features
===========================
In addition to the standard features above, Kandan can take advantage of CloudFuji features when run on our cloud:

* One-click deploy
* Team-aware: Setup your team once, and have them in every CloudFuji app
* Event-aware: Build widgets that display build status, customer signups, website status, and much more

SHUT UP AND LET ME USE IT
=========================

## CloudFuji
If you're part of the CloudFuji Beta you should already have access to Kandan with all the enhanced features from the app store.

Just click launch on here https://bushi.do/apps/new?app=kandan; you and your team should be all setup.

## Cloud Foundry
Looking for community help here

## Heroku
The following should work reliably on Heroku:

git clone https://github.com/Bushido/kandan.git
cd kandan
heroku create --stack cedar
git push heroku master
heroku run rake db:migrate kandan:bootstrap
heroku open


Your app should be up and running now. The admin email by default is `admin@kandan.me` with password `kandanadmin`, or you can sign up as another user.

## dotCloud
Looking for community help here.

TODO
====
See the issue tracker

Get Involved!
=============
That's not a question, it's an order! Or more of a friendly offer, really. Kandan is a fully open-source app, so dive in and start adding features, fixing bugs (what bugs?), and cleaning up the code.

* Talk with us on the [mailing list])(https://groups.google.com/forum/?fromgroups#!forum/cloudfuji)
* GitHub [issues tracker](https://github.com/Bushido/Kandan/issues)
* Twitter [@cloudfuji](https://twitter.com/#!/cloudfuji)
* [New-wave open-source meetup](www.meetup.com/San-Francisco-New-Wave-Open-Source-Apps/) - we meetup once a month to share tips on how developers grow business around super high-quality open source software
* ... is there a fifth way? Telegram maybe?

LICENSE
=======
Kandan's code and assets are dual-licensed. Kanda is available generally under the AGPL, and also under a custom license via special agreement. See LICENSE for the AGPL terms, and contact us at [support@cloudfuji.com](mailto:support@cloudfuji.com) if you're interested in development of Kandan under a custom license.
10 changes: 8 additions & 2 deletions app/assets/javascripts/backbone/helpers/utils.js.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
class Kandan.Helpers.Utils
@unreadActivities = 0

@browserTabFocused: true

@notifyInTitleIfRequired: ->
$(document).attr('title', '(new) Kandan') if @browserTabFocused != true
if @browserTabFocused != true
@unreadActivities += 1
$(document).attr('title', "(#{@unreadActivities}) Kandan")

@months: [
"January"
Expand All @@ -20,7 +23,10 @@ class Kandan.Helpers.Utils
,"December"
]

@timeToString: (time) ->
@resetUnreadActivities: () ->
@unreadActivities = 0

@time_to_string: (time) ->
return time if (typeof time != "object")
am = time.getHours() < 12
hours = time.getHours()
Expand Down
8 changes: 6 additions & 2 deletions app/assets/javascripts/backbone/kandan.js.coffee.erb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ window.Kandan =

$(window).focus(->
Kandan.Helpers.Utils.browserTabFocused = true
Kandan.Helpers.Utils.resetUnreadActivities()
$(document).attr('title', 'Kandan')
)

Expand All @@ -70,6 +71,7 @@ window.Kandan =
add: (event, ui) ->
$('.header .ui-tabs-panel:last').detach().appendTo('#channels')
$('#kandan').tabs('option', 'disabled', [])
$('.header ul a').delegate('cite.close_channel', 'click', window.tabViewGlobal.deleteChannel)
})

$("#kandan").tabs 'option', 'tabTemplate', '''
Expand All @@ -87,7 +89,7 @@ window.Kandan =

initChatArea: (channels)->
chatArea = new Kandan.Views.ChatArea({channels: channels})
$(".main-area").html(chatArea.render().el)
$(".main-area").append(chatArea.render().el)
$(document).scrollTop($(document).height()+9000)


Expand All @@ -106,9 +108,11 @@ window.Kandan =
setCurrentUser: ()->
template = JST['current_user']
currentUser = Kandan.Helpers.Users.currentUser()
displayName = "#{currentUser.first_name} #{currentUser.last_name}" if currentUser.first_name?
displayName ||= currentUser.email
$(".header .user").html template({
gravatarHash: currentUser.gravatar_hash,
name: "#{currentUser.first_name} #{currentUser.last_name}"
name: displayName
})

registerUtilityEvents: ()->
Expand Down
25 changes: 16 additions & 9 deletions app/assets/javascripts/backbone/plugins/image_embed.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,26 @@ class Kandan.Plugins.ImageEmbed

template: _.template '''
<div class="image-preview">
<a target="_blank" href="<%= imageUrl %>">
<img class="image-embed" src="<%= imageUrl %>" height="200" width="200" />
<a target="_blank" href="<%= image_url %>">
<img class="image-embed" src="<%= image_url %>" height="200" width="200" />
</a>
<div class="name"><%= name %></div>
<div class="name"><%= subtitle %></div>
</div>
'''
'''


@init: ()->
Kandan.Modifiers.register @options.regex, (message, state)=>
fileName = message.content.split("/").pop()
Kandan.Modifiers.register @options.regex, (message, state) =>
url = message.content.match(@options.regex)[0]
fileName = url.split("/").pop()
comment = $.trim(message.content.split(url).join(""))
subtitle = null
subtitle = comment if comment.length > 0
subtitle ||= fileName

message.content = @options.template({
imageUrl: message.content,
name: fileName
imageUrl: url,
subtitle: subtitle
})
return Kandan.Helpers.Activities.buildFromMessageTemplate(message)

return Kandan.Helpers.Activities.buildFromMessageTemplate(message)
4 changes: 3 additions & 1 deletion app/assets/javascripts/backbone/plugins/link_embed.js.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
class Kandan.Plugins.LinkEmbed

@options:
regex: /(http?:\S*)/g


@init: ()->
Kandan.Modifiers.register @options.regex, (message, state)=>
message.content = message.content
.replace(@options.regex, '<a target="_blank" href="$1">$1</a>')
return Kandan.Helpers.Activities.buildFromMessageTemplate(message)
return Kandan.Helpers.Activities.buildFromMessageTemplate(message)
9 changes: 4 additions & 5 deletions app/assets/javascripts/backbone/plugins/me_announce.js.coffee
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
class Kandan.Plugins.MeAnnounce

@options:
regex: /^\/me /
regex: /^&#x2F;me /

@init: ()->
Kandan.Modifiers.register @options.regex, (message, state)=>
message.content = message.content.replace @options.regex, "#{message.user.first_name} "
Kandan.Modifiers.register @options.regex, (message, state) =>
actor = message.user.first_name || message.user.email
message.content = message.content.replace @options.regex, "#{actor} "
return Kandan.Helpers.Activities.buildFromBaseTemplate(message)

# Kandan.Plugins.register "Kandan.Plugins.MeAnnounce"
6 changes: 5 additions & 1 deletion app/assets/javascripts/backbone/plugins/user_list.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ class Kandan.Plugins.UserList
$el.next().hide();

for user in Kandan.Data.ActiveUsers.all()
displayName = null
displayName = "#{user.first_name} #{user.last_name}" if user.first_name?
displayName ||= user.email # Default to user email address if that's all we have

$users.append @template({
name: "#{user.first_name} #{user.last_name}",
name: displayName,
gravatarHash: user.gravatar_hash
})
$el.html($users)
Expand Down
32 changes: 25 additions & 7 deletions app/assets/javascripts/backbone/plugins/youtube_embed.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,36 @@ class Kandan.Plugins.YouTubeEmbed

template: _.template '''
<div class="youtube-preview">
<a target="_blank" class="youtube-preview-link" href="<%= videoUrl %>">
<img class="youtube-preview-image" src="<%= thumbUrl %>" />
<a target="_blank" class="youtube-preview-link" href="<%= video_url %>">
<img class="youtube-preview-image" src="<%= thumb_url %>" />
</a>
<div class="name"><%= subtitle %></div>
</div>
'''


@init: ()->
Kandan.Modifiers.register @options.regex, (message, state)=>
Kandan.Modifiers.register @options.regex, (message, state) =>
comment = null

# No spaces in message content indicates just a link
if message.content.indexOf(" ") == -1
videoUrl = message.content
else
# Spaces indicate a subtitle
comment = $.trim(message.content.substr(message.content.indexOf(" ") + 1));
videoUrl = message.content.split(" ")[0]

videoId = message.content.match(@options.idRegex)[1]
thumbUrl = "http://img.youtube.com/vi/#{ videoId }/0.jpg"
thumbUrl = "http://img.youtube.com/vi/#{ video_id }/0.jpg"

subtitle = null
subtitle = "Youtube: #{comment}" if comment? and comment.length > 0
subtitle ||= videoUrl

message.content = @options.template({
videoUrl: message.content,
thumbUrl: thumbUrl
videoUrl: videoUrl,
thumbUrl: thumbUrl,
subtitle: subtitle
})
return Kandan.Helpers.Activities.buildFromMessageTemplate(message)
return Kandan.Helpers.Activities.buildFromMessageTemplate(message)
20 changes: 19 additions & 1 deletion app/assets/javascripts/backbone/views/channel_tabs.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,25 @@ class Kandan.Views.ChannelTabs extends Backbone.View
@

createChannel: (event)->
channelName = prompt("What's the channel name?", "New channel")
names = [
"A Dark Place",
"Discotheque",
"Dungeon",
"Garden",
"Lobby",
"Office",
"Palace",
"Park",
"Studio",
"Temple",
"War Room",
"Zork"]

# Inefficient random method but there are only a few names so it's
# not an issue
name = _.shuffle(names)[0]

channelName = prompt("What's the channel name?", name)
channelName = channelName.replace(/^\s+|\s+$/g, '')
if channelName
channel = new Kandan.Models.Channel({name: channelName})
Expand Down
Loading

0 comments on commit 0ed1646

Please sign in to comment.