Module: Taggable::EventsController

Defined in:
lib/taggable/events_controller.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/taggable/events_controller.rb', line 4

def self.included(base)
  base.class_eval {
    helper_method :tags, :url_with_tag, :url_without_tag
    alias_method_chain :event_finder, :tags
    alias_method_chain :continuing_events, :tags
    alias_method_chain :calendar_parameter_names, :tags
  }
end

Instance Method Details

#calendar_parameter_names_with_tags ⇒ Object



29
30
31
# File 'lib/taggable/events_controller.rb', line 29

def calendar_parameter_names_with_tags
  calendar_parameter_names_without_tags + [:tags]
end

#continuing_events_with_tags ⇒ Object



23
24
25
26
27
# File 'lib/taggable/events_controller.rb', line 23

def continuing_events_with_tags
  continuing_events_without_tags
  @continuing_events = @continuing_events.from_all_tags(tags) if tags.any?
  @continuing_events
end

#event_finder_with_tags ⇒ Object



17
18
19
20
21
# File 'lib/taggable/events_controller.rb', line 17

def event_finder_with_tags
  ef = event_finder_without_tags
  ef = ef.from_all_tags(tags) if tags.any?
  ef
end

#tags ⇒ Object



13
14
15
# File 'lib/taggable/events_controller.rb', line 13

def tags
  @tags ||= Tag.from_list(params[:tags], false) || []
end

#url_with_tag(tag) ⇒ Object



39
40
41
42
43
# File 'lib/taggable/events_controller.rb', line 39

def url_with_tag(tag)
  url_for(url_parts({
    :tags => Tag.to_list(tags + [tag])
  }))
end

#url_without_tag(tag) ⇒ Object



33
34
35
36
37
# File 'lib/taggable/events_controller.rb', line 33

def url_without_tag(tag)
  url_for(url_parts({
    :tags => Tag.to_list(tags - [tag])
  }))
end