Module: Decidim::Calendar::CalendarHelper
- Includes:
- ApplicationHelper, ResourceHelper, TranslationsHelper
- Defined in:
- app/helpers/decidim/calendar/calendar_helper.rb
Instance Method Summary collapse
- #calendar_event(event) ⇒ Object
- #calendar_resource(name) ⇒ Object
- #extended_navigation_bar(items, max_items: 5) ⇒ Object
- #participatory_gantt(event) ⇒ Object
- #participatory_space_wrapper(&block) ⇒ Object
Instance Method Details
#calendar_event(event) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/helpers/decidim/calendar/calendar_helper.rb', line 15 def calendar_event(event) %({ "title": "#{translated_attribute event.full_title}", "start": "#{event.start.strftime("%FT%R")}", "end": "#{event.finish.strftime("%FT%R")}", "color": "#{event.color}", "url": "#{event.link}", "resourceId": "#{event.type}", "allDay": #{event.all_day?} }) end |
#calendar_resource(name) ⇒ Object
9 10 11 12 13 14 |
# File 'app/helpers/decidim/calendar/calendar_helper.rb', line 9 def calendar_resource(name) %({ "id": "#{name}", "title": "#{I18n.t(name, scope: "decidim.calendar.index.filters")}" }) end |
#extended_navigation_bar(items, max_items: 5) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/helpers/decidim/calendar/calendar_helper.rb', line 43 def (items, max_items: 5) return unless items.any? extra_items = [] active_item = items.find { |item| item[:active] } render partial: "decidim/shared/extended_navigation_bar", locals: { items: items, extra_items: extra_items, active_item: active_item, max_items: 5 } end |
#participatory_gantt(event) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'app/helpers/decidim/calendar/calendar_helper.rb', line 27 def participatory_gantt(event) %({ "id": "#{event.full_id}", "name": "#{translated_attribute event.full_title}", "start": "#{event.start.strftime("%FT%R")}", "dependencies": "#{event.parent}", "end": "#{event.finish.strftime("%FT%R")}" }) end |
#participatory_space_wrapper(&block) ⇒ Object
37 38 39 40 41 |
# File 'app/helpers/decidim/calendar/calendar_helper.rb', line 37 def participatory_space_wrapper(&block) content_tag :main, class: "wrapper" do concat(capture(&block)) end end |