From 4320902f068b34d465a7d88ef817489da81fe1ff Mon Sep 17 00:00:00 2001 From: echarp Date: Sat, 26 Jul 2014 18:27:19 +0200 Subject: [PATCH] Meilleur affichage des stats --- app/assets/stylesheets/_awesome_mixins.scss | 42 +++++++++++++++++++++ app/assets/stylesheets/all.css.sass | 3 +- app/assets/stylesheets/application.css.sass | 15 +++++++- app/assets/stylesheets/list.css.sass | 34 ++++++++++++----- app/assets/stylesheets/moderations.css.sass | 4 +- app/assets/stylesheets/region.css.sass | 10 ++--- app/controllers/regions_controller.rb | 4 +- app/views/regions/stats.html.haml | 34 +++++++---------- config/locales/fr.yml | 13 +++++-- config/routes.rb | 5 +-- 10 files changed, 113 insertions(+), 51 deletions(-) create mode 100644 app/assets/stylesheets/_awesome_mixins.scss diff --git a/app/assets/stylesheets/_awesome_mixins.scss b/app/assets/stylesheets/_awesome_mixins.scss new file mode 100644 index 00000000..9de5bbe2 --- /dev/null +++ b/app/assets/stylesheets/_awesome_mixins.scss @@ -0,0 +1,42 @@ +// Mixins +// -------------------------- + +@mixin fa-icon-rotate($degrees, $rotation) { + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation}); + -webkit-transform: rotate($degrees); + -moz-transform: rotate($degrees); + -ms-transform: rotate($degrees); + -o-transform: rotate($degrees); + transform: rotate($degrees); +} + +@mixin fa-icon-flip($horiz, $vert, $rotation) { + filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation}); + -webkit-transform: scale($horiz, $vert); + -moz-transform: scale($horiz, $vert); + -ms-transform: scale($horiz, $vert); + -o-transform: scale($horiz, $vert); + transform: scale($horiz, $vert); +} + +@mixin fa-icon-base() { + &:before { + display: inline-block; + font-family: FontAwesome; + font-style: normal; + font-weight: normal; + line-height: 1; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + margin-right: 5px; + } +} + +@mixin fa-icon($icon-char) { + @include fa-icon-base(); + &:before { + @if($icon-char != null) { + content: $icon-char; + } + } +} diff --git a/app/assets/stylesheets/all.css.sass b/app/assets/stylesheets/all.css.sass index 17f097d0..d1e51e40 100644 --- a/app/assets/stylesheets/all.css.sass +++ b/app/assets/stylesheets/all.css.sass @@ -112,7 +112,8 @@ main margin-left: 2em line-height: 1.3em p - margin: 0.95em 0 + margin: 0.95em auto + max-width: 80em text-align: justify line-height: 1.3em &.label diff --git a/app/assets/stylesheets/application.css.sass b/app/assets/stylesheets/application.css.sass index 146e6c98..52e6fcdd 100644 --- a/app/assets/stylesheets/application.css.sass +++ b/app/assets/stylesheets/application.css.sass @@ -14,6 +14,17 @@ *= require_self */ -body.application.infos - h4 +@import 'awesome_mixins' + +body.application + &.infos h4 text-align: left + + &.infos main h2:first-child + @include fa-icon('') + + &.contact main h2:first-child + @include fa-icon('') + + &.rules main h2:first-child + @include fa-icon('') diff --git a/app/assets/stylesheets/list.css.sass b/app/assets/stylesheets/list.css.sass index cffc7d7b..0a813c9d 100644 --- a/app/assets/stylesheets/list.css.sass +++ b/app/assets/stylesheets/list.css.sass @@ -1,20 +1,34 @@ @import "compass" table - margin: auto + margin: 1em auto border-spacing: 2px th padding: 0.3em 0.6em -table.list - tr:nth-child(odd) - background-color: #D1EAFF - tr:nth-child(even) - background-color: #C9E2F5 - td - padding: 0.2em - &.quantity - text-align: right + &.list + tr:nth-child(odd) + background-color: #D1EAFF + tr:nth-child(even) + background-color: #C9E2F5 + th + font-size: larger + td + padding: 0.2em + &.quantity + text-align: right + +dl + margin: 1em auto + max-width: 40em + dt + float: left + padding: 0.2em 1em + .quantity + text-align: right + dd + padding: 0.2em 1em + border-top: 1px solid #999 .view_link:link, .edit_link:link, .delete_link:link font-size: 0 diff --git a/app/assets/stylesheets/moderations.css.sass b/app/assets/stylesheets/moderations.css.sass index 81c36afa..3fcbf8a5 100644 --- a/app/assets/stylesheets/moderations.css.sass +++ b/app/assets/stylesheets/moderations.css.sass @@ -3,7 +3,7 @@ h2.warning .events.edit, .events.update, .events.cancel, .moderations, .notes table.list - width: 100% + min-width: 90% margin-top: 15px thead tr background-color: transparent @@ -30,6 +30,8 @@ h2.warning th.actions padding: 0 a + padding: 0.2em + display: inline-block font-weight: normal main > h3 diff --git a/app/assets/stylesheets/region.css.sass b/app/assets/stylesheets/region.css.sass index d7cec60c..577305d4 100644 --- a/app/assets/stylesheets/region.css.sass +++ b/app/assets/stylesheets/region.css.sass @@ -1,7 +1,3 @@ -.regions.stats - table.list - margin: 1em 0 - min-width: 60% - text-align: left - td.item - width: 90% +body.stats + h3 + text-align: center diff --git a/app/controllers/regions_controller.rb b/app/controllers/regions_controller.rb index 80ac36aa..770ffd85 100644 --- a/app/controllers/regions_controller.rb +++ b/app/controllers/regions_controller.rb @@ -5,8 +5,8 @@ class RegionsController < InheritedResources::Base @city_events = Event.group(:city).having('count(city) > 3').order('count(city) desc').count(:city) @month_events = Event - .group('extract(year from start_time)') - .group('extract(month from start_time)') + .group('strftime("%Y", start_time)') + .group('strftime("%m", start_time)') .count() end end diff --git a/app/views/regions/stats.html.haml b/app/views/regions/stats.html.haml index fa741c8d..42d3e288 100644 --- a/app/views/regions/stats.html.haml +++ b/app/views/regions/stats.html.haml @@ -2,41 +2,35 @@ %em.fa.fa-signal = title t '.title' -%h3=t '.general' +%dl + %dt=t '.all' + %dd.quantity= Event.count() -%table.list - %tr - %td.item=t '.all' - %td.quantity= Event.count() - %tr - %td.item=t '.allModeration' - %td.quantity= Event.unscoped.where(moderated: 0).count() + %dt=t '.allModeration' + %dd.quantity= Event.unscoped.where(moderated: 0).count() %h3=t '.regional' -%table.list +%dl - @region_events.each do |region| - %tr - %td.item= region[0] - %td.quantity= region[1] + %dt.item= region[0] + %dd.quantity= region[1] %h3=t '.city' %p=t '.city_conditions' -%table.list +%dl - @city_events.each do |city| - %tr - %td.item= city[0] - %td.quantity= city[1] + %dt.item= city[0] + %dd.quantity= city[1] %h3=t '.dates' -%table.list +%dl - @month_events.each do |month| - %tr - %td.item= l(Date.new(month[0][0], month[0][1]), format: :month).capitalize - %td.quantity= month[1] + %dt.item= l(Date.new(month[0][0].to_i, month[0][1].to_i), format: :month).capitalize + %dd.quantity= month[1] %h3=t '.web' diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 2b530da7..8755bc88 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -163,13 +163,12 @@ Exemple: `%{tag}`\n Exemple: `%{daylimit}`" stats: title: Statistiques - general: Statistiques générales all: Nombre d'événements validés depuis la création de l'Agenda allModeration: Nombre d'événements en cours de modération - regional: Statistiques par région - city: Statistiques par ville + regional: Par région + city: Par ville city_conditions: Seules les villes où plus de trois événements ont été organisés sont mentionnées. - dates: Statistiques par date + dates: Par date web: Statistiques Web webalizer: Des statistiques Web générées par Webalizer [sont disponibles](http://agendadulibre.org/stats/). Elles sont protégées par le login *stats*, mot de passe *Cuntipshaf6* pour éviter le *spam de referers* tags: @@ -244,12 +243,18 @@ Exemple: `%{daylimit}`" users: sign_in: title: Identification + lugs: + index: + title: Groupes d'Utilisateurs de Logiciels Libres + show: + title: Groupe d'Utilisateurs de Logiciels Libres devise: sessions: new: title: Identification sign_in: Identifier + event_mailer: create: subject: "[Agenda du Libre] Votre événement: '%{subject}' est en attente de modération" diff --git a/config/routes.rb b/config/routes.rb index e4f62bbe..8227969b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,8 +1,4 @@ Rails.application.routes.draw do - get 'maps/index' - - get 'map/index' - get 'application/infos' get 'application/contact' get 'application/rules' @@ -21,6 +17,7 @@ Rails.application.routes.draw do end resources :tags, only: [ :index, :show ] resources :maps, only: [:index] + resources :lugs, only: [:index, :show] # Manage former php pages get 'showevent.php', to: redirect { |params, request| "events/#{request.params[:id]}" }