Class: Decidim::Meetings::ContentBlocks::UpcomingMeetingsCell
- Inherits:
-
ViewModel
- Object
- ViewModel
- Decidim::Meetings::ContentBlocks::UpcomingMeetingsCell
- Includes:
- CardHelper
- Defined in:
- app/cells/decidim/meetings/content_blocks/upcoming_meetings_cell.rb
Instance Method Summary collapse
- #all_online_meetings? ⇒ Boolean
- #maps_active? ⇒ Boolean
- #meetings_directory_path ⇒ Object
- #show ⇒ Object
- #show_map? ⇒ Boolean
- #upcoming_meetings ⇒ Object
Instance Method Details
#all_online_meetings? ⇒ Boolean
36 37 38 |
# File 'app/cells/decidim/meetings/content_blocks/upcoming_meetings_cell.rb', line 36 def all_online_meetings? upcoming_meetings.collect(&:type_of_meeting).all?("online") end |
#maps_active? ⇒ Boolean
32 33 34 |
# File 'app/cells/decidim/meetings/content_blocks/upcoming_meetings_cell.rb', line 32 def maps_active? Decidim::Map.available?(:geocoding) end |
#meetings_directory_path ⇒ Object
40 41 42 |
# File 'app/cells/decidim/meetings/content_blocks/upcoming_meetings_cell.rb', line 40 def meetings_directory_path Decidim::Meetings::DirectoryEngine.routes.url_helpers.root_path end |
#show ⇒ Object
9 10 11 12 13 |
# File 'app/cells/decidim/meetings/content_blocks/upcoming_meetings_cell.rb', line 9 def show return if upcoming_meetings.blank? render end |
#show_map? ⇒ Boolean
28 29 30 |
# File 'app/cells/decidim/meetings/content_blocks/upcoming_meetings_cell.rb', line 28 def show_map? maps_active? && !all_online_meetings? end |
#upcoming_meetings ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/cells/decidim/meetings/content_blocks/upcoming_meetings_cell.rb', line 15 def upcoming_meetings @upcoming_meetings ||= Decidim::Meetings::Meeting .includes(:author, component: :participatory_space) .where(component: meeting_components) .visible_for(current_user) .published .where("end_time >= ?", Time.current) .except_withdrawn .not_hidden .order(start_time: :asc) .limit(limit) end |