Skip to content

Commit

Permalink
Adding changes from rails sample app
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris committed Feb 22, 2011
2 parents 26782ca + 337c1de commit 8f131c2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 135 deletions.
8 changes: 3 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
db/*.sqlite3*
log/*.log
*.log
tmp/**/*
tmp/*
doc/api
doc/app
/tmp/
doc/
*.swp
*~
.DS_Store
config/s3.yml
config/s3.yml
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'http://rubygems.org'

gem 'rails', '3.0.3'
gem 'sqlite3-ruby', '1.3.2', :require => 'sqlite3', :group => :development
gem 'rails', '3.0.4'
gem 'gravatar_image_tag', '1.0.0.pre2'
gem 'will_paginate', '3.0.pre2'
gem 'maruku'
Expand All @@ -10,13 +10,13 @@ gem "paperclip", "~> 2.3"
gem 'aws-s3'

group :development do
gem 'rspec-rails', '2.3.0'
gem 'rspec-rails', '2.5.0'
gem 'annotate-models', '1.0.4'
gem 'faker', '0.3.1'
end

group :test do
gem 'rspec', '2.3.0'
gem 'rspec', '2.5.0'
gem 'webrat', '0.7.1'
gem 'factory_girl_rails', '1.0'
end
126 changes: 0 additions & 126 deletions Gemfile.lock

This file was deleted.

15 changes: 15 additions & 0 deletions app/helpers/microposts_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module MicropostsHelper

def wrap(content)
sanitize(raw(content.split.map{ |s| wrap_long_string(s) }.join(' ')))
end

private

def wrap_long_string(text, max_width = 30)
zero_width_space = "​"
regex = /.{1,#{max_width}}/
(text.length < max_width) ? text :
text.scan(regex).join(zero_width_space)
end
end
2 changes: 1 addition & 1 deletion app/views/shared/_feed_item.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span class="user">
<%= link_to feed_item.user.name, feed_item.user %>
</span>
<span class="content"><%= feed_item.content %></span>
<span class="content"><%= wrap(feed_item.content) %></span>
<span class="timestamp">
Posted <%= time_ago_in_words(feed_item.created_at) %> ago.
</span>
Expand Down

0 comments on commit 8f131c2

Please sign in to comment.