diff --git a/Gemfile b/Gemfile index e722017f..bfb220c6 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock index 039742b0..2d6c32d4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 @@ -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) @@ -149,19 +143,6 @@ 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) @@ -169,7 +150,6 @@ GEM 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) @@ -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) diff --git a/app/assets/javascripts/backbone/helpers/utils.js.coffee b/app/assets/javascripts/backbone/helpers/utils.js.coffee index d560937c..1107a58b 100644 --- a/app/assets/javascripts/backbone/helpers/utils.js.coffee +++ b/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" @@ -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 diff --git a/app/assets/javascripts/backbone/kandan.js.coffee b/app/assets/javascripts/backbone/kandan.js.coffee index 77f9f68c..8261604c 100644 --- a/app/assets/javascripts/backbone/kandan.js.coffee +++ b/app/assets/javascripts/backbone/kandan.js.coffee @@ -41,6 +41,7 @@ window.Kandan = $(window).focus(-> Kandan.Helpers.Utils.browserTabFocused = true + Kandan.Helpers.Utils.resetUnreadActivities() $(document).attr('title', 'Kandan') ) @@ -102,9 +103,11 @@ window.Kandan = <%= name %> ''' 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: -> diff --git a/app/assets/javascripts/backbone/plugins/user_list.js.coffee b/app/assets/javascripts/backbone/plugins/user_list.js.coffee index 28b30885..dd0e97e1 100644 --- a/app/assets/javascripts/backbone/plugins/user_list.js.coffee +++ b/app/assets/javascripts/backbone/plugins/user_list.js.coffee @@ -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) diff --git a/app/assets/templates/message.jst.eco b/app/assets/templates/message.jst.eco index 90afff46..5cb22f3a 100644 --- a/app/assets/templates/message.jst.eco +++ b/app/assets/templates/message.jst.eco @@ -3,7 +3,7 @@
- <%= @activity.user.first_name %> + <%= @activity.user.first_name || @activity.user.email %> diff --git a/app/models/user.rb b/app/models/user.rb index 512c5792..8d94371b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index f70a5c6b..9d4e970e 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -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 } %> diff --git a/app/views/main/index.html.erb b/app/views/main/index.html.erb index 8eac150e..05232065 100644 --- a/app/views/main/index.html.erb +++ b/app/views/main/index.html.erb @@ -17,7 +17,7 @@
diff --git a/config/application.rb b/config/application.rb index a8f0234c..144d6cf5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -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) diff --git a/config/initializers/kandan.rb b/config/initializers/kandan.rb index ba8d0cf5..bf303357 100644 --- a/config/initializers/kandan.rb +++ b/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 diff --git a/vendor/plugins/.gitkeep b/vendor/plugins/.gitkeep deleted file mode 100644 index e69de29b..00000000