From e913c28f6605e1c2e490bb5da5b0cc7edd665365 Mon Sep 17 00:00:00 2001 From: echarp Date: Sat, 14 Jul 2018 21:56:39 +0200 Subject: [PATCH] Slight partial reorganisation for events' aside --- app/views/events/_aside.html.haml | 47 ++++++++++++++++++++++++ app/views/events/index.html.haml | 2 +- app/views/events/show.html.haml | 49 +------------------------ app/views/layouts/application.html.haml | 5 +-- config/locales/views/en.yml | 4 +- config/locales/views/fr.yml | 4 +- config/locales/views/pt-BR.yml | 4 +- 7 files changed, 60 insertions(+), 55 deletions(-) create mode 100644 app/views/events/_aside.html.haml diff --git a/app/views/events/_aside.html.haml b/app/views/events/_aside.html.haml new file mode 100644 index 00000000..f9810beb --- /dev/null +++ b/app/views/events/_aside.html.haml @@ -0,0 +1,47 @@ +%aside#orga-list + - if @event.region.present? && @event.region.orgas.present? + %h1{ title: @event.region } + = link_to orgas_path region: @event.region do + %em.fa.fa-users + = t '.orga-list' + %ul.fa-ul + - @event.region.orgas.select(&:active).each do |orga| + %li + = link_to orga do + - if orga.kind + %em.fa.fa-li{ class: "fa-#{orga.kind.icon}", + title: Kind.human_attribute_name("name_#{orga.kind.name}") } + = orga.name + = image_tag orga.url + '/favicon.ico', alt: '', class: :favicon + + %h1 + %em.fa.fa-wrench + = t '.actions' + %h2 + = link_to event_path @event, protocol: :webcal, format: :ics do + %em.fa.fa-lg.fa-calendar + = t '.add_to_calendar' + %h2 + = link_to preview_events_path(event: { title: @event.title, + start_time: @event.start_time + 1.month, + end_time: @event.end_time + 1.month, + description: @event.description, + place_name: @event.place_name, + address: @event.address, + city: @event.city, + region_id: @event.region.id, + locality: @event.locality, + url: @event.url, + tag_list: @event.tag_list.to_s }), + method: :post do + %em.fa.fa-copy + = t '.copy' + - if user_signed_in? + %h2 + = link_to edit_moderation_path @event do + %em.fa.fa-lg.fa-edit + = t '.edit' + %h2 + = link_to cancel_event_path @event, secret: @event.secret do + %em.fa.fa-lg.fa-thumbs-down + = t '.cancel' diff --git a/app/views/events/index.html.haml b/app/views/events/index.html.haml index 29d236fd..08b34f71 100644 --- a/app/views/events/index.html.haml +++ b/app/views/events/index.html.haml @@ -31,7 +31,7 @@ = month_calendar events: @events do |date, events| - capture_haml do .day_number= date.day - %ul.events.fa-ul= render events + %ul.events.fa-ul= render events, cached: true .links = raw t '.calendar_in', diff --git a/app/views/events/show.html.haml b/app/views/events/show.html.haml index e41c39f2..34c8a43f 100644 --- a/app/views/events/show.html.haml +++ b/app/views/events/show.html.haml @@ -14,54 +14,7 @@ %em.city{ title: @event.full_address }= @event.city = title @event.title -- if controller.controller_name == 'events' && controller.action_name == 'show' - %aside#orga-list - - if @event.region.present? && @event.region.orgas.present? - %h1{ title: @event.region } - = link_to orgas_path region: @event.region do - %em.fa.fa-users - = t '.orga-list' - %ul.fa-ul - - @event.region.orgas.select(&:active).each do |orga| - %li - = link_to orga do - - if orga.kind - %em.fa.fa-li{ class: "fa-#{orga.kind.icon}", - title: Kind.human_attribute_name("name_#{orga.kind.name}") } - = orga.name - = image_tag orga.url + '/favicon.ico', alt: '', class: :favicon - - %h1 - %em.fa.fa-wrench - = t '.actions' - %h2 - = link_to event_path @event, protocol: :webcal, format: :ics do - %em.fa.fa-lg.fa-calendar - = t '.add_to_calendar' - %h2 - = link_to preview_events_path(event: { title: @event.title, - start_time: @event.start_time + 1.month, - end_time: @event.end_time + 1.month, - description: @event.description, - place_name: @event.place_name, - address: @event.address, - city: @event.city, - region_id: @event.region.id, - locality: @event.locality, - url: @event.url, - tag_list: @event.tag_list.to_s }), - method: :post do - %em.fa.fa-copy - = t '.copy' - - if user_signed_in? - %h2 - = link_to edit_moderation_path @event do - %em.fa.fa-lg.fa-edit - = t '.edit' - %h2 - = link_to cancel_event_path @event, secret: @event.secret do - %em.fa.fa-lg.fa-thumbs-down - = t '.cancel' += render 'aside' if [controller_name, action_name] == %w[events show] %h3= t '.dateAndPlace' diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index a34187d2..473ed5a7 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -17,9 +17,8 @@ type: 'text/javascript', defer: true, async: Rails.env.production? = csrf_meta_tags - - classes = [request.domain ? request.domain.split('.')[0] : '', - controller.controller_name, controller.action_name] - %body{ class: classes } + - sub = request.domain ? request.domain.split('.')[0] : '' + %body{ class: [sub, controller_name, action_name] } %header.top - cache "regions_filter_#{session[:region]}" do = render '/regions/filter' diff --git a/config/locales/views/en.yml b/config/locales/views/en.yml index 51772245..a5e8caea 100644 --- a/config/locales/views/en.yml +++ b/config/locales/views/en.yml @@ -43,6 +43,7 @@ en: test other syntaxes here description: Description infos: Informations + aside: actions: Actions edit: Edit event cancel: Cancel event @@ -245,11 +246,12 @@ description." index: title: Organisations new: Add an organisation - show: + aside: links: See also actions: Actions edit: Edit cancel: Delete + show: future: Coming past: In the past count: diff --git a/config/locales/views/fr.yml b/config/locales/views/fr.yml index a8a41da3..c3f36bb5 100644 --- a/config/locales/views/fr.yml +++ b/config/locales/views/fr.yml @@ -43,6 +43,7 @@ fr: tester d'autres syntaxes ici description: Description infos: Informations + aside: actions: Actions edit: Éditer événement cancel: Annuler événement @@ -262,11 +263,12 @@ description plus complète." index: title: Organisations new: Ajouter une organisation - show: + aside: links: Voir aussi actions: Actions edit: Éditer cancel: Supprimer + show: future: Prochainement past: Dans le passé count: diff --git a/config/locales/views/pt-BR.yml b/config/locales/views/pt-BR.yml index 0c4809eb..36546f05 100644 --- a/config/locales/views/pt-BR.yml +++ b/config/locales/views/pt-BR.yml @@ -43,6 +43,7 @@ pt-BR: Você pode testar outras sintaxes aqui description: Descrição infos: Informações + aside: actions: Ações edit: Editar evento cancel: Cancelar evento @@ -246,11 +247,12 @@ descrição mais completa." index: title: Organizações new: Adicione uma organização - show: + aside: links: Veja também actions: Ações edit: Editar cancel: Excluir + show: future: A realizar past: Realizado count: