On peut maintenant filtrer pour n'avoir que des evts nationaux
This commit is contained in:
parent
f2f6bcf0cc
commit
0260eb2a09
@ -26,6 +26,8 @@
|
||||
&:hover
|
||||
background-color: #eee
|
||||
+text-shadow(1px 1px 0.2em gray)
|
||||
em.fa-globe
|
||||
color: red
|
||||
&:hover ul
|
||||
display: block
|
||||
|
||||
|
@ -87,8 +87,8 @@ class EventsController < ApplicationController
|
||||
|
||||
def set_events
|
||||
@events = Event.moderated
|
||||
@events = @events.region params[:region] \
|
||||
if params[:region] && params[:region] != 'all'
|
||||
@events = @events.region params[:region] if params[:region]
|
||||
@events = @events.locality params[:locality] if params[:locality]
|
||||
@events = @events.tag params[:tag] if params[:tag]
|
||||
end
|
||||
|
||||
|
@ -41,7 +41,8 @@ class Event < ActiveRecord::Base
|
||||
start_date.beginning_of_month.beginning_of_week,
|
||||
start_date.end_of_month.end_of_week.end_of_day
|
||||
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 :geo, -> { where 'latitude is not null and longitude is not null' }
|
||||
|
||||
|
@ -5,6 +5,11 @@
|
||||
%em.locality.fa.fa-shield
|
||||
= Region.find params[:region]
|
||||
%em.fa.fa-chevron-down
|
||||
- elsif params[:locality]
|
||||
%span.placeholder
|
||||
%em.locality.fa.fa-globe
|
||||
=t '.national'
|
||||
%em.fa.fa-chevron-down
|
||||
- else
|
||||
%span.placeholder
|
||||
%em.locality.fa.fa-globe
|
||||
@ -25,3 +30,11 @@
|
||||
start_date: params[:start_date],
|
||||
year: params[:year],
|
||||
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'
|
||||
|
@ -117,6 +117,7 @@ it more readable or agreable.
|
||||
regions:
|
||||
selector:
|
||||
all_regions: All regions
|
||||
national: National events
|
||||
index:
|
||||
title: Feeds
|
||||
quick: Each feed lists events for the coming 30 days in a given region
|
||||
|
@ -112,10 +112,11 @@ fr:
|
||||
regions:
|
||||
selector:
|
||||
all_regions: Toutes les régions
|
||||
national: Événements nationaux
|
||||
index:
|
||||
title: Liste des flux
|
||||
quick: Chaque flux liste les évènements pour les 30 prochains jours en
|
||||
cours dans une région donnée
|
||||
quick: Chaque flux liste les évènements pour les 30 prochains jours dans
|
||||
une région donnée
|
||||
help: "Quelques fonctionnalités intéressantes:\n
|
||||
\n
|
||||
* Vous pouvez limiter les évènements à un certain tag, en passant le
|
||||
|
Loading…
Reference in New Issue
Block a user