diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index af27e40c..94b4c590 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -2,6 +2,7 @@ # This is a central part to this project class EventsController < ApplicationController has_scope :region, :locality, :tag, :daylimit + has_scope :near, type: :hash, using: [:location, :distance] before_action :set_events, only: [:index] before_action :set_event, except: [:index, :new, :preview_create, :create] diff --git a/app/controllers/maps_controller.rb b/app/controllers/maps_controller.rb index 72f199d9..d49ca51f 100644 --- a/app/controllers/maps_controller.rb +++ b/app/controllers/maps_controller.rb @@ -5,6 +5,7 @@ class MapsController < ApplicationController has_scope :region, :locality, :tag, :daylimit has_scope :future, type: :boolean, default: true has_scope :period, type: :hash, using: [:year, :week] + has_scope :near, type: :hash, using: [:location, :distance] def index respond_to do |format| diff --git a/app/views/regions/index.html.haml b/app/views/regions/index.html.haml index d1ebf92a..8b6b6d4a 100644 --- a/app/views/regions/index.html.haml +++ b/app/views/regions/index.html.haml @@ -34,4 +34,6 @@ :markdown #{t '.help', 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)} diff --git a/config/locales/views/en.yml b/config/locales/views/en.yml index 376ef775..3d09a16e 100644 --- a/config/locales/views/en.yml +++ b/config/locales/views/en.yml @@ -121,15 +121,17 @@ it more readable or agreable. index: title: Feeds 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* You can limit events to a specific tag, through the `tag` - parameter. This will for example give you a feed of all your - organisation's events, if you do remember to tag all your events with a - specific tag. \n + * `tag`: limit events to a specific tag. This will for example give you + a feed of all your organisation's events, if you do remember to tag all + your events with a specific tag. \n Example: `%{tag}` - \n* You can modify the 30 days limit with the parameter `daylimit`. \n - Example: `%{daylimit}`" + * `daylimit`: limit future events to some number of days. \n + 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: index: title: Statistics diff --git a/config/locales/views/fr.yml b/config/locales/views/fr.yml index eca3a499..ca9052ff 100644 --- a/config/locales/views/fr.yml +++ b/config/locales/views/fr.yml @@ -115,16 +115,19 @@ fr: title: Liste des flux 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 + help: "Quelques fonctionnalités intéressantes à l'aide de paramètres:\n \n - * Vous pouvez limiter les évènements à un certain tag, en passant le - paramètre `tag`. Cela permet par exemple de récupérer un flux des - évènements d'une organisation, à partir du moment où vous pensez à - marquer tous vos évènements avec un tag précis. \n + * `tag`: limiter les évènements à un certain tag. Cela permet par + exemple de récupérer un flux des évènements d'une organisation, à + partir du moment où vous pensez à marquer tous vos évènements avec un + tag précis. \n Exemple: `%{tag}`\n - * Vous pouvez modifier la limite des 30 prochains jours des flux en - utilisant le paramètre `daylimit`. \n - Exemple: `%{daylimit}`" + * `daylimit`: limiter les énévenements futurs à un certain nombre de + jours. \n + 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: index: title: Statistiques