From 8ab5b615d9369bce54c6d7b87930bc982c3e6ec6 Mon Sep 17 00:00:00 2001 From: echarp Date: Sat, 4 Jan 2020 12:42:37 +0100 Subject: [PATCH] Event's meta data presented as a dictionnary list --- app/assets/stylesheets/list.sass | 6 +--- app/assets/stylesheets/stats.sass | 11 ++++-- app/views/events/_event.haml | 2 +- app/views/events/show.html.haml | 45 +++++++++++++----------- app/views/moderations/validate.html.haml | 2 +- app/views/orgas/show.html.haml | 11 +++--- 6 files changed, 41 insertions(+), 36 deletions(-) diff --git a/app/assets/stylesheets/list.sass b/app/assets/stylesheets/list.sass index 32affa9c..e3c5e98d 100644 --- a/app/assets/stylesheets/list.sass +++ b/app/assets/stylesheets/list.sass @@ -24,13 +24,11 @@ table text-align: center dl - width: 40em - margin: 1em auto dt clear: left float: left padding: 0.2em 1em - min-width: 50% + min-width: 12em text-align: right dd padding: 0.2em 1em @@ -39,8 +37,6 @@ dl padding-right: 16em h3 display: inline - dt + dd + dt +dd - border-top: 1px solid #999 ul.counters text-align: center diff --git a/app/assets/stylesheets/stats.sass b/app/assets/stylesheets/stats.sass index 803b1bee..3ea8f323 100644 --- a/app/assets/stylesheets/stats.sass +++ b/app/assets/stylesheets/stats.sass @@ -1,5 +1,12 @@ -body.stats h3 - text-align: center +body.stats + h3 + text-align: center + dl + width: 40em + dt + min-width: 50% + dt + dd + dt +dd + border-top: 1px solid #999 table.list.dates width: 100% diff --git a/app/views/events/_event.haml b/app/views/events/_event.haml index 39940796..d57dc7a3 100644 --- a/app/views/events/_event.haml +++ b/app/views/events/_event.haml @@ -5,4 +5,4 @@ %strong.city{ title: event.address }= event.city = event.title - if event.repeat&.positive? - %em.fa.fa-repeat{ title: event.schedule } + %em.fa.fa-redo-alt{ title: event.schedule } diff --git a/app/views/events/show.html.haml b/app/views/events/show.html.haml index 87545ec0..bced36f3 100644 --- a/app/views/events/show.html.haml +++ b/app/views/events/show.html.haml @@ -33,7 +33,7 @@ %em = t '.noMap' %a{ target: '_blank', - href: 'https://osm.org/search?query=' + @event.full_address } + href: "https://osm.org/search?query=#{@event.full_address}" } = image_tag 'osm_logo.svg', alt: 'OSM logo', width: '32px' .description @@ -44,29 +44,32 @@ %h3 %em.fa.fa-info-circle = t '.infos' -- if @event.url.present? - %p - %em.fa.fa-external-link-alt - %span.label= Event.human_attribute_name :url - = link_to @event.url, @event.url -- if @event.contact.present? - %p - %em.fa.fa-envelope - %span.label= Event.human_attribute_name :contact - = mail_to @event.contact, nil, - encode: (request.format == 'text/html' ? :javascript : nil), - replace_at: ' CHEZ ', replace_dot: ' POINT ' - -- if @event.tags&.present? - %p.tags - %em.fa.fa-tags - %span.label= Event.human_attribute_name :tags - - @event.tags.each do |tag| - = link_to tag, tag_path(tag.name), rel: :tag +%dl + - if @event.url.present? + %dt.url + %em.fa.fa-external-link-alt + = Event.human_attribute_name :url + %dd + = link_to @event.url, @event.url + - if @event.contact.present? + %dt.contact + %em.fa.fa-envelope + = Event.human_attribute_name :contact + %dd + = mail_to @event.contact, nil, + encode: (request.format == 'text/html' ? :javascript : nil), + replace_at: ' CHEZ ', replace_dot: ' POINT ' + - if @event.tags&.any? + %dt.tags + %em.fa.fa-tags + = Event.human_attribute_name :tags + %dd + - @event.tags.each do |tag| + = link_to tag, tag_path(tag.name), rel: :tag - if @event.repeat&.positive? && @event.rule %h3 - %em.fa.fa-repeat + %em.fa.fa-redo-alt = @event.schedule - if @event.moderated? diff --git a/app/views/moderations/validate.html.haml b/app/views/moderations/validate.html.haml index 199f9164..bf872e8e 100644 --- a/app/views/moderations/validate.html.haml +++ b/app/views/moderations/validate.html.haml @@ -28,7 +28,7 @@ - if @event.repeat.positive? %fieldset %legend - %em.fa.fa-repeat + %em.fa.fa-redo-alt = Event.human_attribute_name :repeat %h3= t '.repeat_helper', count: @event.repeat diff --git a/app/views/orgas/show.html.haml b/app/views/orgas/show.html.haml index e60537b9..bfef45a2 100644 --- a/app/views/orgas/show.html.haml +++ b/app/views/orgas/show.html.haml @@ -29,11 +29,10 @@ tags: %w[p h1 h2 h3 h4 br table tr th td ul ol li a strong b em i img sub sup span], attributes: %w[href src width height style title] +%h3 + %em.fa.fa-info-circle + = t '.infos' %dl - %dd - %h3 - %em.fa.fa-info-circle - = t '.infos' - if @orga.department.present? %dt.department %em.fa.fa-puzzle-piece @@ -61,7 +60,7 @@ %dd= mail_to @orga.contact, nil, encode: (request.format == 'text/html' ? :javascript : nil), replace_at: ' CHEZ ', replace_dot: ' POINT ' - - if @orga.tags.any? + - if @orga.tags&.any? %dt.tags %em.fa.fa-tags = Event.human_attribute_name :tags @@ -78,7 +77,7 @@ = Orga.human_attribute_name :updated_at %dd= l @orga.updated_at.to_date, format: :long - - if @events_future && @events_future.any? + - if @events_future&.any? %dt.future %em.fa.fa-forward = t '.future'