Sha256: 0c4ec764146f038802e2b1b3a92e2f74cf3ead640c520228851ed7e7349aede7

Contents?: true

Size: 1.36 KB

Versions: 6

Compression:

Stored size: 1.36 KB

Contents

# frozen_string_literal: true

module Decidim
  module Assemblies
    # Helpers related to the Assemblies layout.
    module AssembliesHelper
      include Decidim::ResourceHelper
      include Decidim::AttachmentsHelper
      include Decidim::IconHelper
      include Decidim::SanitizeHelper
      include Decidim::ResourceReferenceHelper
      include Decidim::FiltersHelper
      include FilterAssembliesHelper

      # Items to display in the navigation of an assembly
      def assembly_nav_items(participatory_space)
        components = participatory_space.components.published.or(Decidim::Component.where(id: try(:current_component)))

        [
          *(if participatory_space.members.not_ceased.any?
              [{
                name: t("assembly_member_menu_item", scope: "layouts.decidim.assembly_navigation"),
                url: decidim_assemblies.assembly_assembly_members_path(participatory_space),
                active: is_active_link?(decidim_assemblies.assembly_assembly_members_path(participatory_space), :inclusive)
              }]
            end
           )
        ] + components.map do |component|
          {
            name: decidim_escape_translated(component.name),
            url: main_component_path(component),
            active: is_active_link?(main_component_path(component), :inclusive)
          }
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-assemblies-0.29.1 app/helpers/decidim/assemblies/assemblies_helper.rb
decidim-assemblies-0.29.0 app/helpers/decidim/assemblies/assemblies_helper.rb
decidim-assemblies-0.29.0.rc4 app/helpers/decidim/assemblies/assemblies_helper.rb
decidim-assemblies-0.29.0.rc3 app/helpers/decidim/assemblies/assemblies_helper.rb
decidim-assemblies-0.29.0.rc2 app/helpers/decidim/assemblies/assemblies_helper.rb
decidim-assemblies-0.29.0.rc1 app/helpers/decidim/assemblies/assemblies_helper.rb