Class: Decidim::DecidimAwesome::ContentBlocks::MapCell

Inherits:
ViewModel
  • Object
show all
Includes:
Cell::ViewModel::Partial, CardHelper, MapHelper
Defined in:
app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb

Instance Method Summary collapse

Methods included from MapHelper

#api_ready?, #awesome_map_for, #current_taxonomies, #global_settings, #settings_source, #step_settings

Instance Method Details

#all_taxonomiesObject



29
30
31
# File 'app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb', line 29

def all_taxonomies
  Decidim::Taxonomy.find(settings.taxonomy_ids.reject(&:empty?))
end

#errorObject



21
22
23
# File 'app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb', line 21

def error
  render
end

#global_map_componentsObject



33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb', line 33

def global_map_components
  @global_map_components ||= Decidim::Component.where(manifest_name: [:meetings, :proposals]).published.filter do |component|
    if component.organization == current_organization
      case component.manifest.name
      when :meetings
        true
      when :proposals
        component.settings.geocoding_enabled
      end
    end
  end
end

#hide_controlsObject



25
26
27
# File 'app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb', line 25

def hide_controls
  true
end

#section_titleObject



46
47
48
49
50
51
52
53
# File 'app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb', line 46

def section_title
  return if model.settings.title.blank?
  return if model.settings.title.values.join.blank?

   :h3, class: "section-heading" do
    translated_attribute(model.settings.title)
  end
end

#showObject



15
16
17
18
19
# File 'app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb', line 15

def show
  return error unless Decidim::Map.configured?

  render
end