From 0d06f2ee69e7a6cec6dc2cc576561bbbc9ddd10b Mon Sep 17 00:00:00 2001
From: echarp <emmanuel.charpentier@free.fr>
Date: Mon, 13 Oct 2014 22:50:59 +0200
Subject: [PATCH] =?UTF-8?q?=C3=89volution=20de=20la=20page=20pour=20associ?=
 =?UTF-8?q?ation?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/assets/stylesheets/all.css.sass  |  4 ++-
 app/assets/stylesheets/list.css.sass |  3 +-
 app/assets/stylesheets/lugs.sass     | 15 +++++++++
 app/controllers/lugs_controller.rb   |  3 ++
 app/views/lugs/show.html.haml        | 48 +++++++++++++++++++++-------
 5 files changed, 60 insertions(+), 13 deletions(-)

diff --git a/app/assets/stylesheets/all.css.sass b/app/assets/stylesheets/all.css.sass
index f2ff416d5..9fd08b2a4 100644
--- a/app/assets/stylesheets/all.css.sass
+++ b/app/assets/stylesheets/all.css.sass
@@ -2,7 +2,6 @@
 @import font-awesome
 
 *
-  height: auto
   padding: 0
   max-width: 100%
   margin-left: auto
@@ -138,6 +137,9 @@ main, body.mce-content-body
     min-height: 100%
     font-family: georgia, serif
 
+iframe
+  border: none
+
 fieldset
   border: none
   margin: 1em auto
diff --git a/app/assets/stylesheets/list.css.sass b/app/assets/stylesheets/list.css.sass
index 601bc7567..cdb417ace 100644
--- a/app/assets/stylesheets/list.css.sass
+++ b/app/assets/stylesheets/list.css.sass
@@ -30,13 +30,14 @@ dl
     text-align: right
   dd
     padding: 0.2em 1em
-    border-top: 1px solid #999
     text-align: left
     &.quantity
       text-align: right
       padding-right: 16em
     h3
       display: inline
+  dt + dd + dt +dd
+    border-top: 1px solid #999
 
 .view_link:link, .edit_link:link, .delete_link:link
   font-size: 0
diff --git a/app/assets/stylesheets/lugs.sass b/app/assets/stylesheets/lugs.sass
index 15d272bc3..46e6c3cea 100644
--- a/app/assets/stylesheets/lugs.sass
+++ b/app/assets/stylesheets/lugs.sass
@@ -36,3 +36,18 @@ form#lug_search
       color: #2E97FF
     span.label
       display: none
+
+body.lugs.show
+  iframe
+    display: block
+    max-width: 100%
+    margin-bottom: 2em
+    +border-radius(1em)
+
+  dl
+    margin-left: 4%
+    margin-right: 4%
+  dl, fieldset
+    display: inline-block
+    min-width: 30em
+    vertical-align: top
diff --git a/app/controllers/lugs_controller.rb b/app/controllers/lugs_controller.rb
index 2599e76ae..2e0240c87 100644
--- a/app/controllers/lugs_controller.rb
+++ b/app/controllers/lugs_controller.rb
@@ -10,6 +10,9 @@ class LugsController < ApplicationController
 
   def show
     @search = Lug.search params[:q]
+
+    @events_future = Event.moderated.future.tag @lug.name
+    @events_past = Event.moderated.past.tag @lug.name
   end
 
   private
diff --git a/app/views/lugs/show.html.haml b/app/views/lugs/show.html.haml
index aac22bd21..7260c6e43 100644
--- a/app/views/lugs/show.html.haml
+++ b/app/views/lugs/show.html.haml
@@ -1,17 +1,15 @@
 - set_lug_meta
 
+= render 'search'
+
 %h2
-  %em.fa.fa-users
-  = t 'lugs.search.title', entity: Lug.model_name.human
+  = image_tag @lug.url+'/favicon.ico', alt: '', class: :favicon
+  = title @lug.name
 
-= render 'search'
+%iframe(src="#{@lug.url}" width='1000' height='300' frameborder='none'
+  allowTransparency='true')
 
 %dl
-  %dt= Lug.human_attribute_name :name
-  %dd
-    %h3
-      = image_tag @lug.url+'/favicon.ico', alt: '', class: :favicon
-      = title @lug.name
   - if @lug.city.present?
     %dt= Lug.human_attribute_name :city
     %dd= @lug.city
@@ -19,14 +17,42 @@
     %dt= Lug.human_attribute_name :department
     %dd= @lug.department
   - if @lug.related_region.present?
-    %dt= Lug.human_attribute_name :related_region
+    %dt= Lug.human_attribute_name :region
     %dd= @lug.related_region
   - if @lug.url.present?
     %dt= Lug.human_attribute_name :url
     %dd= link_to @lug.url, @lug.url
 
-%iframe(src="#{@lug.url}" width='1000' height='400' frameborder='none'
-  allowTransparency='true')
+- if @events_future.any? || @events_past.any?
+  %fieldset
+    %legend
+      %em.fa.fa-calendar
+      = Event.model_name.human.pluralize
+    %ul
+      - @events_future.order('start_time asc').each do |event|
+        %li
+          = link_to event do
+            - if event.locality?
+              %em.locality.fa.fa-globe(title="#{Event.human_attribute_name :locality} #{t 'attributes.locality_1'}")
+            - else
+              %em.locality.fa.fa-shield(title="#{Event.human_attribute_name :locality} #{t 'attributes.locality_0'}")
+            %em.city= event.city
+            = event.title
+          = display_date event
+
+    %hr
+
+    %ul
+      - @events_past.order('start_time desc').each do |event|
+        %li
+          = link_to event do
+            - if event.locality?
+              %em.locality.fa.fa-globe(title="#{Event.human_attribute_name :locality} #{t 'attributes.locality_1'}")
+            - else
+              %em.locality.fa.fa-shield(title="#{Event.human_attribute_name :locality} #{t 'attributes.locality_0'}")
+            %em.city= event.city
+            = event.title
+          = display_date event
 
 %nav
   = link_to lugs_path(q: params[:q], page: params[:page]), class: :back do
-- 
GitLab