Module: Decidim::Assemblies::AssembliesHelper

Includes:
FilterAssembliesHelper, Decidim::AttachmentsHelper, FiltersHelper, IconHelper, ResourceHelper, ResourceReferenceHelper, SanitizeHelper, WidgetUrlsHelper
Defined in:
app/helpers/decidim/assemblies/assemblies_helper.rb

Overview

Helpers related to the Assemblies layout.

Instance Method Summary collapse

Methods included from FilterAssembliesHelper

#available_filters, #current_filter_name, #filter_link, #filter_name, #help_text

Instance Method Details

#assembly_features(assembly) ⇒ Object



32
33
34
35
36
37
38
39
# File 'app/helpers/decidim/assemblies/assemblies_helper.rb', line 32

def assembly_features(assembly)
  html = "".html_safe
  html += "<strong>#{translated_attribute(assembly.title)}: </strong>".html_safe
  html += t("assemblies.show.private_space", scope: "decidim").to_s.html_safe
  html += ", #{t("assemblies.show.is_transparent.#{assembly.is_transparent}", scope: "decidim")}".html_safe if assembly.is_transparent?
  html += " #{decidim_sanitize translated_attribute(assembly.special_features)}".html_safe
  html.html_safe
end

#participatory_processes_for_assembly(assembly_participatory_processes) ⇒ Object

Public: Returns the characteristics of an assembly in a readable format like “title: close, no public, no transparent and is restricted to the members of the assembly”



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/helpers/decidim/assemblies/assemblies_helper.rb', line 18

def participatory_processes_for_assembly(assembly_participatory_processes)
  html = ""
  html += %( <div class="section"> ).html_safe
  html += %( <h4 class="section-heading">#{t("assemblies.show.related_participatory_processes", scope: "decidim")}</h4> ).html_safe
  html += %( <div class="row small-up-1 medium-up-2 card-grid"> ).html_safe
  assembly_participatory_processes.each do |assembly_participatory_process|
    html += render partial: "decidim/participatory_processes/participatory_process", locals: { participatory_process: assembly_participatory_process }
  end
  html += %( </div> ).html_safe
  html += %( </div> ).html_safe

  html.html_safe
end


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'app/helpers/decidim/assemblies/assemblies_helper.rb', line 41

def social_handler_links(assembly)
  html = "".html_safe
  if Decidim::Assembly::SOCIAL_HANDLERS.any? { |h| assembly.try("#{h}_handler").present? }
    html += "<div class='definition-data__item social_networks'>".html_safe
    html += "<span class='definition-data__title'>#{t("assemblies.show.social_networks", scope: "decidim")}</span>".html_safe
    Decidim::Assembly::SOCIAL_HANDLERS.each do |handler|
      handler_name = "#{handler}_handler"
      if assembly.send(handler_name).present?
        html += link_to handler.capitalize, "https://#{handler}.com/#{assembly.send(handler_name)}", target: "_blank", class: "", title: handler.capitalize
      end
    end
    html += "</div>".html_safe
  end

  html.html_safe
end