This Decidim module enable a multitenant global calendar for Consultations, Debates, External Events, Meetings and Participatory Processes. Giving a snapshot of all current activities in a calendar view form.
NOTE This is a maintained fork of the original ALabs work.
- Display past and future events in from of calendar and agenda.
- Display gantt graph of participatory processes
- Download ICAL for import
- Customize colors and event sources
Edit the Gemfile and add this lines:
gem "decidim-calendar", git: "https://github.com/openpoke/decidim-module-calendar"
Run this rake tasks:
bundle exec rake decidim_calendar:install:migrations
bundle exec rails decidim_calendar:webpacker:install
bundle exec rake db:migrate
To keep the gem up to date, you can use the commands above to also update it.
You don't need to do anything if you are happy with the default colors and configuration of the calendar.
If you want to customize some of the aspects, create an initializer (ie: config/initializer/decidim_calendar.rb
), paste the default configuration and modify according to your needs:
Decidim::Calendar.configure do |config|
# Colors per type of event
# You can generate a nice color palette here: https://coolors.co
# Just remove any event type that you don't want in your calendar
config.events = {
"Decidim::ParticipatoryProcessStep" => {
color: "#3A4A9F",
fontColor: "#fff", # used when "color" is used as background
id: :participatory_step
},
"Decidim::Meetings::Meeting" => {
color: "#ed1c24",
fontColor: "#fff",
id: :meeting
},
"Decidim::Calendar::ExternalEvent" => {
color: "#ed650b",
fontColor: "#fff",
id: :external_event
},
"Decidim::Debates::Debate" => {
color: "#099329",
fontColor: "#fff",
id: :debate
},
# optional events, it is save to define it here even if not installed (will be ignored)
"Decidim::Consultation" => {
color: "#92278f",
fontColor: "#fff",
id: :consultation
}
}
config.calendar_options = {
# 0 for sunday, 1 for monday, etc
firstDay: 1,
# one of: dayGridMonth,dayGridWeek,dayGridDay,listWeek,listMonth,list
defaultView: "dayGridMonth",
# use "true" to get a am/pm format
hour12: false,
# several of: dayGridMonth,dayGridWeek,dayGridDay,listWeek,listMonth,listYear
views: "dayGridMonth,dayGridWeek,dayGridDay,listWeek",
# Forces to open all event links in a new window
openInNewWindow: true
}
end
You can also make use of your custom event models. For that you only need to ensure that these propoerties are returned by the module:
id
: the unique ID of the eventtitle
: the title of the eventstart_date
: the start date of the event (can also be namedstart_time
)end_date
: the end date of the event (can also be namedend_time
)subtitle
: (optional) the subtitle of the eventurl
: (optional) the url of the event
By default the model is queried using the default scope of the model.
You can customized the amount of rows extracted by creating a new object and defining a default_scope
:
# /app/models/recent_meetings
class RecentMeetings < Decidim::Meetings::Meeting
default_scope -> { where("start_time > ?", 1.years.ago) }
# You can customize the title for instance
def title
"Recent Event: #{super}"
end
end
Then, in your initializer:
Decidim::Calendar.configure do |config|
config.events = {
...,
"RecentMeetings" => {
color: "#ed1c24",
fontColor: "#fff",
id: :recent_meeting
},
...
}
end
For instructions how to setup your development environment for Decidim, see Decidim. Also follow Decidim's general instructions for development for this project as well.
Clone this repository or fork and run:
bundle install
bundle exec rake development_app
If you would like to see this module in your own language, you can help with its translation at Crowdin: