trusty-festivity-extension 2.2.5 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/app/controllers/festivity_events_controller.rb +1 -1
- data/app/models/festivity_event_list.rb +11 -2
- data/app/presenters/festivity_datetime_filter_presenter.rb +4 -0
- data/app/presenters/festivity_datetime_presenter.rb +4 -0
- data/app/views/festivity_events/_event_filters.html.haml +1 -1
- data/lib/trusty-festivity-extension.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
ZjUyYTY5YTdhOTQyYjY4M2ZlMGM3MGFhZmJkYTJmY2Y2YTk3OTZkZQ==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
YjM2OTY4YWI5NTkyZGU2NTM0NzBkZWE2Yjc0MDk4MDViMGFjNWQ4MQ==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
ZTU3N2U5YWIzM2EwY2VlMTU4ZjA3MzEzZTBkODNiZDkwNDc2MzM1NWI3MjJk
|
|
10
|
+
YzRjYjhjMjkxNTkxZGFkMWE5ZDlkNzQ3YWU3NGUzYWI3MDkxZjFkMzRhMDJk
|
|
11
|
+
NzcwMGNmMmY2NmQ2NmM3ZGZhNjJmMjM2N2ViNTJiNGM2Nzk0ZDQ=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
M2Y0NDQ0YTNjMTU3ZTA1MTM3ZTRlMzQzYzAzMTFlMTFkMjNlMmZkYmI4YzAy
|
|
14
|
+
NzQ2ODE1ODVjYjM4ZjY5MTYxZDFjZDM2ZTc1YjEyNGUxODFlYmRjZjNkNjc3
|
|
15
|
+
NTE0YThjYThkNWEwMjlmNTA5NjczY2ZkMTc3ZjY4M2NmOWQ3MDU=
|
|
@@ -19,7 +19,7 @@ class FestivityEventsController < ApplicationController
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
@selected_dates = params[:dates] ? params[:dates].split(",") : []
|
|
22
|
+
@selected_dates = params[:dates] ? FestivityDatetimeFilterPresenter.parse(params[:dates].split(","), current_site.festivity_filter_type) : []
|
|
23
23
|
@selected_categories = params[:categories] ? params[:categories].split(",") : []
|
|
24
24
|
@selected_sort = order_by
|
|
25
25
|
# If the request is AJAX, only return the event list itself, not the full page
|
|
@@ -9,7 +9,12 @@ class FestivityEventList
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def self.search(criteria, order_by)
|
|
12
|
+
begin
|
|
12
13
|
where_clause = parse_criteria(criteria)
|
|
14
|
+
rescue ActiveRecord::RecordNotFound
|
|
15
|
+
return FestivityEventList.new([])
|
|
16
|
+
end
|
|
17
|
+
|
|
13
18
|
# where in event ids
|
|
14
19
|
FestivityEventList.new(
|
|
15
20
|
FestivityEventList::FestivityEventPerformance.
|
|
@@ -59,7 +64,7 @@ class FestivityEventList
|
|
|
59
64
|
# for each date passed in and return the SQL condition
|
|
60
65
|
def self.datetime_criteria(datetimes_string, filter_type)
|
|
61
66
|
date_queries = datetimes_string.split(',').map do |date_string|
|
|
62
|
-
start_date =
|
|
67
|
+
start_date = Chronic.parse(date_string)
|
|
63
68
|
end_date = start_date.advance(advance_by(filter_type))
|
|
64
69
|
<<-SQL
|
|
65
70
|
(
|
|
@@ -84,7 +89,11 @@ class FestivityEventList
|
|
|
84
89
|
# - The event ids returned, if any, are added to the where clause for the next query
|
|
85
90
|
# - Any category ids passed are added to the where clause as well.
|
|
86
91
|
def self.parse_criteria(criteria)
|
|
87
|
-
|
|
92
|
+
if criteria[:dates]
|
|
93
|
+
event_ids = event_ids_for_datetimes(criteria[:dates], criteria[:filter_type])
|
|
94
|
+
raise ActiveRecord::RecordNotFound unless event_ids.any?
|
|
95
|
+
end
|
|
96
|
+
|
|
88
97
|
where_clause = "site_id = #{ Page.current_site.id}"
|
|
89
98
|
where_clause += " AND event_id IN (#{event_ids.join(",")})" if event_ids.present?
|
|
90
99
|
where_clause += " AND #{parse_categories(criteria[:categories].split(","))}" if criteria[:categories]
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
%li
|
|
25
25
|
.checkbox
|
|
26
26
|
%label
|
|
27
|
-
- checked = @selected_dates.
|
|
27
|
+
- checked = @selected_dates.any? {|selected_date| selected_date == datetime}
|
|
28
28
|
%input{type: "checkbox", value: datetime.to_s, checked: checked, data: {filter: "Date", sort: datetime.to_s}}
|
|
29
29
|
= datetime.display
|
|
30
30
|
- current_site.festivity_active_category_types.each do |type|
|