Class: Decidim::DecidimAwesome::ContentBlocks::MapCell
- Inherits:
-
ViewModel
- Object
- ViewModel
- Decidim::DecidimAwesome::ContentBlocks::MapCell
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_categories, #global_settings, #settings_source, #step_settings
Instance Method Details
#all_categories ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
|
# File 'app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb', line 29
def all_categories
return if @all_categories.present?
@category_ids ||= Decidim::Category.pluck(:id, :decidim_participatory_space_type, :decidim_participatory_space_id).select do |category|
_id, space_type, space_id = category
space = space_type.constantize.find(space_id)
space.organization == current_organization
end.map(&:first)
@all_categories ||= Decidim::Category.where(id: @category_ids)
end
|
#error ⇒ Object
21
22
23
|
# File 'app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb', line 21
def error
render
end
|
#global_map_components ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb', line 41
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
else
false
end
else
false
end
end
end
|
#hide_controls ⇒ Object
25
26
27
|
# File 'app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb', line 25
def hide_controls
true
end
|
#section_title ⇒ Object
58
59
60
61
62
63
64
65
|
# File 'app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb', line 58
def section_title
return if model.settings.title.blank?
return if model.settings.title.values.join.blank?
content_tag :h3, class: "section-heading" do
translated_attribute(model.settings.title)
end
end
|
#show ⇒ Object
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
|