It is now possible to limit events near some location. Refs #70

This commit is contained in:
echarp 2016-03-12 16:14:45 +01:00
parent 9237f6bc14
commit 9700a88109
5 changed files with 25 additions and 16 deletions

View File

@ -2,6 +2,7 @@
# This is a central part to this project # This is a central part to this project
class EventsController < ApplicationController class EventsController < ApplicationController
has_scope :region, :locality, :tag, :daylimit has_scope :region, :locality, :tag, :daylimit
has_scope :near, type: :hash, using: [:location, :distance]
before_action :set_events, only: [:index] before_action :set_events, only: [:index]
before_action :set_event, except: [:index, :new, :preview_create, :create] before_action :set_event, except: [:index, :new, :preview_create, :create]

View File

@ -5,6 +5,7 @@ class MapsController < ApplicationController
has_scope :region, :locality, :tag, :daylimit has_scope :region, :locality, :tag, :daylimit
has_scope :future, type: :boolean, default: true has_scope :future, type: :boolean, default: true
has_scope :period, type: :hash, using: [:year, :week] has_scope :period, type: :hash, using: [:year, :week]
has_scope :near, type: :hash, using: [:location, :distance]
def index def index
respond_to do |format| respond_to do |format|

View File

@ -34,4 +34,6 @@
:markdown :markdown
#{t '.help', #{t '.help',
tag: events_path(format: :rss, tag: 'toulibre', only_path: false), tag: events_path(format: :rss, tag: 'toulibre', only_path: false),
daylimit: events_path(format: :ics, daylimit: '42', only_path: false)} daylimit: events_path(format: :ics, daylimit: '42', only_path: false),
near: events_path(format: :rss, near: { location: 'Rennes', distance: 20 },
only_path: false)}

View File

@ -121,15 +121,17 @@ it more readable or agreable.
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
help: "Some interesting features: help: "Some interesting features using parameters:
\n \n
\n* You can limit events to a specific tag, through the `tag` * `tag`: limit events to a specific tag. This will for example give you
parameter. This will for example give you a feed of all your a feed of all your organisation's events, if you do remember to tag all
organisation's events, if you do remember to tag all your events with a your events with a specific tag. \n
specific tag. \n
Example: `%{tag}` Example: `%{tag}`
\n* You can modify the 30 days limit with the parameter `daylimit`. \n * `daylimit`: limit future events to some number of days. \n
Example: `%{daylimit}`" Example: `%{daylimit}` \n
* `near[location]` and `near[distance]`: limit to events near a
specific location and distance (default to 20 km). \n
Example: `%{near}`"
stats: stats:
index: index:
title: Statistics title: Statistics

View File

@ -115,16 +115,19 @@ fr:
title: Liste des flux title: Liste des flux
quick: Chaque flux liste les évènements pour les 30 prochains jours dans quick: Chaque flux liste les évènements pour les 30 prochains jours dans
une région donnée une région donnée
help: "Quelques fonctionnalités intéressantes:\n help: "Quelques fonctionnalités intéressantes à l'aide de paramètres:\n
\n \n
* Vous pouvez limiter les évènements à un certain tag, en passant le * `tag`: limiter les évènements à un certain tag. Cela permet par
paramètre `tag`. Cela permet par exemple de récupérer un flux des exemple de récupérer un flux des évènements d'une organisation, à
évènements d'une organisation, à partir du moment où vous pensez à partir du moment où vous pensez à marquer tous vos évènements avec un
marquer tous vos évènements avec un tag précis. \n tag précis. \n
Exemple: `%{tag}`\n Exemple: `%{tag}`\n
* Vous pouvez modifier la limite des 30 prochains jours des flux en * `daylimit`: limiter les énévenements futurs à un certain nombre de
utilisant le paramètre `daylimit`. \n jours. \n
Exemple: `%{daylimit}`" Exemple: `%{daylimit}` \n
* `near[location]` et `near[distance]`: limiter les événements autour
d'un lieu, à une certaine distance (par défaut à 20 km). \n
Exemple: `%{near}`"
stats: stats:
index: index:
title: Statistiques title: Statistiques