| @@ -41,3 +41,4 @@ gem 'bson_ext' | |||||
| gem 'haml-rails' | gem 'haml-rails' | ||||
| gem 'mm-multi-parameter-attributes' | gem 'mm-multi-parameter-attributes' | ||||
| gem 'feedzirra' | gem 'feedzirra' | ||||
| gem 'htmlentities' | |||||
| @@ -61,6 +61,7 @@ GEM | |||||
| haml (~> 3.0) | haml (~> 3.0) | ||||
| railties (~> 3.0) | railties (~> 3.0) | ||||
| hike (1.2.1) | hike (1.2.1) | ||||
| htmlentities (4.3.1) | |||||
| i18n (0.6.0) | i18n (0.6.0) | ||||
| journey (1.0.4) | journey (1.0.4) | ||||
| jquery-rails (2.0.2) | jquery-rails (2.0.2) | ||||
| @@ -142,6 +143,7 @@ DEPENDENCIES | |||||
| coffee-rails (~> 3.2.1) | coffee-rails (~> 3.2.1) | ||||
| feedzirra | feedzirra | ||||
| haml-rails | haml-rails | ||||
| htmlentities | |||||
| jquery-rails | jquery-rails | ||||
| mm-multi-parameter-attributes | mm-multi-parameter-attributes | ||||
| mongo_mapper | mongo_mapper | ||||
| @@ -13,7 +13,7 @@ module PostsHelper | |||||
| }, | }, | ||||
| :text => { | :text => { | ||||
| :title => post.title, | :title => post.title, | ||||
| :description => post.summary, | |||||
| :description => clean_description(post.summary), | |||||
| :footnote => "From #{post.feed.title}" | :footnote => "From #{post.feed.title}" | ||||
| }, | }, | ||||
| :actions => [ | :actions => [ | ||||
| @@ -27,4 +27,13 @@ module PostsHelper | |||||
| ] | ] | ||||
| } | } | ||||
| end | end | ||||
| def clean_description(s) | |||||
| if s.size > 137 | |||||
| s = s[0..136] + '...' | |||||
| end | |||||
| coder = HTMLEntities.new | |||||
| coder.decode(s.gsub(/<.+?>/, '')) | |||||
| end | |||||
| end | end | ||||