Module: Decidim::Assemblies::AssembliesHelper

Includes:
FilterAssembliesHelper, Decidim::AttachmentsHelper, FiltersHelper, IconHelper, ResourceHelper, ResourceReferenceHelper, SanitizeHelper, WidgetUrlsHelper
Defined in:
decidim-assemblies/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, #help_text, #organization_assembly_types

Methods included from FiltersHelper

#filter_form_for

Methods included from ResourceReferenceHelper

#resource_reference

Methods included from SanitizeHelper

#decidim_html_escape, #decidim_sanitize, #decidim_sanitize_newsletter, #decidim_url_escape, included

Methods included from WidgetUrlsHelper

#embed_modal_for

Methods included from IconHelper

#component_icon, #manifest_icon, #resource_icon

Methods included from LayoutHelper

#_icon_classes, #extended_navigation_bar, #external_icon, #favicon, #icon, #organization_colors, #role

Methods included from Decidim::AttachmentsHelper

#attachment_title, #attachments_for

Methods included from ResourceHelper

#linked_classes_filter_values_for, #linked_classes_for, #linked_resources_for, #resource_locator, #resource_title

Instance Method Details

#assembly_features(assembly) ⇒ Object


32
33
34
35
36
37
38
39
# File 'decidim-assemblies/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 'decidim-assemblies/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
57
58
59
# File 'decidim-assemblies/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"
      next if assembly.send(handler_name).blank?

      html += link_to handler.capitalize, "https://#{handler}.com/#{assembly.send(handler_name)}",
                      target: "_blank",
                      class: "",
                      title: t("assemblies.show.social_networks_title", scope: "decidim") << " " << handler.capitalize.to_s, rel: "noopener"
    end
    html += "</div>".html_safe
  end

  html.html_safe
end