Class: Posts::TripleCell

Inherits:
BaseCell
  • Object
show all
Defined in:
app/cells/posts/triple_cell.rb

Overview

Vertical widget with 3 posts

Instance Method Summary collapse

Methods included from PostsHelper

#permalink_url, #post_description_short, #post_descritpion_has_image?, #post_teaser_for, #smart_post_path, #smart_post_url, #text_short, #typography

Methods included from CommentsHelper

#comment_path, #comment_url, #comments_link

Methods included from ApplicationHelper

#benchmark, #bootstrap_class_for, #counter_tag, #format_date, #glyphicon, #js_redirect_to, #recaptcha_tags, #send_ga_events, #smart_date, #snippet, #time_or_date

Instance Method Details

#showObject


4
5
6
7
8
9
10
11
12
13
# File 'app/cells/posts/triple_cell.rb', line 4

def show
  posts = model
  @post1 = posts.find(&:has_picture?) || posts.first

  @post2, @post3 = posts.reject { |p| p == @post1 }
                        .sort_by(&:created_at)
                        .reverse

  render
end