Sha256: 210669ea6cdb40ec58a6d5ed00f9dae58bc0cf354cb5c2e031fa5ab6ee2ba331

Contents?: true

Size: 1.03 KB

Versions: 46

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module Decidim
  # The controller to show all the last activities in a Decidim Organization.
  class LastActivitiesController < Decidim::ApplicationController
    include FilterResource
    include Paginable

    helper Decidim::ResourceHelper
    helper Decidim::FiltersHelper

    helper_method :activities, :resource_types

    private

    def resource_types
      return @resource_types if defined?(@resource_types)

      @resource_types = search.resource_types.sort_by do |klass|
        klass.constantize.model_name.human
      end

      @resource_types = @resource_types.map do |klass|
        [klass, klass.constantize.model_name.human]
      end

      @resource_types << ["all", I18n.t("decidim.last_activities.all")]
    end

    def activities
      @activities ||= paginate(search.results)
    end

    def search_klass
      HomeActivitySearch
    end

    def context_params
      { organization: current_organization }
    end

    def default_filter_params
      { resource_type: "all" }
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
decidim-core-0.26.10 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.26.9 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.26.8 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.26.7 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.26.5 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.26.4 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.26.3 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.26.2 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.26.1 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.26.0 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.26.0.rc2 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.26.0.rc1 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.25.2 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.25.1 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.25.0 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.25.0.rc4 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.25.0.rc3 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.25.0.rc2 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.25.0.rc1 app/controllers/decidim/last_activities_controller.rb
decidim-core-0.24.3 app/controllers/decidim/last_activities_controller.rb