Skip to content
Extraits de code Groupes Projets
Valider 34114bcd rédigé par echarp's avatar echarp
Parcourir les fichiers

Cleaning up code

parent 3cbbad93
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# Resume of all events over a period of time
# A digest of all events over a period of time
class DigestsController < ApplicationController
has_scope :moderated, default: nil, allow_blank: true
has_scope :region, :locality, :tag
has_scope :period, allow_blank: true,
type: :hash, using: [:year, :week],
......@@ -22,6 +23,6 @@ class DigestsController < ApplicationController
def set_events
@week ||= Time.zone.today + 7.days
@events = apply_scopes Event.moderated
@events = apply_scopes Event
end
end
......@@ -30,8 +30,8 @@ class Event < ActiveRecord::Base
after_update EventCallbacks
after_destroy EventCallbacks
scope :moderated, -> { where moderated: true }
scope :unmoderated, -> { where moderated: false }
scope :moderated, ->(*) { where moderated: true }
scope :unmoderated, ->(*) { where moderated: false }
scope :last_year, -> { where '? <= end_time', 1.year.ago }
scope :past, -> { where 'start_time <= ?', Time.zone.now }
scope :future, -> { where '? <= end_time', Time.zone.now }
......
......@@ -14,16 +14,17 @@
\=====
- @events.sort_by(&:start_time).each do |event|
- @event = event
\## [#{event.city}] [#{event.title}](#{event_url event}) - #{display_date}
- lines = strip_tags(@event.description).split(/\r\n/).reject(&:blank?)
[#{event.city}] [#{event.title}](#{event_url event}) - #{display_date event}
\-----
- lines = strip_tags(event.description).split(/\r\n/).reject(&:blank?)
- lines[0..2].each do |p|
= p
\
* #{[@event.place_name, event.full_address].compact.join ', '}
* #{Event.human_attribute_name :url}: #{link_to @event.url, @event.url}
* #{[event.place_name, event.full_address].compact.join ', '}
* #{Event.human_attribute_name :url}: #{link_to event.url, event.url}
* #{Event.human_attribute_name :tags}:
#{@event.tags.split.collect { |tag| "[#{tag}](#{tag_url tag})" }.join ', '}
#{event.tags.split.collect { |tag| "[#{tag}](#{tag_url tag})" }.join ', '}
\
%h1= title
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter