Module: BlogHelper
- Included in:
- ApplicationHelper, Blog::CommentsController, PaperSweeper
- Defined in:
- app/helpers/blog_helper.rb
Instance Method Summary collapse
Instance Method Details
#resumer(content, options = {}) ⇒ Object
19 20 21 |
# File 'app/helpers/blog_helper.rb', line 19 def resumer(content, = {}) truncate(content.gsub(/<\/?[^>]*>/, ""), { :length => 500 }.update()) end |
#tag_cloud(tags, classes) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/helpers/blog_helper.rb', line 7 def tag_cloud(, classes) counts = .map(&:last) min = counts.min max = counts.max divisor = ((max - min) / classes.size) + 1 .map do |t| yield t[0], classes[(t[1].to_i - min) / divisor] end end |
#tags ⇒ Object
2 3 4 5 |
# File 'app/helpers/blog_helper.rb', line 2 def # FIXME count taggable only if it state is 'published' ActsAsTaggableOn::Tag.count(:name, :joins => 'INNER JOIN taggings ON taggings.tag_id = tags.id' , :conditions => { :taggings => { :taggable_type => 'Paper'}}, :group => 'name', :select => 'name', :limit => 100 ) end |