diff --git a/.gitignore b/.gitignore index 0cd2601..5a0e973 100644 --- a/.gitignore +++ b/.gitignore @@ -2,11 +2,9 @@ db/*.sqlite3* log/*.log *.log -tmp/**/* -tmp/* -doc/api -doc/app +/tmp/ +doc/ *.swp *~ .DS_Store -config/s3.yml \ No newline at end of file +config/s3.yml diff --git a/Gemfile b/Gemfile index 650fc97..d5f9d0e 100644 --- a/Gemfile +++ b/Gemfile @@ -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' @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 766d663..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,126 +0,0 @@ -GEM - remote: http://rubygems.org/ - specs: - abstract (1.0.0) - actionmailer (3.0.3) - actionpack (= 3.0.3) - mail (~> 2.2.9) - actionpack (3.0.3) - activemodel (= 3.0.3) - activesupport (= 3.0.3) - builder (~> 2.1.2) - erubis (~> 2.6.6) - i18n (~> 0.4) - rack (~> 1.2.1) - rack-mount (~> 0.6.13) - rack-test (~> 0.5.6) - tzinfo (~> 0.3.23) - activemodel (3.0.3) - activesupport (= 3.0.3) - builder (~> 2.1.2) - i18n (~> 0.4) - activerecord (3.0.3) - activemodel (= 3.0.3) - activesupport (= 3.0.3) - arel (~> 2.0.2) - tzinfo (~> 0.3.23) - activeresource (3.0.3) - activemodel (= 3.0.3) - activesupport (= 3.0.3) - activesupport (3.0.3) - annotate-models (1.0.4) - arel (2.0.6) - aws-s3 (0.6.2) - builder - mime-types - xml-simple - builder (2.1.2) - diff-lcs (1.1.2) - erubis (2.6.6) - abstract (>= 1.0.0) - factory_girl (1.3.2) - factory_girl_rails (1.0) - factory_girl (~> 1.3) - rails (>= 3.0.0.beta4) - faker (0.3.1) - gravatar_image_tag (1.0.0.pre2) - i18n (0.5.0) - jquery-rails (0.2.7) - rails (~> 3.0) - thor (~> 0.14.4) - mail (2.2.12) - activesupport (>= 2.3.6) - i18n (>= 0.4.0) - mime-types (~> 1.16) - treetop (~> 1.4.8) - maruku (0.6.0) - syntax (>= 1.0.0) - mime-types (1.16) - nokogiri (1.4.4.1-x86-mingw32) - paperclip (2.3.8) - activerecord - activesupport - polyglot (0.3.1) - rack (1.2.1) - rack-mount (0.6.13) - rack (>= 1.0.0) - rack-test (0.5.6) - rack (>= 1.0) - rails (3.0.3) - actionmailer (= 3.0.3) - actionpack (= 3.0.3) - activerecord (= 3.0.3) - activeresource (= 3.0.3) - activesupport (= 3.0.3) - bundler (~> 1.0) - railties (= 3.0.3) - railties (3.0.3) - actionpack (= 3.0.3) - activesupport (= 3.0.3) - rake (>= 0.8.7) - thor (~> 0.14.4) - rake (0.8.7) - rspec (2.3.0) - rspec-core (~> 2.3.0) - rspec-expectations (~> 2.3.0) - rspec-mocks (~> 2.3.0) - rspec-core (2.3.1) - rspec-expectations (2.3.0) - diff-lcs (~> 1.1.2) - rspec-mocks (2.3.0) - rspec-rails (2.3.0) - actionpack (~> 3.0) - activesupport (~> 3.0) - railties (~> 3.0) - rspec (~> 2.3.0) - sqlite3-ruby (1.3.2-x86-mingw32) - syntax (1.0.0) - thor (0.14.6) - treetop (1.4.9) - polyglot (>= 0.3.1) - tzinfo (0.3.23) - webrat (0.7.1) - nokogiri (>= 1.2.0) - rack (>= 1.0) - rack-test (>= 0.5.3) - will_paginate (3.0.pre2) - xml-simple (1.0.14) - -PLATFORMS - x86-mingw32 - -DEPENDENCIES - annotate-models (= 1.0.4) - aws-s3 - factory_girl_rails (= 1.0) - faker (= 0.3.1) - gravatar_image_tag (= 1.0.0.pre2) - jquery-rails (>= 0.2.6) - maruku - paperclip (~> 2.3) - rails (= 3.0.3) - rspec (= 2.3.0) - rspec-rails (= 2.3.0) - sqlite3-ruby (= 1.3.2) - webrat (= 0.7.1) - will_paginate (= 3.0.pre2) diff --git a/app/helpers/microposts_helper.rb b/app/helpers/microposts_helper.rb new file mode 100644 index 0000000..ba2702d --- /dev/null +++ b/app/helpers/microposts_helper.rb @@ -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 \ No newline at end of file diff --git a/app/views/shared/_feed_item.html.erb b/app/views/shared/_feed_item.html.erb index 5c6d7b8..5b8781e 100644 --- a/app/views/shared/_feed_item.html.erb +++ b/app/views/shared/_feed_item.html.erb @@ -6,7 +6,7 @@ <%= link_to feed_item.user.name, feed_item.user %> - <%= feed_item.content %> + <%= wrap(feed_item.content) %> Posted <%= time_ago_in_words(feed_item.created_at) %> ago.