Module: Decidim::CellsHelper
- Included in:
- AuthorCell, CollapsibleAuthorsCell
- Defined in:
- app/helpers/decidim/cells_helper.rb
Instance Method Summary collapse
- #collaborative_drafts_controller? ⇒ Boolean
- #current_component ⇒ Object
- #flagable? ⇒ Boolean
- #from_context ⇒ Object
- #index_action? ⇒ Boolean
- #posts_controller? ⇒ Boolean
- #proposals_controller? ⇒ Boolean
- #show_action? ⇒ Boolean
- #withdrawable? ⇒ Boolean
Instance Method Details
#collaborative_drafts_controller? ⇒ Boolean
13 14 15 |
# File 'app/helpers/decidim/cells_helper.rb', line 13 def collaborative_drafts_controller? context[:controller].class.to_s == "Decidim::Proposals::CollaborativeDraftsController" end |
#current_component ⇒ Object
29 30 31 |
# File 'app/helpers/decidim/cells_helper.rb', line 29 def current_component from_context.component end |
#flagable? ⇒ Boolean
41 42 43 44 45 46 47 |
# File 'app/helpers/decidim/cells_helper.rb', line 41 def flagable? return unless from_context return unless proposals_controller? || collaborative_drafts_controller? return if index_action? true end |
#from_context ⇒ Object
5 6 7 |
# File 'app/helpers/decidim/cells_helper.rb', line 5 def from_context [:from].presence || context[:from].presence end |
#index_action? ⇒ Boolean
21 22 23 |
# File 'app/helpers/decidim/cells_helper.rb', line 21 def index_action? context[:controller].action_name == "index" end |
#posts_controller? ⇒ Boolean
17 18 19 |
# File 'app/helpers/decidim/cells_helper.rb', line 17 def posts_controller? context[:controller].class.to_s == "Decidim::Blogs::PostsController" end |
#proposals_controller? ⇒ Boolean
9 10 11 |
# File 'app/helpers/decidim/cells_helper.rb', line 9 def proposals_controller? context[:controller].class.to_s == "Decidim::Proposals::ProposalsController" end |
#show_action? ⇒ Boolean
25 26 27 |
# File 'app/helpers/decidim/cells_helper.rb', line 25 def show_action? context[:controller].action_name == "show" end |
#withdrawable? ⇒ Boolean
33 34 35 36 37 38 39 |
# File 'app/helpers/decidim/cells_helper.rb', line 33 def withdrawable? return unless from_context return unless proposals_controller? return if index_action? from_context.withdrawable_by?(current_user) end |