Permalink
Browse files

Merge branch 'master' of https://github.com/hotsh/rstat.us

  • Loading branch information...
seejee committed Feb 12, 2012
2 parents 03ddce6 + e5a2ee7 commit df820729e9cf84604990f4e4745182ed475b80e0
Showing with 357 additions and 719 deletions.
  1. +1 −3 Gemfile
  2. +3 −6 Gemfile.lock
  3. +0 −5 app/assets/javascripts/app.js
  4. +2 −0 app/assets/javascripts/app.js.coffee
  5. +0 −9 app/assets/javascripts/application.js
  6. +3 −0 app/assets/javascripts/application.js.coffee
  7. +0 −5 app/assets/javascripts/home.js
  8. +2 −0 app/assets/javascripts/home.js.coffee
  9. +0 −16 app/assets/javascripts/jquery-1.5.2.min.js
  10. +13 −10 app/assets/javascripts/{main.js.coffee → main.js.coffee.erb}
  11. +0 −3 app/assets/javascripts/sessions.js.coffee
  12. +0 −78 app/assets/javascripts/update.js
  13. +67 −0 app/assets/javascripts/update.js.coffee
  14. +0 −7 app/assets/javascripts/users.js
  15. +6 −2 app/controllers/sessions_controller.rb
  16. +10 −11 app/controllers/users_controller.rb
  17. +13 −9 app/models/author.rb
  18. +5 −1 app/models/update.rb
  19. +8 −6 app/models/user.rb
  20. +1 −1 app/views/searches/show.html.haml
  21. +1 −1 app/views/updates/_detail.haml
  22. +2 −2 app/views/updates/_list.html.haml
  23. +1 −1 app/views/users/_list.haml
  24. +3 −13 app/views/users/index.haml
  25. +1 −1 config/initializers/session_store.rb
  26. +3 −1 config/locales/en.yml
  27. +1 −1 docs/index.html
  28. +19 −0 public/assets/application-0514eb022a483620e788603c852a5353.js
  29. BIN public/assets/application-0514eb022a483620e788603c852a5353.js.gz
  30. +0 −1 public/assets/application-42cbff42ceedbb1f5bd68c4ac59ec14b.css
  31. BIN public/assets/application-42cbff42ceedbb1f5bd68c4ac59ec14b.css.gz
  32. +0 −1 public/assets/application-48963d5ec8a8ffcb984f1d9bb93a8002.css
  33. BIN public/assets/application-48963d5ec8a8ffcb984f1d9bb93a8002.css.gz
  34. +0 −18 public/assets/application-61575177024fc17e65e05f2e49f30367.js
  35. BIN public/assets/application-61575177024fc17e65e05f2e49f30367.js.gz
  36. +19 −0 public/assets/application-67add468a37fa4a5a3d6d3b746a7a1c1.js
  37. BIN public/assets/application-67add468a37fa4a5a3d6d3b746a7a1c1.js.gz
  38. +0 −18 public/assets/application-bc4a915e7a801aafb098aabe08c199dd.js
  39. BIN public/assets/application-bc4a915e7a801aafb098aabe08c199dd.js.gz
  40. +0 −1 public/assets/application-bd76633c4728115ac15e82fa8027902c.css
  41. BIN public/assets/application-bd76633c4728115ac15e82fa8027902c.css.gz
  42. BIN public/assets/application-c80dad3d3015f2e4690caf5022f4ec82.css.gz
  43. +0 −18 public/assets/jquery-1-eb0df96db50ee68e8c7ee60545f4d6c9.5.2.min.js
  44. BIN public/assets/jquery-1-eb0df96db50ee68e8c7ee60545f4d6c9.5.2.min.js.gz
  45. BIN public/assets/jquery-7b90fc893c29119e4f1ee0a0fcfff9e3.min.js.gz
  46. BIN public/assets/jquery-cb102f78b7a38730cfb9af1b66582215.pjax.js.gz
  47. BIN public/assets/jquery-f482874aaf13ed086b4d8daf33022cf5.equalHeights.js.gz
  48. BIN public/assets/jquery-ui-f31894c40bd99050d19adc375e6e6cb5.min.js.gz
  49. +1 −2 public/assets/manifest.yml
  50. +0 −1 public/assets/updates-4659de9dacd869da855de2d725338ec4.show.js
  51. BIN public/assets/updates-4659de9dacd869da855de2d725338ec4.show.js.gz
  52. +22 −1 test/acceptance/acceptance_helper.rb
  53. +46 −24 test/acceptance/auth_test.rb
  54. +2 −4 test/acceptance/basic_access_test.rb
  55. +3 −3 test/acceptance/email_change_test.rb
  56. +27 −54 test/acceptance/following_test.rb
  57. +6 −6 test/acceptance/password_reset_test.rb
  58. +3 −7 test/acceptance/profile_test.rb
  59. +7 −11 test/acceptance/reply_test.rb
  60. +1 −2 test/acceptance/search_test.rb
  61. +42 −109 test/acceptance/update_test.rb
  62. +0 −172 test/acceptance/user_browse_test.rb
  63. +2 −69 test/models/author_test.rb
  64. +10 −3 test/models/user_test.rb
  65. +1 −2 test/test_helper.rb
View
@@ -17,13 +17,11 @@ gem 'jquery-rails'
gem 'unicorn'
gem 'omniauth', :git => 'git://github.com/intridea/omniauth.git'
-gem "sinatra", :require => "sinatra/base"
gem "mongo_mapper"
gem "bson_ext"
gem "i18n"
gem "twitter"
gem "pony"
-gem "bcrypt-ruby", :require => "bcrypt"
gem "rdiscount"
gem "ostatus", "~>0.0.9"
gem "osub", "~>0.0.6"
@@ -41,10 +39,10 @@ gem "delayed_job_mongo_mapper", :git => "git://github.com/earbits/delayed_job_mo
gem "whenever"
group :development, :test do
- gem 'rack-test'
gem "database_cleaner"
gem "fabrication"
gem "capybara"
+ gem "show_me_the_cookies"
gem "rocco", :git => "git://github.com/rtomayko/rocco.git"
gem "pygmentize"
gem "mocha"
View
@@ -255,13 +255,12 @@ GEM
ffi (>= 1.0.7)
json_pure
rubyzip
+ show_me_the_cookies (1.1.0)
+ capybara (~> 1.0)
simple_oauth (0.1.5)
simplecov (0.4.2)
simplecov-html (~> 0.4.4)
simplecov-html (0.4.5)
- sinatra (1.2.6)
- rack (~> 1.1)
- tilt (>= 1.2.2, < 2.0)
sprockets (2.0.0)
hike (~> 1.2)
rack (~> 1.0)
@@ -300,7 +299,6 @@ PLATFORMS
ruby
DEPENDENCIES
- bcrypt-ruby
bson_ext
capybara
coffee-rails (~> 3.1.0)
@@ -324,15 +322,14 @@ DEPENDENCIES
osub (~> 0.0.6)
pony
pygmentize
- rack-test
rails (= 3.1.0)
rdiscount
redfinger
rocco!
rsa
sass-rails (~> 3.1.0)
+ show_me_the_cookies
simplecov (~> 0.4.0)
- sinatra
twitter
tzinfo
uglifier
@@ -1,5 +0,0 @@
-(function() {
- $(document).ready(function() {
- return $("#flash").delay(2000).slideUp('slow');
- });
-}).call(this);
@@ -0,0 +1,2 @@
+jQuery $ ->
+ $("#flash").delay(2000).slideUp('slow')
@@ -1,9 +0,0 @@
-// This is a manifest file that'll be compiled into including all the files listed below.
-// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
-// be included in the compiled file accessible from http://example.com/assets/application.js
-// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
-// the compiled file.
-//
-//= require "./jquery-1.5.2.min.js"
-//= require_tree .
-
@@ -0,0 +1,3 @@
+#= require jquery
+#= require jquery_ujs
+#= require_tree .
@@ -1,5 +0,0 @@
-(function() {
- $(document).ready(function() {
- return $("#pitch").equalHeights();
- });
-}).call(this);
@@ -0,0 +1,2 @@
+jQuery $ ->
+ $("#pitch").equalHeights()

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1,13 +1,16 @@
MAX_LENGTH = 140
-$(document).ready ->
+jQuery $ ->
# Turn on JS styles
$("html").removeClass("no-js").addClass("js")
# Hide flash messages
$("#flash").delay(2000).slideUp('slow')
+ $("img").error ->
+ $(this).attr("src", "<%= asset_path Author::DEFAULT_AVATAR %>")
+
#########################################
# Updates
#########################################
@@ -20,11 +23,15 @@ $(document).ready ->
$('.pagination a').pjax('#content')
- $("#content").bind("start.pjax", pjaxStart = ->
- loading = $("<div class='loading' />")
- $("#content").append(loading)
- window.scrollTo(0,0)
- )
+ $("#content")
+ .bind("start.pjax", pjaxStart = ->
+ loading = $("<div class='loading' />")
+ $("#content").append(loading)
+ window.scrollTo(0,0))
+ .bind("end.pjax", pjaxEnd = ->
+ $("img").error ->
+ $(this).attr("src", "<%= asset_path Author::DEFAULT_AVATAR %>")
+ )
#########################################
# Update Form
@@ -77,10 +84,6 @@ $(document).ready ->
textarea.text(shareText(update))
focusTextArea(update)
- # Delete update check
- $(".remove-update").click ->
- confirm "Are you sure you want to delete this update?"
-
# Manage reply state and service share checkboxes
updateTickyboxes = ->
return if(userTickiedBox)
@@ -1,3 +0,0 @@
-# Place all the behaviors and hooks related to the matching controller here.
-# All this logic will automatically be available in application.js.
-# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -1,78 +0,0 @@
-(function() {
- var MAX_LENGTH;
- MAX_LENGTH = 140;
- $(document).ready(function() {
- var focusTextArea, recordTickyboxChange, shareText, textarea, updateCounter, updateTickyboxes, update_field, userTickiedBox;
- $("html").removeClass("no-js").addClass("js");
- textarea = $("#update-form textarea");
- update_field = $("#update-form #update-referral");
- userTickiedBox = false;
- updateCounter = function() {
- var countSpan, remainingLength;
- remainingLength = MAX_LENGTH - textarea.val().length;
- countSpan = $("#update-count .update-count").first();
- if (countSpan.length) {
- countSpan.text(remainingLength);
- } else {
- $("#update-count").append('<span class="update-count">' + remainingLength + '</span>/' + MAX_LENGTH);
- }
- return $("#update-info").toggleClass("negative", remainingLength < 0);
- };
- textarea.keypress(updateCounter).keyup(updateCounter);
- updateTickyboxes = function() {
- var enabled, firstLetter;
- if (userTickiedBox) {
- return;
- }
- firstLetter = "";
- if (textarea.val() !== "") {
- firstLetter = textarea.val()[0];
- }
- enabled = true;
- if (firstLetter === "@") {
- enabled = false;
- }
- if ($("#tweet").length > 0) {
- $("#tweet").attr('checked', enabled);
- }
- };
- textarea.keypress(updateTickyboxes).keyup(updateTickyboxes);
- recordTickyboxChange = function() {
- return userTickiedBox = true;
- };
- if ($("#tweet").length > 0) {
- $("#tweet").change(recordTickyboxChange);
- }
- $("#update-form").submit(function() {
- if (textarea.val().length <= 0 || textarea.val().length > MAX_LENGTH) {
- return false;
- }
- });
- shareText = function(update) {
- return "RS @" + $(update).data("name") + ": " + $(update).find(".entry-content").text().trim();
- };
- focusTextArea = function(update) {
- var length;
- $(update_field).attr("value", $(update).data("id"));
- length = textarea.text().length;
- textarea.keypress();
- textarea[0].setSelectionRange(length, length);
- textarea.focus();
- return window.scrollTo(0, $(textarea).position().top);
- };
- return $(".has-update-form .update").each(function() {
- var update;
- update = $(this);
- $(this).find(".reply").bind("click", function(ev) {
- ev.preventDefault();
- textarea.text("@" + $(update).data("name") + " ");
- return focusTextArea(update);
- });
- return $(this).find(".share").bind("click", function(ev) {
- ev.preventDefault();
- textarea.text(shareText(update));
- return focusTextArea(update);
- });
- });
- });
-}).call(this);
@@ -0,0 +1,67 @@
+jQuery $ ->
+ MAX_LENGTH = 140
+ $("html").removeClass("no-js").addClass("js")
+
+ textarea = $("#update-form textarea")
+ update_field = $("#update-form #update-referral")
+ userTickiedBox = false
+
+ updateCounter = ->
+ remainingLength = MAX_LENGTH - textarea.val().length
+ countSpan = $("#update-count .update-count").first()
+ if countSpan.length
+ countSpan.text(remainingLength)
+ else
+ $("#update-count").append('<span class="update-count">' + remainingLength + '</span>/' + MAX_LENGTH)
+ $("#update-info").toggleClass("negative", remainingLength < 0)
+
+ textarea.keypress(updateCounter).keyup(updateCounter)
+
+ updateTickyboxes = ->
+ if userTickiedBox
+ return
+ firstLetter = ""
+ if textarea.val() != ""
+ firstLetter = textarea.val()[0]
+
+ enabled = true
+ if firstLetter == "@"
+ enabled = false
+
+ if $("#tweet").length > 0
+ $("#tweet").attr('checked', enabled)
+
+ textarea.keypress(updateTickyboxes).keyup(updateTickyboxes)
+
+ recordTickyboxChange = ->
+ userTickiedBox = true
+
+ if $("#tweet").length > 0
+ $("#tweet").change(recordTickyboxChange)
+
+ $("#update-form").submit ->
+ if textarea.val().length <= 0 || textarea.val().length > MAX_LENGTH
+ false
+
+ shareText = (update) ->
+ "RS @" + $(update).data("name") + ": " + $(update).find(".entry-content").text().trim()
+
+ focusTextArea = (update) ->
+ $(update_field).attr("value", $(update).data("id"))
+ length = textarea.text().length
+ textarea.keypress()
+ textarea[0].setSelectionRange(length, length)
+ textarea.focus()
+ window.scrollTo(0, $(textarea).position().top)
+
+ $(".has-update-form .update").each ->
+ update = $(this)
+ $(this).find(".reply").bind "click", (ev) ->
+ ev.preventDefault()
+ textarea.text("@" + $(update).data("name") + " ")
+ focusTextArea(update)
+
+ $(this).find(".share").bind "click", (ev) ->
+ ev.preventDefault()
+ textarea.text(shareText(update))
+ focusTextArea(update)
@@ -1,7 +0,0 @@
-(function() {
- $(document).ready(function() {
- return $(".unfollow").click(function() {
- return confirm("Are you sure you want to unfollow this user?");
- });
- });
-}).call(this);
@@ -15,9 +15,13 @@ def create
# Grab the domain for this author from the request url
params[:domain] = root_url
- author = Author.new params
+ author = Author.new_from_session!(session, params, root_url)
+
+ @user = User.new :author => author,
+ :username => params[:username],
+ :email => params[:email],
+ :password => params[:password]
- @user = User.new params.merge({:author => author})
if @user.valid?
if params[:password].length > 0
@user.save
@@ -4,11 +4,8 @@ def index
set_params_page
@authors = Author.search(params)
- @authors = @authors.paginate(:page => params[:page], :per_page => params[:per_page])
-
- if params[:letter] && !params[:letter].empty?
- set_pagination_buttons(@authors, :letter => params[:letter])
- else
+ unless @authors.empty?
+ @authors = @authors.paginate(:page => params[:page], :per_page => params[:per_page])
set_pagination_buttons(@authors)
end
end
@@ -52,8 +49,7 @@ def update
if response == true
unless @user.email.blank? || @user.email_confirmed
- # Generate same token as password reset....
- Notifier.send_confirm_email_notification(@user.email, @user.set_perishable_token)
+ Notifier.send_confirm_email_notification(@user.email, @user.create_token)
flash[:notice] = "A link to confirm your updated email address has been sent to #{@user.email}."
else
flash[:notice] = "Profile saved!"
@@ -78,7 +74,10 @@ def new
def create
params[:author] = Author.create_from_session!(session, params, root_url)
- @user = User.new params
+ @user = User.new :email => params[:email],
+ :author => params[:author],
+ :username => params[:username],
+ :password => params[:password]
if @user.save
Authorization.create_from_session!(session, @user)
@@ -215,7 +214,7 @@ def forgot_password_create
flash[:notice] = "Your account could not be found, please check your email and try again."
render "login/forgot_password"
else
- Notifier.send_forgot_password_notification(user.email, user.set_password_reset_token)
+ Notifier.send_forgot_password_notification(user.email, user.create_token)
# Redirect to try to avoid repost issues
session[:fp_email] = user.email
redirect_to '/forgot_password_confirm'
@@ -245,7 +244,7 @@ def reset_password_create
if params[:token]
user = User.first(:perishable_token => params[:token])
- if user and user.password_reset_sent.to_time < 2.days.ago
+ if user and user.perishable_token_set.to_time < 2.days.ago
user = nil
end
end
@@ -289,7 +288,7 @@ def reset_password_create
# token and the reset password page is rendered
def reset_password_with_token
user = User.first(:perishable_token => params[:token])
- if user.nil? || user.password_reset_sent.to_time < 2.days.ago
+ if user.nil? || user.perishable_token_set.to_time < 2.days.ago
flash[:notice] = "Your link is no longer valid, please request a new one."
redirect_to "/forgot_password"
else
Oops, something went wrong.

0 comments on commit df82072

Please sign in to comment.