Sha256: df110f9cbfd8d84f1906f715de89c9c07bd07555d8b2804ef007251e80849eed

Contents?: true

Size: 980 Bytes

Versions: 18

Compression:

Stored size: 980 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

    def user_flaggable?
      return if (try(:profile_holder) || try(:profile_user) || try(:model)).try(:blocked)
      return unless context[:controller].try(:flaggable_controller?)

      true
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
decidim-core-0.28.4 app/helpers/decidim/cells_helper.rb
decidim-core-0.27.9 app/helpers/decidim/cells_helper.rb
decidim-core-0.28.3 app/helpers/decidim/cells_helper.rb
decidim-core-0.27.8 app/helpers/decidim/cells_helper.rb
decidim-core-0.28.2 app/helpers/decidim/cells_helper.rb
decidim-core-0.27.7 app/helpers/decidim/cells_helper.rb
decidim-core-0.28.1 app/helpers/decidim/cells_helper.rb
decidim-core-0.27.6 app/helpers/decidim/cells_helper.rb
decidim-core-0.26.10 app/helpers/decidim/cells_helper.rb
decidim-core-0.26.9 app/helpers/decidim/cells_helper.rb
decidim-core-0.28.0 app/helpers/decidim/cells_helper.rb
decidim-core-0.27.5 app/helpers/decidim/cells_helper.rb
decidim-core-0.28.0.rc5 app/helpers/decidim/cells_helper.rb
decidim-core-0.28.0.rc4 app/helpers/decidim/cells_helper.rb
decidim-core-0.26.8 app/helpers/decidim/cells_helper.rb
decidim-core-0.27.4 app/helpers/decidim/cells_helper.rb
decidim-core-0.27.3 app/helpers/decidim/cells_helper.rb
decidim-core-0.26.7 app/helpers/decidim/cells_helper.rb