Class: Decidim::Posts::ContentBlocks::PostsCell

Inherits:
ViewModel
  • Object
show all
Includes:
Cell::ViewModel::Partial, PostCellsHelper
Defined in:
app/cells/decidim/posts/content_blocks/posts_cell.rb

Instance Method Summary collapse

Methods included from PostCellsHelper

#component_settings, #current_component, #current_settings, #participatory_space

Methods included from ApplicationHelper

#category_label, #category_label_singular, #posts_component_for_meeting

Instance Method Details

#decidim_feedsObject



25
26
27
# File 'app/cells/decidim/posts/content_blocks/posts_cell.rb', line 25

def decidim_feeds
  Decidim::EngineRouter.main_proxy(component)
end

#posts_pathObject



29
30
31
# File 'app/cells/decidim/posts/content_blocks/posts_cell.rb', line 29

def posts_path
  decidim_feeds.posts_path
end

#showObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/cells/decidim/posts/content_blocks/posts_cell.rb', line 9

def show
  @posts = Decidim::Posts::Post
           .where(decidim_component_id: component_id)
           .filter_category(params[:filter_post_category])
           .order(created_at: :desc)
           .limit(6)
  extra_context = {
    current_component: component,
    current_organization: component.organization,
    current_user:,
    current_participatory_space: component.participatory_space
  }
  # @form = form(Decidim::Posts::PostForm).from_params(params, extra_context)
  render :show
end