On peut maintenant filtrer pour n'avoir que des evts nationaux

This commit is contained in:
echarp 2014-10-14 10:33:22 +02:00
parent f2f6bcf0cc
commit 0260eb2a09
6 changed files with 23 additions and 5 deletions

View File

@ -26,6 +26,8 @@
&:hover &:hover
background-color: #eee background-color: #eee
+text-shadow(1px 1px 0.2em gray) +text-shadow(1px 1px 0.2em gray)
em.fa-globe
color: red
&:hover ul &:hover ul
display: block display: block

View File

@ -87,8 +87,8 @@ class EventsController < ApplicationController
def set_events def set_events
@events = Event.moderated @events = Event.moderated
@events = @events.region params[:region] \ @events = @events.region params[:region] if params[:region]
if params[:region] && params[:region] != 'all' @events = @events.locality params[:locality] if params[:locality]
@events = @events.tag params[:tag] if params[:tag] @events = @events.tag params[:tag] if params[:tag]
end end

View File

@ -41,7 +41,8 @@ class Event < ActiveRecord::Base
start_date.beginning_of_month.beginning_of_week, start_date.beginning_of_month.beginning_of_week,
start_date.end_of_month.end_of_week.end_of_day start_date.end_of_month.end_of_week.end_of_day
end) end)
scope :region, -> region { where region: region } scope :region, -> region { where region: region unless region == 'all' }
scope :locality, -> locality { where locality: locality }
scope :tag, -> tag { where 'tags like ?', "%#{tag}%" } scope :tag, -> tag { where 'tags like ?', "%#{tag}%" }
scope :geo, -> { where 'latitude is not null and longitude is not null' } scope :geo, -> { where 'latitude is not null and longitude is not null' }

View File

@ -5,6 +5,11 @@
%em.locality.fa.fa-shield %em.locality.fa.fa-shield
= Region.find params[:region] = Region.find params[:region]
%em.fa.fa-chevron-down %em.fa.fa-chevron-down
- elsif params[:locality]
%span.placeholder
%em.locality.fa.fa-globe
=t '.national'
%em.fa.fa-chevron-down
- else - else
%span.placeholder %span.placeholder
%em.locality.fa.fa-globe %em.locality.fa.fa-globe
@ -25,3 +30,11 @@
start_date: params[:start_date], start_date: params[:start_date],
year: params[:year], year: params[:year],
tag: params[:tag] tag: params[:tag]
%li
= link_to locality: 1,
start_date: params[:start_date],
year: params[:year],
tag: params[:tag] do
%em.fa.fa-globe
=t '.national'

View File

@ -117,6 +117,7 @@ it more readable or agreable.
regions: regions:
selector: selector:
all_regions: All regions all_regions: All regions
national: National events
index: index:
title: Feeds title: Feeds
quick: Each feed lists events for the coming 30 days in a given region quick: Each feed lists events for the coming 30 days in a given region

View File

@ -112,10 +112,11 @@ fr:
regions: regions:
selector: selector:
all_regions: Toutes les régions all_regions: Toutes les régions
national: Événements nationaux
index: index:
title: Liste des flux title: Liste des flux
quick: Chaque flux liste les évènements pour les 30 prochains jours en quick: Chaque flux liste les évènements pour les 30 prochains jours dans
cours dans une région donnée une région donnée
help: "Quelques fonctionnalités intéressantes:\n help: "Quelques fonctionnalités intéressantes:\n
\n \n
* Vous pouvez limiter les évènements à un certain tag, en passant le * Vous pouvez limiter les évènements à un certain tag, en passant le