From 1973b3c41e66328d236a974663b2b8028042e6db Mon Sep 17 00:00:00 2001 From: echarp Date: Wed, 29 Oct 2014 11:42:07 +0100 Subject: [PATCH] Changements des pages pour les tags et assos, qui incluent maintenant une carte --- Gemfile | 2 +- Gemfile.lock | 30 +++++------ app/assets/javascripts/maps.js.coffee | 16 +++++- app/assets/stylesheets/all.css.sass | 3 ++ app/assets/stylesheets/lugs.css.sass | 15 ++---- app/assets/stylesheets/maps.css.sass | 12 ++--- app/views/lugs/show.html.haml | 78 +++++++++++++++++---------- app/views/tags/show.html.haml | 76 +++++++++++++++++--------- config/locales/views/en.yml | 16 +++--- config/locales/views/fr.yml | 16 +++--- 10 files changed, 159 insertions(+), 105 deletions(-) diff --git a/Gemfile b/Gemfile index 9922461b..05a0a1e5 100644 --- a/Gemfile +++ b/Gemfile @@ -70,7 +70,7 @@ gem 'actionview-encoded_mail_to' gem 'differ' # A generic library to administrate the tool -gem 'activeadmin', github: 'gregbell/active_admin' +gem 'activeadmin', github: 'activeadmin' # A nicer markdown editor in active admin gem 'activeadmin_pagedown' diff --git a/Gemfile.lock b/Gemfile.lock index e5c05966..805d72b3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,14 +1,6 @@ GIT - remote: git://github.com/cubus/jquery-sparkline-rails.git - revision: 5c2ced0fa68e5e099bec82b67bdf71f9d865da8a - specs: - jquery-sparkline-rails (2.1.1) - jquery-rails - rails (>= 3.2.2) - -GIT - remote: git://github.com/gregbell/active_admin.git - revision: 944af76ace89f941a7baa92775854d2e1d0e6dba + remote: git://github.com/activeadmin/activeadmin.git + revision: 0becbef0918a38b91ad120aba7c2f6641e9b5440 specs: activeadmin (1.0.0.pre) arbre (~> 1.0, >= 1.0.2) @@ -24,6 +16,14 @@ GIT ransack (~> 1.3) sass-rails +GIT + remote: git://github.com/cubus/jquery-sparkline-rails.git + revision: 5c2ced0fa68e5e099bec82b67bdf71f9d865da8a + specs: + jquery-sparkline-rails (2.1.1) + jquery-rails + rails (>= 3.2.2) + GIT remote: git://github.com/svenfuchs/i18n-active_record.git revision: 2d9a22b6a4e5d809782cdbfa65b14d9e47aa27fc @@ -150,7 +150,7 @@ GEM actionpack (>= 3.2.13) formtastic_i18n (0.1.1) geocoder (1.2.5) - guard (2.6.1) + guard (2.7.0) formatador (>= 0.2.4) listen (~> 2.7) lumberjack (~> 1.0) @@ -232,7 +232,7 @@ GEM mysql2 (0.3.16) naught (1.0.0) orm_adapter (0.5.0) - parser (2.2.0.pre.5) + parser (2.2.0.pre.6) ast (>= 1.1, < 3.0) slop (~> 3.4, >= 3.4.5) polyamorous (1.1.0) @@ -267,7 +267,7 @@ GEM thor (>= 0.18.1, < 2.0) rainbow (2.0.0) rake (10.3.2) - ransack (1.4.1) + ransack (1.5.0) actionpack (>= 3.0) activerecord (>= 3.0) activesupport (>= 3.0) @@ -329,7 +329,7 @@ GEM activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) sqlite3 (1.3.9) - temple (0.6.9) + temple (0.6.10) terminal-table (1.4.5) therubyracer (0.12.1) libv8 (~> 3.16.14.0) @@ -343,7 +343,7 @@ GEM railties (>= 3.1.1) tinymce-rails-langs (4.20140129) tinymce-rails (~> 4.0) - turbolinks (2.4.0) + turbolinks (2.5.1) coffee-rails twitter (5.11.0) addressable (~> 2.3) diff --git a/app/assets/javascripts/maps.js.coffee b/app/assets/javascripts/maps.js.coffee index c5899323..09cc2b89 100644 --- a/app/assets/javascripts/maps.js.coffee +++ b/app/assets/javascripts/maps.js.coffee @@ -6,7 +6,13 @@ $(document).ready -> attribution: '© OpenStreetMap' ).addTo map - $.getJSON $(this).data('url') + location.search, (json) -> + url = $(this).data 'url' + if location.search && url.indexOf '?' + url += '&' + location.search.substr 1 + else + url += location.search + + $.getJSON url, (json) -> layer = L.geoJson json, onEachFeature: (feature, layer) -> # Does this feature have a property named popupContent? @@ -30,7 +36,13 @@ $(document).ready -> attribution: '© OpenStreetMap' ).addTo map - $.getJSON $(this).data('url') + location.search, (json) -> + url = $(this).data 'url' + if location.search && url.indexOf '?' + url += '&' + location.search.substr 1 + else + url += location.search + + $.getJSON url, (json) -> layer = L.geoJson json, onEachFeature: (feature, layer) -> # Does this feature have a property named popupContent? diff --git a/app/assets/stylesheets/all.css.sass b/app/assets/stylesheets/all.css.sass index 8084db9e..e64911db 100644 --- a/app/assets/stylesheets/all.css.sass +++ b/app/assets/stylesheets/all.css.sass @@ -139,6 +139,9 @@ main, body.mce-content-body iframe border: none + max-width: 100% + margin-bottom: 1.6em + +border-radius(1em) fieldset border: none diff --git a/app/assets/stylesheets/lugs.css.sass b/app/assets/stylesheets/lugs.css.sass index 46e6c3ce..f0d29eb6 100644 --- a/app/assets/stylesheets/lugs.css.sass +++ b/app/assets/stylesheets/lugs.css.sass @@ -29,6 +29,8 @@ form#lug_search color: #258 border: none padding: 0 + margin-top: -0.1em + margin-left: 0 vertical-align: middle background-color: transparent +box-shadow(none) @@ -37,17 +39,8 @@ form#lug_search 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 +body.show + dl, iframe, fieldset display: inline-block min-width: 30em vertical-align: top diff --git a/app/assets/stylesheets/maps.css.sass b/app/assets/stylesheets/maps.css.sass index 1044cd7a..6710d0d5 100644 --- a/app/assets/stylesheets/maps.css.sass +++ b/app/assets/stylesheets/maps.css.sass @@ -14,9 +14,9 @@ &.event height: 20em -.tags #map - float: right - width: 30% - height: 30em - margin-left: 2% - margin-right: 18% +.tags, .lugs + #map + width: 40% + height: 60em + margin: 1.6em 2% + display: inline-block diff --git a/app/views/lugs/show.html.haml b/app/views/lugs/show.html.haml index 7e592c67..0a6c1be5 100644 --- a/app/views/lugs/show.html.haml +++ b/app/views/lugs/show.html.haml @@ -6,8 +6,22 @@ = image_tag @lug.url+'/favicon.ico', alt: '', class: :favicon = title @lug.name -%iframe(src="#{@lug.url}" width='1280' height='300' frameborder='none' - allowTransparency='true') +%nav + = link_to lugs_path(q: params[:q], page: params[:page]), class: :back do + %em.fa.fa-arrow-left + = Lug.model_name.human.pluralize + \/ + = link_to events_url format: :rss, tag: @lug.name do + %em.fa.fa-rss + rss + \/ + = link_to events_url format: :ics, tag: @lug.name do + %em.fa.fa-th-list + ical + \/ + = link_to maps_url format: :json, tag: @lug.name do + %em.fa.fa-map-marker + geojson %dl - if @lug.city.present? @@ -23,38 +37,44 @@ %dt= Lug.human_attribute_name :url %dd= link_to @lug.url, @lug.url +%iframe(src="#{@lug.url}" width='1280' height='300' 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 + - if @events_future.any? + %h3=raw t 'future', count: @events_future.count + %ul.fa-ul + - @events_future.order('start_time asc').each do |event| + %li + = link_to event do + - if event.locality? + %em.locality.fa-li.fa.fa-globe(title="#{Event.human_attribute_name :locality} #{t 'attributes.locality_1'}") + - else + %em.locality.fa-li.fa.fa-shield(title="#{Event.human_attribute_name :locality} #{t 'attributes.locality_0'}") + %em.city= event.city + = event.title + %br/ + = display_date event - %hr + %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 + - if @events_past.any? + %h3=raw t 'past', count: @events_past.count + %ul.fa-ul + - @events_past.order('start_time desc').each do |event| + %li + = link_to event do + - if event.locality? + %em.locality.fa-li.fa.fa-globe(title="#{Event.human_attribute_name :locality} #{t 'attributes.locality_1'}") + - else + %em.locality.fa-li.fa.fa-shield(title="#{Event.human_attribute_name :locality} #{t 'attributes.locality_0'}") + %em.city= event.city + = event.title + %br/ + = display_date event -%nav - = link_to lugs_path(q: params[:q], page: params[:page]), class: :back do - %em.fa.fa-arrow-left - = Lug.model_name.human.pluralize +#map.events(data-url="#{maps_path format: :json, tag: @lug.name}") diff --git a/app/views/tags/show.html.haml b/app/views/tags/show.html.haml index 4784444e..74228f0c 100644 --- a/app/views/tags/show.html.haml +++ b/app/views/tags/show.html.haml @@ -4,30 +4,56 @@ %em= params[:id] » -= link_to :rss, events_url(format: :rss, tag: params[:id]) -\/ -= link_to :ical, events_url(format: :ics, tag: params[:id]) +%nav + = link_to tags_path, class: :back do + %em.fa.fa-arrow-left + = Event.human_attribute_name(:tag).pluralize + \/ + = link_to events_url format: :rss, tag: params[:id] do + %em.fa.fa-rss + rss + \/ + = link_to events_url format: :ics, tag: params[:id] do + %em.fa.fa-th-list + ical + \/ + = link_to maps_url format: :json, tag: params[:id] do + %em.fa.fa-map-marker + geojson + +- if @events_future.any? || @events_past.any? + %fieldset + %legend + %em.fa.fa-calendar + = Event.model_name.human.pluralize + - if @events_future.any? + %h3=raw t 'future', count: @events_future.count + %ul.fa-ul + - @events_future.order('start_time asc').each do |event| + %li + - if event.locality? + %em.locality.fa-li.fa.fa-globe(title="#{Event.human_attribute_name :locality} #{t 'attributes.locality_1'}") + - else + %em.locality.fa-li.fa.fa-shield(title="#{Event.human_attribute_name :locality} #{t 'attributes.locality_0'}") + = link_to event do + %em.city= event.city + = event.title + %br/ + = display_date event + + - if @events_past.any? + %h3=raw t 'past', count: @events_past.count + %ul.fa-ul + - @events_past.order('start_time desc').each do |event| + %li + - if event.locality? + %em.locality.fa-li.fa.fa-globe(title="#{Event.human_attribute_name :locality} #{t 'attributes.locality_1'}") + - else + %em.locality.fa-li.fa.fa-shield(title="#{Event.human_attribute_name :locality} #{t 'attributes.locality_0'}") + = link_to event do + %em.city= event.city + = event.title + %br/ + = display_date event #map.events(data-url="#{maps_path format: :json, tag: params[:id]}") - -- if @events_future.any? - %p=raw t '.future', count: @events_future.count - %ul - - @events_future.order('start_time asc').each do |event| - %li - %div - = link_to event do - %em.city= event.city - = event.title - = display_date event - -- if @events_past.any? - %p=raw t '.past', count: @events_past.count - %ul - - @events_past.order('start_time desc').each do |event| - %li - %div - = link_to event do - %em.city= event.city - = event.title - = display_date event diff --git a/config/locales/views/en.yml b/config/locales/views/en.yml index aa92a24d..dee0807f 100644 --- a/config/locales/views/en.yml +++ b/config/locales/views/en.yml @@ -9,6 +9,14 @@ en: logout: Disconnect staleObjectError: Sorry, your modification was rejected because someone else already intervened + future: + zero: + one: "In the future, %{count} event:" + other: "In the future, %{count} evens:" + past: + zero: + one: "In the past, %{count} event:" + other: "In the past, %{count} events:" # Translatings screens layouts: @@ -150,14 +158,6 @@ it more readable or agreable. limited: Only tags on more than three events are displayed in this list show: title: Events - future: - zero: - one: "In the future, %{count} event:" - other: "In the future, %{count} evens:" - past: - zero: - one: "In the past, %{count} event:" - other: "In the past, %{count} events:" moderations: index: title: Events to moderate diff --git a/config/locales/views/fr.yml b/config/locales/views/fr.yml index ba60955b..f8cadfa4 100644 --- a/config/locales/views/fr.yml +++ b/config/locales/views/fr.yml @@ -9,6 +9,14 @@ fr: logout: Se déconnecter staleObjectError: Désolé, votre modification est rejetée car une autre personne est déjà intervenue + future: + zero: + one: "Prochainement, %{count} événement:" + other: "Prochainement, %{count} événements:" + past: + zero: + one: "Dans le passé, %{count} événement:" + other: "Dans le passé, %{count} événements:" # Traductions des écrans layouts: @@ -150,14 +158,6 @@ fr: affichés dans cette liste show: title: Les événements - future: - zero: - one: "Prochainement, %{count} événement:" - other: "Prochainement, %{count} événements:" - past: - zero: - one: "Dans le passé, %{count} événement:" - other: "Dans le passé, %{count} événements:" moderations: index: title: Événements à modérer