Sha256: 8aef0242d5201bd1c740f32e5a9587c8367009898dd110f57a87d78c08b59cb6

Contents?: true

Size: 776 Bytes

Versions: 8

Compression:

Stored size: 776 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module CellsHelper
    def from_context
      options[:from].presence || context[:from].presence
    end

    def index_action?
      context[:controller].action_name == "index"
    end

    def show_action?
      context[:controller].action_name == "show"
    end

    def current_component
      from_context.component
    end

    def withdrawable?
      return unless from_context
      return unless context[:controller].try(:withdrawable_controller?)
      return if index_action?

      from_context.withdrawable_by?(current_user)
    end

    def flaggable?
      return unless from_context
      return unless context[:controller].try(:flaggable_controller?)
      return if index_action?

      true
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
decidim-core-0.23.6 app/helpers/decidim/cells_helper.rb
decidim-core-0.23.5 app/helpers/decidim/cells_helper.rb
decidim-core-0.23.4 app/helpers/decidim/cells_helper.rb
decidim-core-0.23.3 app/helpers/decidim/cells_helper.rb
decidim-core-0.23.2 app/helpers/decidim/cells_helper.rb
decidim-core-0.23.1 app/helpers/decidim/cells_helper.rb
decidim-core-0.23.1.rc1 app/helpers/decidim/cells_helper.rb
decidim-core-0.23.0 app/helpers/decidim/cells_helper.rb