Tags can also be scoped by region and week/year
This commit is contained in:
parent
11191169ce
commit
a00fb8aa92
@ -1,7 +1,10 @@
|
|||||||
# Manage event tags
|
# Manage event tags
|
||||||
class TagsController < InheritedResources::Base
|
class TagsController < InheritedResources::Base
|
||||||
|
has_scope :region, :locality, :tag, :daylimit
|
||||||
|
has_scope :period, type: :hash, using: [:year, :week]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@tags = Event
|
@tags = apply_scopes(Event.moderated)
|
||||||
.pluck(:tags).map(&:split).flatten
|
.pluck(:tags).map(&:split).flatten
|
||||||
.group_by { |i| i }
|
.group_by { |i| i }
|
||||||
.map { |k, v| [k, v.size] }
|
.map { |k, v| [k, v.size] }
|
||||||
@ -15,7 +18,7 @@ class TagsController < InheritedResources::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@events_future = Event.moderated.future.tag params[:id]
|
@events_future = apply_scopes(Event).moderated.future.tag params[:id]
|
||||||
@events_past = Event.moderated.past.tag params[:id]
|
@events_past = apply_scopes(Event).moderated.past.tag params[:id]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user