Skip to content
Snippets Groups Projects
Commit 58d6c70a authored by Arnaud Levy's avatar Arnaud Levy
Browse files

wip

parent 44e11197
No related branches found
No related tags found
No related merge requests found
......@@ -62,6 +62,34 @@ class Communication::Website::Agenda::Event < ApplicationRecord
validates_presence_of :from_day
STATUS_FUTURE = 'future'
STATUS_PRESENT = 'present'
STATUS_ARCHIVE = 'archive'
def status
if future?
STATUS_FUTURE
elsif present?
STATUS_PRESENT
else
STATUS_ARCHIVE
end
end
def future?
from_day > Date.today
end
def present?
to_day.present? ? (from_day >= Date.today && to_day <= Date.today)
: from_day == Date.today
end
def archive?
to_day.present? ? to_day < Date.today
: from_day < Date.today
end
def git_path(website)
return unless website.id == communication_website_id && published
"#{git_path_content_prefix(website)}events/#{from_day.year}/#{from_day.strftime "%Y-%m-%d"}-#{slug}.html"
......
---
title: "<%= @about.title %>"
dates:
status: "<%= @about.status %>"
archive: <%= @about.archive? %>
computed:
short: "Du 14 au 16 juin 2023"
long: "Du mercredi 14 au vendredi 16 juin 2023"
from:
day: <%= @about.from_day %>
<% if @about.from_hour %>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment