trusty-festivity-extension 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. checksums.yaml +15 -0
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +33 -0
  4. data/README.md +2 -0
  5. data/Rakefile +110 -0
  6. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
  7. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +288 -0
  8. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  9. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
  10. data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2 +0 -0
  11. data/app/assets/images/pct-black.png +0 -0
  12. data/app/assets/images/skins/pghkids/footer.png +0 -0
  13. data/app/assets/images/skins/pghkids/footer_mobile.png +0 -0
  14. data/app/assets/images/skins/pghkids/frog.png +0 -0
  15. data/app/assets/images/skins/pghkids/frog_mobile.png +0 -0
  16. data/app/assets/images/skins/pghkids/header.png +0 -0
  17. data/app/assets/images/skins/pghkids/header_mobile.png +0 -0
  18. data/app/assets/images/skins/pghkids/seafoam.jpg +0 -0
  19. data/app/assets/javascripts/admin/festivity_admin.js +22 -0
  20. data/app/assets/javascripts/admin/pages/ajax_image_uploader.js +29 -0
  21. data/app/assets/javascripts/admin/pages/page_bindings.js +94 -0
  22. data/app/assets/javascripts/admin/pages/performances.js +59 -0
  23. data/app/assets/javascripts/admin/sites/categories.js +74 -0
  24. data/app/assets/javascripts/admin/sites/category_types.js +63 -0
  25. data/app/assets/javascripts/admin/sites/site_bindings.js +4 -0
  26. data/app/assets/javascripts/ajaxupload.js +1 -0
  27. data/app/assets/javascripts/bootstrap-sprockets.js +12 -0
  28. data/app/assets/javascripts/bootstrap.js +2306 -0
  29. data/app/assets/javascripts/bootstrap.min.js +7 -0
  30. data/app/assets/javascripts/bootstrap/affix.js +162 -0
  31. data/app/assets/javascripts/bootstrap/alert.js +94 -0
  32. data/app/assets/javascripts/bootstrap/button.js +116 -0
  33. data/app/assets/javascripts/bootstrap/carousel.js +237 -0
  34. data/app/assets/javascripts/bootstrap/collapse.js +211 -0
  35. data/app/assets/javascripts/bootstrap/dropdown.js +161 -0
  36. data/app/assets/javascripts/bootstrap/modal.js +324 -0
  37. data/app/assets/javascripts/bootstrap/popover.js +113 -0
  38. data/app/assets/javascripts/bootstrap/scrollspy.js +175 -0
  39. data/app/assets/javascripts/bootstrap/tab.js +153 -0
  40. data/app/assets/javascripts/bootstrap/tooltip.js +472 -0
  41. data/app/assets/javascripts/bootstrap/transition.js +59 -0
  42. data/app/assets/javascripts/events/event_list_bindings.js +3 -0
  43. data/app/assets/javascripts/events/filters.js +100 -0
  44. data/app/assets/javascripts/festivity.js +1 -0
  45. data/app/assets/javascripts/festivity_app.js +13 -0
  46. data/app/assets/javascripts/jasny-bootstrap.js +1024 -0
  47. data/app/assets/javascripts/jquery-migrate.js +521 -0
  48. data/app/assets/javascripts/jquery.collapse.js +176 -0
  49. data/app/assets/javascripts/jquery.collapse_cookie_storage.js +37 -0
  50. data/app/assets/javascripts/jquery.collapse_storage.js +56 -0
  51. data/app/assets/javascripts/jquery.inputmask.bundle.min.js +10 -0
  52. data/app/assets/javascripts/lodash.min.js +88 -0
  53. data/app/assets/javascripts/readmore.min.js +11 -0
  54. data/app/assets/javascripts/script.js +22 -0
  55. data/app/assets/javascripts/underscore.js +1545 -0
  56. data/app/assets/stylesheets/_bootstrap-compass.scss +9 -0
  57. data/app/assets/stylesheets/_bootstrap-mincer.scss +19 -0
  58. data/app/assets/stylesheets/_bootstrap-sprockets.scss +9 -0
  59. data/app/assets/stylesheets/_bootstrap.scss +50 -0
  60. data/app/assets/stylesheets/_defaults.scss +6 -0
  61. data/app/assets/stylesheets/_event_filter_bar.scss +78 -0
  62. data/app/assets/stylesheets/_faq.scss +48 -0
  63. data/app/assets/stylesheets/_filter-bar-mobile.scss +32 -0
  64. data/app/assets/stylesheets/_footer.scss +18 -0
  65. data/app/assets/stylesheets/_global.scss +30 -0
  66. data/app/assets/stylesheets/_header.scss +95 -0
  67. data/app/assets/stylesheets/_landing_page.scss +62 -0
  68. data/app/assets/stylesheets/_locations.scss +17 -0
  69. data/app/assets/stylesheets/_media-queries.scss +9 -0
  70. data/app/assets/stylesheets/_mixins.scss +17 -0
  71. data/app/assets/stylesheets/_nav.scss +128 -0
  72. data/app/assets/stylesheets/_normalize.scss +375 -0
  73. data/app/assets/stylesheets/_overrides.scss +11 -0
  74. data/app/assets/stylesheets/_page-template.scss +124 -0
  75. data/app/assets/stylesheets/_related_events.scss +20 -0
  76. data/app/assets/stylesheets/_search-results.scss +20 -0
  77. data/app/assets/stylesheets/_utils.scss +8 -0
  78. data/app/assets/stylesheets/admin/festivity_admin.scss +28 -0
  79. data/app/assets/stylesheets/admin/modules/_category_styles.scss +23 -0
  80. data/app/assets/stylesheets/admin/modules/_form_styles.scss +40 -0
  81. data/app/assets/stylesheets/admin/modules/_list_styles.scss +30 -0
  82. data/app/assets/stylesheets/admin/modules/_variables.scss +3 -0
  83. data/app/assets/stylesheets/bootstrap/_alerts.scss +73 -0
  84. data/app/assets/stylesheets/bootstrap/_badges.scss +67 -0
  85. data/app/assets/stylesheets/bootstrap/_breadcrumbs.scss +26 -0
  86. data/app/assets/stylesheets/bootstrap/_button-groups.scss +243 -0
  87. data/app/assets/stylesheets/bootstrap/_buttons.scss +160 -0
  88. data/app/assets/stylesheets/bootstrap/_carousel.scss +269 -0
  89. data/app/assets/stylesheets/bootstrap/_close.scss +36 -0
  90. data/app/assets/stylesheets/bootstrap/_code.scss +69 -0
  91. data/app/assets/stylesheets/bootstrap/_component-animations.scss +38 -0
  92. data/app/assets/stylesheets/bootstrap/_dropdowns.scss +214 -0
  93. data/app/assets/stylesheets/bootstrap/_forms.scss +570 -0
  94. data/app/assets/stylesheets/bootstrap/_glyphicons.scss +301 -0
  95. data/app/assets/stylesheets/bootstrap/_grid.scss +84 -0
  96. data/app/assets/stylesheets/bootstrap/_input-groups.scss +166 -0
  97. data/app/assets/stylesheets/bootstrap/_jumbotron.scss +50 -0
  98. data/app/assets/stylesheets/bootstrap/_labels.scss +66 -0
  99. data/app/assets/stylesheets/bootstrap/_list-group.scss +124 -0
  100. data/app/assets/stylesheets/bootstrap/_media.scss +61 -0
  101. data/app/assets/stylesheets/bootstrap/_mixins.scss +39 -0
  102. data/app/assets/stylesheets/bootstrap/_modals.scss +148 -0
  103. data/app/assets/stylesheets/bootstrap/_navbar.scss +663 -0
  104. data/app/assets/stylesheets/bootstrap/_navs.scss +244 -0
  105. data/app/assets/stylesheets/bootstrap/_normalize.scss +427 -0
  106. data/app/assets/stylesheets/bootstrap/_pager.scss +54 -0
  107. data/app/assets/stylesheets/bootstrap/_pagination.scss +88 -0
  108. data/app/assets/stylesheets/bootstrap/_panels.scss +265 -0
  109. data/app/assets/stylesheets/bootstrap/_popovers.scss +135 -0
  110. data/app/assets/stylesheets/bootstrap/_print.scss +107 -0
  111. data/app/assets/stylesheets/bootstrap/_progress-bars.scss +87 -0
  112. data/app/assets/stylesheets/bootstrap/_responsive-embed.scss +35 -0
  113. data/app/assets/stylesheets/bootstrap/_responsive-utilities.scss +177 -0
  114. data/app/assets/stylesheets/bootstrap/_scaffolding.scss +150 -0
  115. data/app/assets/stylesheets/bootstrap/_tables.scss +234 -0
  116. data/app/assets/stylesheets/bootstrap/_theme.scss +273 -0
  117. data/app/assets/stylesheets/bootstrap/_thumbnails.scss +38 -0
  118. data/app/assets/stylesheets/bootstrap/_tooltip.scss +103 -0
  119. data/app/assets/stylesheets/bootstrap/_type.scss +298 -0
  120. data/app/assets/stylesheets/bootstrap/_utilities.scss +56 -0
  121. data/app/assets/stylesheets/bootstrap/_variables.scss +862 -0
  122. data/app/assets/stylesheets/bootstrap/_wells.scss +29 -0
  123. data/app/assets/stylesheets/bootstrap/mixins/_alerts.scss +14 -0
  124. data/app/assets/stylesheets/bootstrap/mixins/_background-variant.scss +11 -0
  125. data/app/assets/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
  126. data/app/assets/stylesheets/bootstrap/mixins/_buttons.scss +52 -0
  127. data/app/assets/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
  128. data/app/assets/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
  129. data/app/assets/stylesheets/bootstrap/mixins/_forms.scss +88 -0
  130. data/app/assets/stylesheets/bootstrap/mixins/_gradients.scss +58 -0
  131. data/app/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +81 -0
  132. data/app/assets/stylesheets/bootstrap/mixins/_grid.scss +122 -0
  133. data/app/assets/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
  134. data/app/assets/stylesheets/bootstrap/mixins/_image.scss +33 -0
  135. data/app/assets/stylesheets/bootstrap/mixins/_labels.scss +12 -0
  136. data/app/assets/stylesheets/bootstrap/mixins/_list-group.scss +31 -0
  137. data/app/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
  138. data/app/assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +9 -0
  139. data/app/assets/stylesheets/bootstrap/mixins/_opacity.scss +8 -0
  140. data/app/assets/stylesheets/bootstrap/mixins/_pagination.scss +23 -0
  141. data/app/assets/stylesheets/bootstrap/mixins/_panels.scss +24 -0
  142. data/app/assets/stylesheets/bootstrap/mixins/_progress-bar.scss +10 -0
  143. data/app/assets/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
  144. data/app/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
  145. data/app/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +21 -0
  146. data/app/assets/stylesheets/bootstrap/mixins/_size.scss +10 -0
  147. data/app/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
  148. data/app/assets/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
  149. data/app/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +11 -0
  150. data/app/assets/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
  151. data/app/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +222 -0
  152. data/app/assets/stylesheets/events/_event-list-item.scss +85 -0
  153. data/app/assets/stylesheets/events/_event_template.scss +66 -0
  154. data/app/assets/stylesheets/events/_filter-bar.scss +5 -0
  155. data/app/assets/stylesheets/festivity.scss +35 -0
  156. data/app/assets/stylesheets/skins/pghkids/_events.scss +17 -0
  157. data/app/assets/stylesheets/skins/pghkids/_footer.scss +22 -0
  158. data/app/assets/stylesheets/skins/pghkids/_global.scss +42 -0
  159. data/app/assets/stylesheets/skins/pghkids/_header.scss +27 -0
  160. data/app/assets/stylesheets/skins/pghkids/_home.scss +113 -0
  161. data/app/assets/stylesheets/skins/pghkids/skin.scss +8 -0
  162. data/app/assets/stylesheets/vars/_vars_color.scss +6 -0
  163. data/app/assets/stylesheets/vars/_vars_media-queries.scss +5 -0
  164. data/app/assets/stylesheets/vars/_vars_type.scss +1 -0
  165. data/app/controllers/admin/festivity_categories_controller.rb +31 -0
  166. data/app/controllers/admin/festivity_category_types_controller.rb +31 -0
  167. data/app/controllers/admin/festivity_performances_controller.rb +21 -0
  168. data/app/controllers/festivity_events_controller.rb +71 -0
  169. data/app/controllers/festivity_location_areas_controller.rb +17 -0
  170. data/app/controllers/festivity_locations_controller.rb +19 -0
  171. data/app/controllers/search_controller.rb +17 -0
  172. data/app/helpers/admin/festivity_performances_helper.rb +3 -0
  173. data/app/helpers/admin/snippets_helper.rb +3 -0
  174. data/app/helpers/festivity_events_helper.rb +12 -0
  175. data/app/helpers/festivity_locations_helper.rb +4 -0
  176. data/app/models/festivity_base_page.rb +23 -0
  177. data/app/models/festivity_category.rb +17 -0
  178. data/app/models/festivity_category_type.rb +14 -0
  179. data/app/models/festivity_event_list.rb +90 -0
  180. data/app/models/festivity_event_list/festivity_event.rb +40 -0
  181. data/app/models/festivity_event_list/festivity_event_performance.rb +10 -0
  182. data/app/models/festivity_event_list/festivity_location.rb +15 -0
  183. data/app/models/festivity_event_page.rb +55 -0
  184. data/app/models/festivity_location_area_page.rb +5 -0
  185. data/app/models/festivity_location_page.rb +3 -0
  186. data/app/models/festivity_market_page.rb +3 -0
  187. data/app/models/festivity_page_category.rb +4 -0
  188. data/app/models/festivity_performance.rb +29 -0
  189. data/app/views/admin/pages/_festivity_base_fields.html.haml +75 -0
  190. data/app/views/admin/pages/_festivity_featured_image_fields.html.haml +3 -0
  191. data/app/views/admin/pages/_festivity_includes.html.haml +2 -0
  192. data/app/views/admin/pages/_festivity_location_fields.html.haml +26 -0
  193. data/app/views/admin/pages/partials/_categories.html.haml +18 -0
  194. data/app/views/admin/pages/partials/_category.html.haml +4 -0
  195. data/app/views/admin/pages/partials/_featured_image.html.haml +18 -0
  196. data/app/views/admin/pages/partials/_performance.html.haml +13 -0
  197. data/app/views/admin/pages/partials/_performances.html.haml +11 -0
  198. data/app/views/admin/pages/partials/_performances_table.html.haml +15 -0
  199. data/app/views/admin/sites/_festivity_site_fields.html.haml +26 -0
  200. data/app/views/admin/sites/partials/_category.html.haml +7 -0
  201. data/app/views/admin/sites/partials/_category_popup.html.haml +19 -0
  202. data/app/views/admin/sites/partials/_category_popups.haml +27 -0
  203. data/app/views/admin/sites/partials/_category_section.html.haml +7 -0
  204. data/app/views/admin/sites/partials/_category_types.html.haml +23 -0
  205. data/app/views/admin/sites/partials/_filters.html.haml +25 -0
  206. data/app/views/admin/sites/partials/_new_category.html.haml +3 -0
  207. data/app/views/admin/sites/partials/_new_category_type.html.haml +3 -0
  208. data/app/views/festivity_events/_event_filters.html.haml +39 -0
  209. data/app/views/festivity_events/_event_list.html.haml +62 -0
  210. data/app/views/festivity_events/_filter_bar_mobile.html.haml +22 -0
  211. data/app/views/festivity_events/index.html.haml +34 -0
  212. data/app/views/festivity_events/show.html.haml +152 -0
  213. data/app/views/festivity_location_areas/show.html.haml +29 -0
  214. data/app/views/festivity_locations/show.html.haml +66 -0
  215. data/app/views/header/_meta_tags.html.haml +8 -0
  216. data/app/views/navigation/_subnav_one_column.html.haml +15 -0
  217. data/app/views/navigation/_subnav_three_column.html.haml +7 -0
  218. data/app/views/navigation/_three_column_item.html.haml +11 -0
  219. data/app/views/search/_page.html.haml +1 -0
  220. data/app/views/search/_pagination_links.html.haml +7 -0
  221. data/app/views/search/_result_item.html.haml +6 -0
  222. data/app/views/search/show.html.haml +19 -0
  223. data/config/initializers/pluralizations.rb +0 -0
  224. data/config/initializers/radiant_config.rb +1 -0
  225. data/config/locales/en.yml +16 -0
  226. data/config/routes.rb +14 -0
  227. data/config/trustygems.yml +2 -0
  228. data/db/content/layouts/base.html +174 -0
  229. data/db/content/layouts/normal.html +5 -0
  230. data/db/fixtures/home_pages.yml +40 -0
  231. data/db/fixtures/layouts.yml +2 -0
  232. data/db/fixtures/pages.yml +23 -0
  233. data/db/fixtures/sites.yml +57 -0
  234. data/db/fixtures/users.yml +8 -0
  235. data/db/migrate/200150325136087799_add_event_performances_view.rb +27 -0
  236. data/db/migrate/200150425136087799_update_event_performances_view_with_site.rb +27 -0
  237. data/db/migrate/20150123175758_add_site_fields.rb +15 -0
  238. data/db/migrate/20150127090858995_add_base_event_fields.rb +24 -0
  239. data/db/migrate/20150127091005232_add_market_and_event_fields.rb +29 -0
  240. data/db/migrate/20150204113325731_add_category_types_table.rb +15 -0
  241. data/db/migrate/20150204113427832_add_categories_table.rb +15 -0
  242. data/db/migrate/20150204113510326_add_page_categories_table.rb +12 -0
  243. data/db/migrate/20150226131727777_add_location_page_fields.rb +19 -0
  244. data/db/migrate/20150302135485569_add_performances_table.rb +19 -0
  245. data/db/migrate/20150324135487799_add_indexes.rb +21 -0
  246. data/festivity_extension.rb +25 -0
  247. data/lib/festivity/admin/assets_helper.rb +17 -0
  248. data/lib/festivity/engine.rb +9 -0
  249. data/lib/festivity/extensions/page_extensions.rb +61 -0
  250. data/lib/festivity/extensions/pages_helper_extensions.rb +11 -0
  251. data/lib/festivity/extensions/paperclipped_extensions.rb +22 -0
  252. data/lib/festivity/extensions/site_extensions.rb +40 -0
  253. data/lib/festivity/mixins/not_found.rb +10 -0
  254. data/lib/tags/header_tags.rb +41 -0
  255. data/lib/tags/navigation_tags.rb +55 -0
  256. data/lib/tasks/active_record_utils.rb +35 -0
  257. data/lib/tasks/festivity_extension_tasks.rake +7 -0
  258. data/lib/tasks/setup.rake +101 -0
  259. data/lib/trusty-festivity-extension.rb +8 -0
  260. data/trusty-festivity-extension.gemspec +37 -0
  261. metadata +442 -0
@@ -0,0 +1 @@
1
+ $open-sans: "Open Sans", helvetica, arial, sans-serif;
@@ -0,0 +1,31 @@
1
+ class Admin::FestivityCategoriesController < Admin::ResourceController
2
+
3
+ def index
4
+
5
+ end
6
+
7
+ def show
8
+
9
+ end
10
+
11
+ def create
12
+ category_type = FestivityCategoryType.find(params[:category_type_id])
13
+
14
+ if category_type.festivity_categories.new(name: params[:name], parent_id: params[:parent_id]).save
15
+ render partial: 'admin/sites/partials/new_category', :locals => { :category_type => category_type, :category_types => category_type.site.festivity_active_category_types}
16
+ else
17
+ render status: :conflict, text: "#{category_type.name} must be unique."
18
+ end
19
+
20
+ end
21
+
22
+ def destroy
23
+ category = FestivityCategory.find(params[:id])
24
+ site = Site.find(category.festivity_category_type.site_id)
25
+ category.inactive = true
26
+ if category.save!
27
+ render partial: 'admin/sites/partials/filters', :locals => { :category_types => site.festivity_active_category_types}
28
+ end
29
+ end
30
+
31
+ end
@@ -0,0 +1,31 @@
1
+ class Admin::FestivityCategoryTypesController < Admin::ResourceController
2
+
3
+ def index
4
+
5
+ end
6
+
7
+ def show
8
+
9
+ end
10
+
11
+ def create
12
+ site = Site.find(params[:site_id])
13
+ new_category_type = site.festivity_category_types.new(name: params[:name], page_class: params[:page_class])
14
+ if new_category_type.save
15
+ render partial: 'admin/sites/partials/new_category_type', :locals => { :new_category_type => new_category_type, :category_types => site.festivity_active_category_types}
16
+ else
17
+ render status: :conflict, text: "Category Type name must be unique."
18
+ end
19
+
20
+ end
21
+
22
+ def destroy
23
+ category_type = FestivityCategoryType.find(params[:id])
24
+ site = Site.find(category_type.site_id)
25
+ category_type.inactive = true
26
+ if category_type.save!
27
+ render partial: 'admin/sites/partials/category_types', :locals => { :category_types => site.festivity_active_category_types}
28
+ end
29
+ end
30
+
31
+ end
@@ -0,0 +1,21 @@
1
+ class Admin::FestivityPerformancesController < Admin::ResourceController
2
+ def create
3
+ event = FestivityEventPage.find(params[:event_page_id])
4
+ performance = event.festivity_performances.new
5
+ if performance.save
6
+ render partial: 'admin/pages/partials/performance', :locals => { :performance => performance, :locations => FestivityLocationPage.all }
7
+ else
8
+ render status: :bad_request
9
+ end
10
+
11
+ end
12
+
13
+ def destroy
14
+ performance = FestivityPerformance.find(params[:id])
15
+ page_id = performance.festivity_event_page.id
16
+ if performance.destroy
17
+ render partial: 'admin/pages/partials/performances_table', :locals => { :performances => FestivityEventPage.find(page_id).festivity_performances, :page_id => page_id, locations: FestivityLocationPage.all}
18
+ end
19
+ end
20
+
21
+ end
@@ -0,0 +1,71 @@
1
+ class FestivityEventsController < ApplicationController
2
+ include Festivity::Mixins::NotFound
3
+ no_login_required
4
+ trusty_layout 'base'
5
+
6
+ #caches_action :show
7
+
8
+ def index
9
+ order_by = params[:sort] ? params[:sort] : "start_date"
10
+ @title = "#{current_site.festivity_festival_name}: Events"
11
+ @events = Rails.cache.fetch("#{cache_key}", expires_in: 2.hours) do
12
+ FestivityEventList.search(
13
+ {dates: search_dates.join(","),
14
+ categories: params[:categories]},
15
+ order_by).events
16
+ end
17
+
18
+
19
+ @selected_dates = params[:dates] ? params[:dates].split(",") : []
20
+ @selected_categories = params[:categories] ? params[:categories].split(",") : []
21
+ @selected_sort = order_by
22
+ # If the request is AJAX, only return the event list itself, not the full page
23
+ if request.xhr?
24
+ render partial: "event_list"
25
+ else
26
+ render 'index'
27
+ end
28
+
29
+ end
30
+
31
+ def show
32
+ @event = FestivityEventPage.find_by_slug_and_status_id(params[:id], Status[:published].id)
33
+ if @event
34
+ @page = @event
35
+ @related_events = FestivityEventList.find_related_events(
36
+ {dates: search_dates.join(","), event_id: @event.id,
37
+ categories: @event.festivity_categories.map{|cat| cat.id}}).events
38
+ @title = "#{current_site.festivity_festival_name}: #{@event.title}"
39
+ else
40
+ file_not_found_for_site
41
+ end
42
+
43
+ end
44
+
45
+ private
46
+
47
+ def cache_key
48
+ "#{params[:categories.to_s]}-#{params[:dates].to_s}-#{request.xhr?}"
49
+ end
50
+
51
+ def search_dates
52
+ if params[:dates]
53
+ params[:dates].split(",")
54
+ else
55
+ collect_festival_dates
56
+ end
57
+
58
+ end
59
+
60
+ def collect_festival_dates
61
+ festival_dates = current_site.festival_dates
62
+ if current_site.date_during_festival?(Date.today)
63
+ festival_dates = festival_dates.select{ |date| date == Date.today }
64
+ end
65
+
66
+ festival_dates.map{ |date| date.to_s }
67
+
68
+ end
69
+
70
+
71
+ end
@@ -0,0 +1,17 @@
1
+ class FestivityLocationAreasController < ApplicationController
2
+ include Festivity::Mixins::NotFound
3
+ no_login_required
4
+ trusty_layout "normal"
5
+
6
+ def show
7
+ @area = FestivityLocationAreaPage.find_by_slug_for_site(params[:id]).first
8
+
9
+ if @area
10
+ @title = "#{current_site.festivity_festival_name}: #{@area.title}"
11
+ else
12
+ file_not_found_for_site
13
+ end
14
+
15
+ end
16
+
17
+ end
@@ -0,0 +1,19 @@
1
+ class FestivityLocationsController < ApplicationController
2
+ include Festivity::Mixins::NotFound
3
+ no_login_required
4
+ trusty_layout "base"
5
+
6
+ def show
7
+ @location = FestivityLocationPage.find_by_slug_for_site(params[:id]).first
8
+ if @location
9
+ @location_events = @title = Rails.cache.fetch("location-#{@location.slug}", expires_in: 2.hours) do
10
+ FestivityEventList.find_by_location(@location.id)
11
+ end
12
+ @title = "#{current_site.festivity_festival_name}: #{@location.title}"
13
+ else
14
+ file_not_found_for_site
15
+ end
16
+
17
+ end
18
+
19
+ end
@@ -0,0 +1,17 @@
1
+ class SearchController < ApplicationController
2
+ no_login_required
3
+ trusty_layout 'base'
4
+
5
+ def show
6
+ query = params[:q].to_s
7
+ @keyword = query
8
+ @page_number = page_number
9
+ @result = GoogleCustomSearch::Search.new.with_page_index(@page_number).for url_encode("#{@keyword} site:#{current_site.base_domain}")
10
+ end
11
+
12
+ private
13
+ def page_number
14
+ page_number = params[:page_number] || 1
15
+ page_number.to_i
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module Admin::FestivityPerformancesHelper
2
+ include Admin::PagesHelper
3
+ end
@@ -0,0 +1,3 @@
1
+ module Admin::SnippetsHelper
2
+
3
+ end
@@ -0,0 +1,12 @@
1
+ module FestivityEventsHelper
2
+ include RadSocialHelper
3
+
4
+ def date_time_popover(performances)
5
+ "<div><ul class='list-unstyled'>#{date_time_list_items(performances)}</ul></div>"
6
+ end
7
+
8
+ def date_time_list_items(performances)
9
+ performances.map {|perf| "<li>#{perf.start_date.strftime('%A, %B %d')}, #{perf.start_date.strftime('%I:%M %p').downcase} - #{perf.end_date.strftime('%I:%M %p').downcase}</li>" }.join("")
10
+ end
11
+
12
+ end
@@ -0,0 +1,4 @@
1
+ module FestivityLocationsHelper
2
+ include FestivityEventsHelper
3
+
4
+ end
@@ -0,0 +1,23 @@
1
+ class FestivityBasePage < Page
2
+
3
+ def body
4
+ self.part("body").content.html_safe
5
+ end
6
+
7
+ def sponsor_logo
8
+ self.part("sponsor_logo").content.html_safe
9
+ end
10
+
11
+ def sponsor_logo?
12
+ !self.part("sponsor_logo").content.empty?
13
+ end
14
+
15
+ def video
16
+ self.part("video_embed").content.html_safe
17
+ end
18
+
19
+ def video?
20
+ !self.part("video_embed").content.empty?
21
+ end
22
+
23
+ end
@@ -0,0 +1,17 @@
1
+ class FestivityCategory < ActiveRecord::Base
2
+ acts_as_list :scope => :parent_id
3
+ belongs_to :festivity_category_type
4
+ has_many :pages, through: :festivity_page_categories
5
+ #self.reflections[:children].options[:position] = "position ASC"
6
+
7
+ attr_accessible :name, :festivity_category_type_id, :parent_id, :position, :inactive
8
+
9
+ def parent
10
+ FestivityCategory.find(self.parent_id)
11
+ end
12
+
13
+ def children
14
+ FestivityCategory.where(parent_id: self.id, inactive: false)
15
+ end
16
+
17
+ end
@@ -0,0 +1,14 @@
1
+ class FestivityCategoryType < ActiveRecord::Base
2
+ acts_as_list scope: :site_id
3
+ has_many :festivity_categories
4
+ belongs_to :site
5
+ validates_uniqueness_of :name, scope: :site_id
6
+
7
+ attr_accessible :name, :page_class
8
+
9
+
10
+ def parent_categories
11
+ self.festivity_categories.where(inactive: false, parent_id: nil)
12
+ end
13
+
14
+ end
@@ -0,0 +1,90 @@
1
+ class FestivityEventList
2
+
3
+ attr_reader :events
4
+
5
+ def initialize(event_performances)
6
+ @events = event_performances.group_by {|perf| perf.event_id }.
7
+ map { |perfs| FestivityEventList::FestivityEvent.new(perfs[0], perfs[1]) }
8
+
9
+ end
10
+
11
+ def self.search(criteria, order_by)
12
+ where_clause = parse_criteria(criteria)
13
+ # where in event ids
14
+ FestivityEventList.new(
15
+ FestivityEventList::FestivityEventPerformance.
16
+ includes(:assets).
17
+ joins(:festivity_categories).
18
+ where(where_clause).
19
+ group("performance_id").
20
+ order("featured_item DESC, #{order_by} ASC").
21
+ preload(:festivity_categories)
22
+ )
23
+ end
24
+
25
+ def self.find_by_location(location_id)
26
+ FestivityEventList.new(
27
+ FestivityEventList::FestivityEventPerformance.
28
+ includes(:assets).
29
+ joins(:festivity_categories).
30
+ where(location_id: location_id).
31
+ group("performance_id").
32
+ order("featured_item DESC, start_date ASC").
33
+ preload(:festivity_categories)
34
+ )
35
+ end
36
+
37
+ def self.find_related_events(criteria)
38
+ where_clause = parse_criteria(criteria)
39
+ FestivityEventList.new(
40
+ FestivityEventList::FestivityEventPerformance.
41
+ includes(:assets).
42
+ joins(:festivity_categories).
43
+ where(where_clause).
44
+ where("event_id != ?", criteria[:event_id]).
45
+ group("performance_id").
46
+ order("featured_item DESC, start_date ASC").
47
+ preload(:festivity_categories)
48
+ )
49
+ end
50
+
51
+ private
52
+
53
+ # Return a list of unique event ids that match the provided dates
54
+ def self.event_ids_for_dates(dates)
55
+ FestivityEventList::FestivityEventPerformance.where(date_criteria(dates)).map {|e| e.event_id}.uniq
56
+ end
57
+
58
+ # Create a condition for start and end date between midnight and 11:59pm
59
+ # for each date passed in and return the SQL condition
60
+ def self.date_criteria(dates_string)
61
+ date_queries = dates_string.split(',').map do |date_string|
62
+ start_date = DateTime.parse(date_string)
63
+ end_date = start_date.advance(hours: 23, minutes: 59)
64
+ <<-SQL
65
+ (
66
+ (start_date >= '#{start_date}' AND start_date <= '#{end_date}')
67
+ OR
68
+ (end_date >= '#{start_date}' AND end_date <= '#{end_date}')
69
+ )
70
+ SQL
71
+ end
72
+ date_queries.join(" OR ")
73
+ end
74
+
75
+ # The order of querying, depending on what is passed:
76
+ # - If dates are passed, we search both start and end date between midnight and 11:59pm of that date.
77
+ # That query returns any matching event ids.
78
+ # - The event ids returned, if any, are added to the where clause for the next query
79
+ # - Any category ids passed are added to the where clause as well.
80
+ def self.parse_criteria(criteria)
81
+ where_clause = {}
82
+ event_ids = event_ids_for_dates(criteria[:dates]) if criteria[:dates]
83
+ where_clause["site_id"] = Page.current_site.id
84
+ where_clause["event_id"] = event_ids if event_ids
85
+ where_clause["festivity_categories.id"] = criteria[:categories].split(",") if criteria[:categories]
86
+ where_clause
87
+ end
88
+
89
+
90
+ end
@@ -0,0 +1,40 @@
1
+ class FestivityEventList::FestivityEvent
2
+ include Festivity::Admin::AssetsHelper
3
+
4
+ attr_reader :id, :performances, :locations, :categories, :title, :short_description,
5
+ :assets, :header, :sub_header, :featured_item, :buy_url
6
+
7
+ def initialize(event_id, performances)
8
+ @id = event_id
9
+ @performances = performances
10
+ @title = performances.first.event_title
11
+ @short_description = performances.first.short_description
12
+ @header = performances.first.header
13
+ @sub_header = performances.first.sub_header
14
+ @featured_item = performances.first.featured_item
15
+ @buy_url = performances.first.buy_url
16
+
17
+ @locations = self.performances.
18
+ map{ |performance| FestivityEventList::FestivityLocation.new ({
19
+ id: performance.location_id,
20
+ slug: performance.location_slug,
21
+ title: performance.location_title,
22
+ directions_url: performance.festivity_directions_url,
23
+ area_id: performance.area_id,
24
+ area_slug: performance.area_slug,
25
+ area_title: performance.area_title}) }.
26
+ uniq{ |location| location.id }
27
+
28
+ @categories = performances.first.festivity_categories
29
+
30
+ @assets = performances.first.assets
31
+
32
+ end
33
+
34
+ def image
35
+ image = assets.select { |asset| asset.title == "featured_image" }.first if assets.size > 0
36
+ image.thumbnail(:normal) unless image.nil?
37
+ end
38
+
39
+
40
+ end
@@ -0,0 +1,10 @@
1
+ class FestivityEventList::FestivityEventPerformance < ActiveRecord::Base
2
+ self.table_name = 'festivity_event_performances'
3
+ after_initialize :readonly!
4
+
5
+ has_many :festivity_page_categories, foreign_key: :page_id, primary_key: :event_id
6
+ has_many :festivity_categories, through: :festivity_page_categories
7
+ has_many :page_attachments, primary_key: :event_id, foreign_key: :page_id
8
+ has_many :assets, through: :page_attachments
9
+
10
+ end