Module: Decidim::CellsHelper
- Included in:
- AuthorCell, CollapsibleAuthorsCell, EndorsementButtonsCell, ProfileSidebarCell
- Defined in:
- app/helpers/decidim/cells_helper.rb
Instance Method Summary collapse
- #current_component ⇒ Object
- #flaggable? ⇒ Boolean
- #from_context ⇒ Object
- #index_action? ⇒ Boolean
- #show_action? ⇒ Boolean
- #user_flaggable? ⇒ Boolean
- #withdrawable? ⇒ Boolean
Instance Method Details
#current_component ⇒ Object
17 18 19 |
# File 'app/helpers/decidim/cells_helper.rb', line 17 def current_component from_context.component end |
#flaggable? ⇒ Boolean
29 30 31 32 33 34 35 |
# File 'app/helpers/decidim/cells_helper.rb', line 29 def flaggable? return unless from_context return unless context[:controller].try(:flaggable_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
9 10 11 |
# File 'app/helpers/decidim/cells_helper.rb', line 9 def index_action? context[:controller].action_name == "index" end |
#show_action? ⇒ Boolean
13 14 15 |
# File 'app/helpers/decidim/cells_helper.rb', line 13 def show_action? context[:controller].action_name == "show" end |
#user_flaggable? ⇒ Boolean
37 38 39 40 41 42 |
# File 'app/helpers/decidim/cells_helper.rb', line 37 def user_flaggable? return if (try(:profile_holder) || try(:profile_user) || try(:model)).try(:blocked) return unless context[:controller].try(:flaggable_controller?) true end |
#withdrawable? ⇒ Boolean
21 22 23 24 25 26 27 |
# File 'app/helpers/decidim/cells_helper.rb', line 21 def withdrawable? return unless from_context return unless context[:controller].try(:withdrawable_controller?) return if index_action? from_context.withdrawable_by?(current_user) end |