From ded639e2ea863b426a9d54c66667968aae64764d Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Tue, 5 Sep 2023 17:00:51 +0200 Subject: [PATCH] wip --- .../communication/websites/agenda/events_controller.rb | 3 ++- .../communication/websites/agenda/events/_form.html.erb | 8 ++++++++ .../communication/websites/agenda/events/_list.html.erb | 6 +++++- .../communication/websites/agenda/events/show.html.erb | 9 ++++++++- config/locales/communication/en.yml | 6 ++++++ config/locales/communication/fr.yml | 6 ++++++ 6 files changed, 35 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin/communication/websites/agenda/events_controller.rb b/app/controllers/admin/communication/websites/agenda/events_controller.rb index 5dc310089..f17c1a8e5 100644 --- a/app/controllers/admin/communication/websites/agenda/events_controller.rb +++ b/app/controllers/admin/communication/websites/agenda/events_controller.rb @@ -78,7 +78,8 @@ class Admin::Communication::Websites::Agenda::EventsController < Admin::Communic params.require(:communication_website_agenda_event) .permit( :title, :meta_description, :summary, :published, :slug, - :featured_image, :featured_image_delete, :featured_image_infos, :featured_image_alt, :featured_image_credit + :featured_image, :featured_image_delete, :featured_image_infos, :featured_image_alt, :featured_image_credit, + :from_day, :from_hour, :to_day, :to_hour ) .merge( university_id: current_university.id, diff --git a/app/views/admin/communication/websites/agenda/events/_form.html.erb b/app/views/admin/communication/websites/agenda/events/_form.html.erb index 6484195ff..d4240f6e6 100644 --- a/app/views/admin/communication/websites/agenda/events/_form.html.erb +++ b/app/views/admin/communication/websites/agenda/events/_form.html.erb @@ -9,6 +9,14 @@ <%= render 'admin/application/summary/form', f: f, about: event %> <% end %> <div class="row pure__row--small"> + <div class="col-md-6"> + <%= f.input :from_day, html5: true %> + <%= f.input :from_hour, html5: true %> + </div> + <div class="col-md-6"> + <%= f.input :to_day, html5: true %> + <%= f.input :to_hour, html5: true %> + </div> <div class="col-md-6"> <%= render 'admin/application/meta_description/form', f: f, about: event %> </div> diff --git a/app/views/admin/communication/websites/agenda/events/_list.html.erb b/app/views/admin/communication/websites/agenda/events/_list.html.erb index f847a592a..a3624d30e 100644 --- a/app/views/admin/communication/websites/agenda/events/_list.html.erb +++ b/app/views/admin/communication/websites/agenda/events/_list.html.erb @@ -6,7 +6,8 @@ <thead> <tr> <th class="ps-0" style="min-width: 250px"><%= Communication::Website::Agenda::Event.human_attribute_name('title') %></th> - <th><%= Communication::Website::Post.human_attribute_name('featured_image') %></th> + <th><%= Communication::Website::Agenda::Event.human_attribute_name('dates') %></th> + <th><%= Communication::Website::Agenda::Event.human_attribute_name('featured_image') %></th> </tr> </thead> <tbody> @@ -16,6 +17,9 @@ <%= link_to event, admin_communication_website_agenda_event_path(website_id: event.website.id, id: event.id), class: "#{'draft' unless event.published?}" %> + </td> + <td> + </td> <td><%= image_tag event.featured_image.representation(resize: '200x'), width: 100 if event.featured_image.attached? && event.featured_image.representable? %></td> diff --git a/app/views/admin/communication/websites/agenda/events/show.html.erb b/app/views/admin/communication/websites/agenda/events/show.html.erb index 5c323dc3d..b7e6a24ea 100644 --- a/app/views/admin/communication/websites/agenda/events/show.html.erb +++ b/app/views/admin/communication/websites/agenda/events/show.html.erb @@ -5,6 +5,13 @@ <div class="col-lg-7"> <%= osuny_panel Communication::Website::Agenda::Event.human_attribute_name(:title), small: true do %> <p class="lead"><%= @event.title %></p> + <p> + <%= l @event.from_day %> + <%= l @event.from_hour, format: "%H:%M" if @event.from_hour %> + <br> + → <%= l @event.to_day %> + <%= l @event.to_hour, format: "%H:%M" if @event.to_hour %> + </p> <% end %> </div> <div class="offset-lg-1 col-lg-4"> @@ -16,9 +23,9 @@ <hr class="mb-5"> <div class="row"> <div class="col-lg-4"> - <% # TODO i18n après Violenn %> <div class="mb-4"> <%= osuny_label t('metadata') %><br> + <% # TODO i18n après Violenn %> <%= @event.published ? 'Publié' : 'Brouillon' %> <%= render 'admin/application/i18n/inline', about: @event %> </div> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index d552cee70..9515f05fa 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -150,7 +150,13 @@ en: repository: Repository url: URL communication/website/agenda/event: + dates: Dates + featured_image: Featured image + from_day: From day + from_hour: From hour title: Title + to_day: To day + to_hour: To hour communication/website/category: children: Children categories featured_image: Featured image diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 558c9132f..6050bb39c 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -150,7 +150,13 @@ fr: repository: Référentiel url: URL communication/website/agenda/event: + dates: Dates + featured_image: Image à la une + from_day: Jour de début + from_hour: Heure de début title: Titre + to_day: Jour de fin + to_hour: Heure de fin communication/website/category: children: Catégories enfants featured_image: Image à la une -- GitLab