Skip to content

Commit 0ed1646

Browse files
committed
Merges master and solves conflicts
Signed-off-by: Akash Manohar J <akash@akash.im>
2 parents e868f93 + 58a8728 commit 0ed1646

33 files changed

+481
-92
lines changed

Gemfile

+10-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ source 'https://rubygems.org'
22

33
# Core gems
44
gem 'rails', '3.2.2'
5+
6+
# Database adapters
57
gem 'pg'
8+
# Uncomment this is you want to use sqlite locally
9+
# gem 'sqlite3-ruby', :require => 'sqlite3'
610

711
# Auth/Bushido gems
812
gem 'devise'
@@ -31,12 +35,10 @@ group :assets do
3135
gem 'uglifier', '>= 1.0.3'
3236
end
3337

34-
#gem 'tane', :path => "/remote/tane", :group => :development
35-
3638
# Test gems, obviously
37-
group :test do
38-
gem 'rspec-rails'
39-
gem 'shoulda-matchers'
40-
gem 'factory_girl_rails'
41-
# gem 'jasmine', :git => "https://github.com/pivotal/jasmine-gem.git", :branch => "1.2.rc1", :group => [:development, :test]
42-
end
39+
# group :test do
40+
# gem 'rspec-rails'
41+
# gem 'shoulda-matchers'
42+
# gem 'factory_girl_rails'
43+
# gem 'jasmine', :git => "https://github.com/pivotal/jasmine-gem.git", :branch => "1.2.rc1", :group => [:development, :test]
44+
# end

Gemfile.lock

-23
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ GEM
7070
devise_bushido_authenticatable (1.0.3)
7171
devise (= 1.5.3)
7272
rubycas-client (>= 2.2.1)
73-
diff-lcs (1.1.3)
7473
eco (1.0.0)
7574
coffee-script
7675
eco-source
@@ -85,11 +84,6 @@ GEM
8584
eventmachine (0.12.10)
8685
execjs (1.3.0)
8786
multi_json (~> 1.0)
88-
factory_girl (2.6.1)
89-
activesupport (>= 2.3.9)
90-
factory_girl_rails (1.7.0)
91-
factory_girl (~> 2.6.0)
92-
railties (>= 3.0.0)
9387
highline (1.6.11)
9488
hike (1.2.1)
9589
httparty (0.8.1)
@@ -149,27 +143,13 @@ GEM
149143
remotipart (1.0.2)
150144
rest-client (1.6.7)
151145
mime-types (>= 1.16)
152-
rspec (2.8.0)
153-
rspec-core (~> 2.8.0)
154-
rspec-expectations (~> 2.8.0)
155-
rspec-mocks (~> 2.8.0)
156-
rspec-core (2.8.0)
157-
rspec-expectations (2.8.0)
158-
diff-lcs (~> 1.1.2)
159-
rspec-mocks (2.8.0)
160-
rspec-rails (2.8.1)
161-
actionpack (>= 3.0)
162-
activesupport (>= 3.0)
163-
railties (>= 3.0)
164-
rspec (~> 2.8.0)
165146
rubycas-client (2.3.8)
166147
activesupport
167148
sass (3.1.15)
168149
sass-rails (3.2.4)
169150
railties (~> 3.2.0)
170151
sass (>= 3.1.10)
171152
tilt (~> 1.3)
172-
shoulda-matchers (1.0.0)
173153
sprockets (2.1.2)
174154
hike (~> 1.2)
175155
rack (~> 1.0)
@@ -205,15 +185,12 @@ DEPENDENCIES
205185
devise_bushido_authenticatable
206186
eco
207187
execjs
208-
factory_girl_rails
209188
jquery-rails
210189
kaminari
211190
paperclip
212191
pg
213192
rails (= 3.2.2)
214193
remotipart
215-
rspec-rails
216194
sass-rails (~> 3.2.3)
217-
shoulda-matchers
218195
thin
219196
uglifier (>= 1.0.3)

LICENSE

+185
Large diffs are not rendered by default.

Procfile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: bundle exec rails server thin -p $PORT -e $RACK_ENV

README.md

+67-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,70 @@
1-
Kandan
2-
=========
1+
Kandan - Modern Open Source Chat
2+
================================
3+
The slickest chat app out there. Open-source and well-supported to boot.
34

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

7+
Standard Features
8+
=================
9+
These are features that work out of the box on any provider:
610

11+
* Easy deploy to CloudFuji, CloudFoundry, Heroku, dotCloud, etc.
12+
* Collaborative team chat
13+
* Unlimited channels
14+
* Embed formats for images and youtube videos with requests for others (twitter, facebook, g+, etc.)
15+
* Synchronized sound player - play any audio-tag compatible url for the whole channel (Pending :P)
16+
* /me command!
17+
* Highly extensible plugin format
18+
19+
CloudFuji Extended Features
20+
===========================
21+
In addition to the standard features above, Kandan can take advantage of CloudFuji features when run on our cloud:
22+
23+
* One-click deploy
24+
* Team-aware: Setup your team once, and have them in every CloudFuji app
25+
* Event-aware: Build widgets that display build status, customer signups, website status, and much more
26+
27+
SHUT UP AND LET ME USE IT
28+
=========================
29+
30+
## CloudFuji
31+
If you're part of the CloudFuji Beta you should already have access to Kandan with all the enhanced features from the app store.
32+
33+
Just click launch on here https://bushi.do/apps/new?app=kandan; you and your team should be all setup.
34+
35+
## Cloud Foundry
36+
Looking for community help here
37+
38+
## Heroku
39+
The following should work reliably on Heroku:
40+
41+
git clone https://github.com/Bushido/kandan.git
42+
cd kandan
43+
heroku create --stack cedar
44+
git push heroku master
45+
heroku run rake db:migrate kandan:bootstrap
46+
heroku open
47+
48+
49+
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.
50+
51+
## dotCloud
52+
Looking for community help here.
53+
54+
TODO
55+
====
56+
See the issue tracker
57+
58+
Get Involved!
59+
=============
60+
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.
61+
62+
* Talk with us on the [mailing list])(https://groups.google.com/forum/?fromgroups#!forum/cloudfuji)
63+
* GitHub [issues tracker](https://github.com/Bushido/Kandan/issues)
64+
* Twitter [@cloudfuji](https://twitter.com/#!/cloudfuji)
65+
* [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
66+
* ... is there a fifth way? Telegram maybe?
67+
68+
LICENSE
69+
=======
70+
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.

app/assets/javascripts/backbone/helpers/utils.js.coffee

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
class Kandan.Helpers.Utils
2+
@unreadActivities = 0
23

34
@browserTabFocused: true
45

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

811
@months: [
912
"January"
@@ -20,7 +23,10 @@ class Kandan.Helpers.Utils
2023
,"December"
2124
]
2225

23-
@timeToString: (time) ->
26+
@resetUnreadActivities: () ->
27+
@unreadActivities = 0
28+
29+
@time_to_string: (time) ->
2430
return time if (typeof time != "object")
2531
am = time.getHours() < 12
2632
hours = time.getHours()

app/assets/javascripts/backbone/kandan.js.coffee.erb

+6-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ window.Kandan =
4848

4949
$(window).focus(->
5050
Kandan.Helpers.Utils.browserTabFocused = true
51+
Kandan.Helpers.Utils.resetUnreadActivities()
5152
$(document).attr('title', 'Kandan')
5253
)
5354

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

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

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

9395

@@ -106,9 +108,11 @@ window.Kandan =
106108
setCurrentUser: ()->
107109
template = JST['current_user']
108110
currentUser = Kandan.Helpers.Users.currentUser()
111+
displayName = "#{currentUser.first_name} #{currentUser.last_name}" if currentUser.first_name?
112+
displayName ||= currentUser.email
109113
$(".header .user").html template({
110114
gravatarHash: currentUser.gravatar_hash,
111-
name: "#{currentUser.first_name} #{currentUser.last_name}"
115+
name: displayName
112116
})
113117

114118
registerUtilityEvents: ()->

app/assets/javascripts/backbone/plugins/image_embed.js.coffee

+16-9
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,26 @@ class Kandan.Plugins.ImageEmbed
44

55
template: _.template '''
66
<div class="image-preview">
7-
<a target="_blank" href="<%= imageUrl %>">
8-
<img class="image-embed" src="<%= imageUrl %>" height="200" width="200" />
7+
<a target="_blank" href="<%= image_url %>">
8+
<img class="image-embed" src="<%= image_url %>" height="200" width="200" />
99
</a>
10-
<div class="name"><%= name %></div>
10+
<div class="name"><%= subtitle %></div>
1111
</div>
12-
'''
12+
'''
1313

1414

1515
@init: ()->
16-
Kandan.Modifiers.register @options.regex, (message, state)=>
17-
fileName = message.content.split("/").pop()
16+
Kandan.Modifiers.register @options.regex, (message, state) =>
17+
url = message.content.match(@options.regex)[0]
18+
fileName = url.split("/").pop()
19+
comment = $.trim(message.content.split(url).join(""))
20+
subtitle = null
21+
subtitle = comment if comment.length > 0
22+
subtitle ||= fileName
23+
1824
message.content = @options.template({
19-
imageUrl: message.content,
20-
name: fileName
25+
imageUrl: url,
26+
subtitle: subtitle
2127
})
22-
return Kandan.Helpers.Activities.buildFromMessageTemplate(message)
28+
29+
return Kandan.Helpers.Activities.buildFromMessageTemplate(message)
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
class Kandan.Plugins.LinkEmbed
2+
23
@options:
34
regex: /(http?:\S*)/g
45

6+
57
@init: ()->
68
Kandan.Modifiers.register @options.regex, (message, state)=>
79
message.content = message.content
810
.replace(@options.regex, '<a target="_blank" href="$1">$1</a>')
9-
return Kandan.Helpers.Activities.buildFromMessageTemplate(message)
11+
return Kandan.Helpers.Activities.buildFromMessageTemplate(message)
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
class Kandan.Plugins.MeAnnounce
22

33
@options:
4-
regex: /^\/me /
4+
regex: /^&#x2F;me /
55

66
@init: ()->
7-
Kandan.Modifiers.register @options.regex, (message, state)=>
8-
message.content = message.content.replace @options.regex, "#{message.user.first_name} "
7+
Kandan.Modifiers.register @options.regex, (message, state) =>
8+
actor = message.user.first_name || message.user.email
9+
message.content = message.content.replace @options.regex, "#{actor} "
910
return Kandan.Helpers.Activities.buildFromBaseTemplate(message)
10-
11-
# Kandan.Plugins.register "Kandan.Plugins.MeAnnounce"

app/assets/javascripts/backbone/plugins/user_list.js.coffee

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ class Kandan.Plugins.UserList
1616
$el.next().hide();
1717

1818
for user in Kandan.Data.ActiveUsers.all()
19+
displayName = null
20+
displayName = "#{user.first_name} #{user.last_name}" if user.first_name?
21+
displayName ||= user.email # Default to user email address if that's all we have
22+
1923
$users.append @template({
20-
name: "#{user.first_name} #{user.last_name}",
24+
name: displayName,
2125
gravatarHash: user.gravatar_hash
2226
})
2327
$el.html($users)

app/assets/javascripts/backbone/plugins/youtube_embed.js.coffee

+25-7
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,36 @@ class Kandan.Plugins.YouTubeEmbed
66

77
template: _.template '''
88
<div class="youtube-preview">
9-
<a target="_blank" class="youtube-preview-link" href="<%= videoUrl %>">
10-
<img class="youtube-preview-image" src="<%= thumbUrl %>" />
9+
<a target="_blank" class="youtube-preview-link" href="<%= video_url %>">
10+
<img class="youtube-preview-image" src="<%= thumb_url %>" />
1111
</a>
12+
<div class="name"><%= subtitle %></div>
1213
</div>
1314
'''
1415

16+
1517
@init: ()->
16-
Kandan.Modifiers.register @options.regex, (message, state)=>
18+
Kandan.Modifiers.register @options.regex, (message, state) =>
19+
comment = null
20+
21+
# No spaces in message content indicates just a link
22+
if message.content.indexOf(" ") == -1
23+
videoUrl = message.content
24+
else
25+
# Spaces indicate a subtitle
26+
comment = $.trim(message.content.substr(message.content.indexOf(" ") + 1));
27+
videoUrl = message.content.split(" ")[0]
28+
1729
videoId = message.content.match(@options.idRegex)[1]
18-
thumbUrl = "http://img.youtube.com/vi/#{ videoId }/0.jpg"
30+
thumbUrl = "http://img.youtube.com/vi/#{ video_id }/0.jpg"
31+
32+
subtitle = null
33+
subtitle = "Youtube: #{comment}" if comment? and comment.length > 0
34+
subtitle ||= videoUrl
35+
1936
message.content = @options.template({
20-
videoUrl: message.content,
21-
thumbUrl: thumbUrl
37+
videoUrl: videoUrl,
38+
thumbUrl: thumbUrl,
39+
subtitle: subtitle
2240
})
23-
return Kandan.Helpers.Activities.buildFromMessageTemplate(message)
41+
return Kandan.Helpers.Activities.buildFromMessageTemplate(message)

app/assets/javascripts/backbone/views/channel_tabs.js.coffee

+19-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,25 @@ class Kandan.Views.ChannelTabs extends Backbone.View
77
@
88

99
createChannel: (event)->
10-
channelName = prompt("What's the channel name?", "New channel")
10+
names = [
11+
"A Dark Place",
12+
"Discotheque",
13+
"Dungeon",
14+
"Garden",
15+
"Lobby",
16+
"Office",
17+
"Palace",
18+
"Park",
19+
"Studio",
20+
"Temple",
21+
"War Room",
22+
"Zork"]
23+
24+
# Inefficient random method but there are only a few names so it's
25+
# not an issue
26+
name = _.shuffle(names)[0]
27+
28+
channelName = prompt("What's the channel name?", name)
1129
channelName = channelName.replace(/^\s+|\s+$/g, '')
1230
if channelName
1331
channel = new Kandan.Models.Channel({name: channelName})

0 commit comments

Comments
 (0)