Skip to content

Commit

Permalink
Merge pull request #2 from Bushido/heroku
Browse files Browse the repository at this point in the history
Heroku
  • Loading branch information
kevzettler committed Apr 12, 2012
2 parents b324222 + bd01552 commit 89dc69c
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 46 deletions.
14 changes: 7 additions & 7 deletions Gemfile
Expand Up @@ -31,12 +31,12 @@ group :assets do
gem 'uglifier', '>= 1.0.3'
end

#gem 'tane', :path => "/remote/tane", :group => :development
# 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
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)
8 changes: 7 additions & 1 deletion app/assets/javascripts/backbone/helpers/utils.js.coffee
@@ -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,6 +23,9 @@ class Kandan.Helpers.Utils
,"December"
]

@resetUnreadActivities: () ->
@unreadActivities = 0

@time_to_string: (time) ->
return time if (typeof time != "object")
am = time.getHours() < 12
Expand Down
5 changes: 4 additions & 1 deletion app/assets/javascripts/backbone/kandan.js.coffee
Expand Up @@ -41,6 +41,7 @@ window.Kandan =

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

Expand Down Expand Up @@ -102,9 +103,11 @@ window.Kandan =
<img src="http://gravatar.com/avatar/<%= gravatar_hash %>?s=25&d=http://bushi.do/images/profile.png"/><span><%= name %></span>
'''
currentUser = Kandan.Helpers.Users.currentUser()
displayName = "#{currentUser.first_name} #{currentUser.last_name}" if currentUser.first_name?
displayName ||= currentUser.email
$(".header .user").html template({
gravatar_hash: currentUser.gravatar_hash,
name: "#{currentUser.first_name} #{currentUser.last_name}"
name: displayName
})

init: ->
Expand Down
6 changes: 5 additions & 1 deletion app/assets/javascripts/backbone/plugins/user_list.js.coffee
Expand Up @@ -17,8 +17,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,
gravatar_hash: user.gravatar_hash
})
$el.html($users)
Expand Down
2 changes: 1 addition & 1 deletion app/assets/templates/message.jst.eco
Expand Up @@ -3,7 +3,7 @@

<div class="readable">
<span class="user">
<%= @activity.user.first_name %>
<%= @activity.user.first_name || @activity.user.email %>
</span>

<span class="content">
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Expand Up @@ -4,13 +4,13 @@ class User < ActiveRecord::Base
before_save :ensure_authentication_token
before_save :ensure_gravatar_hash


# Kandan.devise_modules is defined in config/initializers/kandan.rb
devise devise *Kandan.devise_modules

# Setup accessible (or protected) attributes for your model
attr_accessible :id, :email, :password, :password_confirmation, :remember_me, :first_name, :last_name, :locale, :gravatar_hash


def bushido_extra_attributes(extra_attributes)
self.first_name = extra_attributes["first_name"].to_s
self.last_name = extra_attributes["last_name"].to_s
Expand Down
9 changes: 5 additions & 4 deletions app/views/layouts/application.html.erb
Expand Up @@ -14,10 +14,11 @@
<%= javascript_tag do %>
<%- if user_signed_in? %>
<%- current_user_data = {
:id => current_user.id,
:first_name => current_user.first_name,
:last_name => current_user.last_name,
:auth_token => current_user.authentication_token,
:id => current_user.id,
:first_name => current_user.first_name,
:last_name => current_user.last_name,
:email => current_user.email,
:auth_token => current_user.authentication_token,
:gravatar_hash => current_user.gravatar_hash
}
%>
Expand Down
2 changes: 1 addition & 1 deletion app/views/main/index.html.erb
Expand Up @@ -17,7 +17,7 @@

<div class="search">
<form method="get" action="/search" target="_blank">
<input type="text" class="query" name="query"/>
<input type="text" class="query" name="query"/>
</form>
</div>
</div>
Expand Down
7 changes: 7 additions & 0 deletions config/application.rb
Expand Up @@ -15,12 +15,19 @@
# Bundler.require(:default, :assets, Rails.env)
end

require "./lib/kandan_config.rb"

module Kandan
class Application < Rails::Application
# Dealing with Heroku-specific eccentricities
config.assets.initialize_on_precompile = false

# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.

config.assets.initialize_on_precompile = false

# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)

Expand Down
13 changes: 7 additions & 6 deletions config/initializers/kandan.rb
@@ -1,15 +1,16 @@
require "#{Rails.root}/lib/kandan_config.rb"

Dir["#{Rails.root}/lib/broadcasters/**/*.rb"].each do |file|
require file
end


module Kandan
def self.devise_modules
standard = [:database_authenticatable, :registerable, :confirmable,
:recoverable, :rememberable, :trackable, :validatable, :token_authenticatable]
bushido = [:bushido_authenticatable, :trackable, :token_authenticatable]

standard = [:database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:token_authenticatable]

bushido = [:bushido_authenticatable, :trackable,
:token_authenticatable]

::Bushido::Platform.on_bushido? ? bushido : standard
end
Expand Down
Empty file removed vendor/plugins/.gitkeep
Empty file.

0 comments on commit 89dc69c

Please sign in to comment.