trusty-festivity-extension 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +33 -0
- data/README.md +2 -0
- data/Rakefile +110 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +288 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2 +0 -0
- data/app/assets/images/pct-black.png +0 -0
- data/app/assets/images/skins/pghkids/footer.png +0 -0
- data/app/assets/images/skins/pghkids/footer_mobile.png +0 -0
- data/app/assets/images/skins/pghkids/frog.png +0 -0
- data/app/assets/images/skins/pghkids/frog_mobile.png +0 -0
- data/app/assets/images/skins/pghkids/header.png +0 -0
- data/app/assets/images/skins/pghkids/header_mobile.png +0 -0
- data/app/assets/images/skins/pghkids/seafoam.jpg +0 -0
- data/app/assets/javascripts/admin/festivity_admin.js +22 -0
- data/app/assets/javascripts/admin/pages/ajax_image_uploader.js +29 -0
- data/app/assets/javascripts/admin/pages/page_bindings.js +94 -0
- data/app/assets/javascripts/admin/pages/performances.js +59 -0
- data/app/assets/javascripts/admin/sites/categories.js +74 -0
- data/app/assets/javascripts/admin/sites/category_types.js +63 -0
- data/app/assets/javascripts/admin/sites/site_bindings.js +4 -0
- data/app/assets/javascripts/ajaxupload.js +1 -0
- data/app/assets/javascripts/bootstrap-sprockets.js +12 -0
- data/app/assets/javascripts/bootstrap.js +2306 -0
- data/app/assets/javascripts/bootstrap.min.js +7 -0
- data/app/assets/javascripts/bootstrap/affix.js +162 -0
- data/app/assets/javascripts/bootstrap/alert.js +94 -0
- data/app/assets/javascripts/bootstrap/button.js +116 -0
- data/app/assets/javascripts/bootstrap/carousel.js +237 -0
- data/app/assets/javascripts/bootstrap/collapse.js +211 -0
- data/app/assets/javascripts/bootstrap/dropdown.js +161 -0
- data/app/assets/javascripts/bootstrap/modal.js +324 -0
- data/app/assets/javascripts/bootstrap/popover.js +113 -0
- data/app/assets/javascripts/bootstrap/scrollspy.js +175 -0
- data/app/assets/javascripts/bootstrap/tab.js +153 -0
- data/app/assets/javascripts/bootstrap/tooltip.js +472 -0
- data/app/assets/javascripts/bootstrap/transition.js +59 -0
- data/app/assets/javascripts/events/event_list_bindings.js +3 -0
- data/app/assets/javascripts/events/filters.js +100 -0
- data/app/assets/javascripts/festivity.js +1 -0
- data/app/assets/javascripts/festivity_app.js +13 -0
- data/app/assets/javascripts/jasny-bootstrap.js +1024 -0
- data/app/assets/javascripts/jquery-migrate.js +521 -0
- data/app/assets/javascripts/jquery.collapse.js +176 -0
- data/app/assets/javascripts/jquery.collapse_cookie_storage.js +37 -0
- data/app/assets/javascripts/jquery.collapse_storage.js +56 -0
- data/app/assets/javascripts/jquery.inputmask.bundle.min.js +10 -0
- data/app/assets/javascripts/lodash.min.js +88 -0
- data/app/assets/javascripts/readmore.min.js +11 -0
- data/app/assets/javascripts/script.js +22 -0
- data/app/assets/javascripts/underscore.js +1545 -0
- data/app/assets/stylesheets/_bootstrap-compass.scss +9 -0
- data/app/assets/stylesheets/_bootstrap-mincer.scss +19 -0
- data/app/assets/stylesheets/_bootstrap-sprockets.scss +9 -0
- data/app/assets/stylesheets/_bootstrap.scss +50 -0
- data/app/assets/stylesheets/_defaults.scss +6 -0
- data/app/assets/stylesheets/_event_filter_bar.scss +78 -0
- data/app/assets/stylesheets/_faq.scss +48 -0
- data/app/assets/stylesheets/_filter-bar-mobile.scss +32 -0
- data/app/assets/stylesheets/_footer.scss +18 -0
- data/app/assets/stylesheets/_global.scss +30 -0
- data/app/assets/stylesheets/_header.scss +95 -0
- data/app/assets/stylesheets/_landing_page.scss +62 -0
- data/app/assets/stylesheets/_locations.scss +17 -0
- data/app/assets/stylesheets/_media-queries.scss +9 -0
- data/app/assets/stylesheets/_mixins.scss +17 -0
- data/app/assets/stylesheets/_nav.scss +128 -0
- data/app/assets/stylesheets/_normalize.scss +375 -0
- data/app/assets/stylesheets/_overrides.scss +11 -0
- data/app/assets/stylesheets/_page-template.scss +124 -0
- data/app/assets/stylesheets/_related_events.scss +20 -0
- data/app/assets/stylesheets/_search-results.scss +20 -0
- data/app/assets/stylesheets/_utils.scss +8 -0
- data/app/assets/stylesheets/admin/festivity_admin.scss +28 -0
- data/app/assets/stylesheets/admin/modules/_category_styles.scss +23 -0
- data/app/assets/stylesheets/admin/modules/_form_styles.scss +40 -0
- data/app/assets/stylesheets/admin/modules/_list_styles.scss +30 -0
- data/app/assets/stylesheets/admin/modules/_variables.scss +3 -0
- data/app/assets/stylesheets/bootstrap/_alerts.scss +73 -0
- data/app/assets/stylesheets/bootstrap/_badges.scss +67 -0
- data/app/assets/stylesheets/bootstrap/_breadcrumbs.scss +26 -0
- data/app/assets/stylesheets/bootstrap/_button-groups.scss +243 -0
- data/app/assets/stylesheets/bootstrap/_buttons.scss +160 -0
- data/app/assets/stylesheets/bootstrap/_carousel.scss +269 -0
- data/app/assets/stylesheets/bootstrap/_close.scss +36 -0
- data/app/assets/stylesheets/bootstrap/_code.scss +69 -0
- data/app/assets/stylesheets/bootstrap/_component-animations.scss +38 -0
- data/app/assets/stylesheets/bootstrap/_dropdowns.scss +214 -0
- data/app/assets/stylesheets/bootstrap/_forms.scss +570 -0
- data/app/assets/stylesheets/bootstrap/_glyphicons.scss +301 -0
- data/app/assets/stylesheets/bootstrap/_grid.scss +84 -0
- data/app/assets/stylesheets/bootstrap/_input-groups.scss +166 -0
- data/app/assets/stylesheets/bootstrap/_jumbotron.scss +50 -0
- data/app/assets/stylesheets/bootstrap/_labels.scss +66 -0
- data/app/assets/stylesheets/bootstrap/_list-group.scss +124 -0
- data/app/assets/stylesheets/bootstrap/_media.scss +61 -0
- data/app/assets/stylesheets/bootstrap/_mixins.scss +39 -0
- data/app/assets/stylesheets/bootstrap/_modals.scss +148 -0
- data/app/assets/stylesheets/bootstrap/_navbar.scss +663 -0
- data/app/assets/stylesheets/bootstrap/_navs.scss +244 -0
- data/app/assets/stylesheets/bootstrap/_normalize.scss +427 -0
- data/app/assets/stylesheets/bootstrap/_pager.scss +54 -0
- data/app/assets/stylesheets/bootstrap/_pagination.scss +88 -0
- data/app/assets/stylesheets/bootstrap/_panels.scss +265 -0
- data/app/assets/stylesheets/bootstrap/_popovers.scss +135 -0
- data/app/assets/stylesheets/bootstrap/_print.scss +107 -0
- data/app/assets/stylesheets/bootstrap/_progress-bars.scss +87 -0
- data/app/assets/stylesheets/bootstrap/_responsive-embed.scss +35 -0
- data/app/assets/stylesheets/bootstrap/_responsive-utilities.scss +177 -0
- data/app/assets/stylesheets/bootstrap/_scaffolding.scss +150 -0
- data/app/assets/stylesheets/bootstrap/_tables.scss +234 -0
- data/app/assets/stylesheets/bootstrap/_theme.scss +273 -0
- data/app/assets/stylesheets/bootstrap/_thumbnails.scss +38 -0
- data/app/assets/stylesheets/bootstrap/_tooltip.scss +103 -0
- data/app/assets/stylesheets/bootstrap/_type.scss +298 -0
- data/app/assets/stylesheets/bootstrap/_utilities.scss +56 -0
- data/app/assets/stylesheets/bootstrap/_variables.scss +862 -0
- data/app/assets/stylesheets/bootstrap/_wells.scss +29 -0
- data/app/assets/stylesheets/bootstrap/mixins/_alerts.scss +14 -0
- data/app/assets/stylesheets/bootstrap/mixins/_background-variant.scss +11 -0
- data/app/assets/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
- data/app/assets/stylesheets/bootstrap/mixins/_buttons.scss +52 -0
- data/app/assets/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
- data/app/assets/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
- data/app/assets/stylesheets/bootstrap/mixins/_forms.scss +88 -0
- data/app/assets/stylesheets/bootstrap/mixins/_gradients.scss +58 -0
- data/app/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +81 -0
- data/app/assets/stylesheets/bootstrap/mixins/_grid.scss +122 -0
- data/app/assets/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
- data/app/assets/stylesheets/bootstrap/mixins/_image.scss +33 -0
- data/app/assets/stylesheets/bootstrap/mixins/_labels.scss +12 -0
- data/app/assets/stylesheets/bootstrap/mixins/_list-group.scss +31 -0
- data/app/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
- data/app/assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +9 -0
- data/app/assets/stylesheets/bootstrap/mixins/_opacity.scss +8 -0
- data/app/assets/stylesheets/bootstrap/mixins/_pagination.scss +23 -0
- data/app/assets/stylesheets/bootstrap/mixins/_panels.scss +24 -0
- data/app/assets/stylesheets/bootstrap/mixins/_progress-bar.scss +10 -0
- data/app/assets/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
- data/app/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
- data/app/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +21 -0
- data/app/assets/stylesheets/bootstrap/mixins/_size.scss +10 -0
- data/app/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
- data/app/assets/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
- data/app/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +11 -0
- data/app/assets/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
- data/app/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +222 -0
- data/app/assets/stylesheets/events/_event-list-item.scss +85 -0
- data/app/assets/stylesheets/events/_event_template.scss +66 -0
- data/app/assets/stylesheets/events/_filter-bar.scss +5 -0
- data/app/assets/stylesheets/festivity.scss +35 -0
- data/app/assets/stylesheets/skins/pghkids/_events.scss +17 -0
- data/app/assets/stylesheets/skins/pghkids/_footer.scss +22 -0
- data/app/assets/stylesheets/skins/pghkids/_global.scss +42 -0
- data/app/assets/stylesheets/skins/pghkids/_header.scss +27 -0
- data/app/assets/stylesheets/skins/pghkids/_home.scss +113 -0
- data/app/assets/stylesheets/skins/pghkids/skin.scss +8 -0
- data/app/assets/stylesheets/vars/_vars_color.scss +6 -0
- data/app/assets/stylesheets/vars/_vars_media-queries.scss +5 -0
- data/app/assets/stylesheets/vars/_vars_type.scss +1 -0
- data/app/controllers/admin/festivity_categories_controller.rb +31 -0
- data/app/controllers/admin/festivity_category_types_controller.rb +31 -0
- data/app/controllers/admin/festivity_performances_controller.rb +21 -0
- data/app/controllers/festivity_events_controller.rb +71 -0
- data/app/controllers/festivity_location_areas_controller.rb +17 -0
- data/app/controllers/festivity_locations_controller.rb +19 -0
- data/app/controllers/search_controller.rb +17 -0
- data/app/helpers/admin/festivity_performances_helper.rb +3 -0
- data/app/helpers/admin/snippets_helper.rb +3 -0
- data/app/helpers/festivity_events_helper.rb +12 -0
- data/app/helpers/festivity_locations_helper.rb +4 -0
- data/app/models/festivity_base_page.rb +23 -0
- data/app/models/festivity_category.rb +17 -0
- data/app/models/festivity_category_type.rb +14 -0
- data/app/models/festivity_event_list.rb +90 -0
- data/app/models/festivity_event_list/festivity_event.rb +40 -0
- data/app/models/festivity_event_list/festivity_event_performance.rb +10 -0
- data/app/models/festivity_event_list/festivity_location.rb +15 -0
- data/app/models/festivity_event_page.rb +55 -0
- data/app/models/festivity_location_area_page.rb +5 -0
- data/app/models/festivity_location_page.rb +3 -0
- data/app/models/festivity_market_page.rb +3 -0
- data/app/models/festivity_page_category.rb +4 -0
- data/app/models/festivity_performance.rb +29 -0
- data/app/views/admin/pages/_festivity_base_fields.html.haml +75 -0
- data/app/views/admin/pages/_festivity_featured_image_fields.html.haml +3 -0
- data/app/views/admin/pages/_festivity_includes.html.haml +2 -0
- data/app/views/admin/pages/_festivity_location_fields.html.haml +26 -0
- data/app/views/admin/pages/partials/_categories.html.haml +18 -0
- data/app/views/admin/pages/partials/_category.html.haml +4 -0
- data/app/views/admin/pages/partials/_featured_image.html.haml +18 -0
- data/app/views/admin/pages/partials/_performance.html.haml +13 -0
- data/app/views/admin/pages/partials/_performances.html.haml +11 -0
- data/app/views/admin/pages/partials/_performances_table.html.haml +15 -0
- data/app/views/admin/sites/_festivity_site_fields.html.haml +26 -0
- data/app/views/admin/sites/partials/_category.html.haml +7 -0
- data/app/views/admin/sites/partials/_category_popup.html.haml +19 -0
- data/app/views/admin/sites/partials/_category_popups.haml +27 -0
- data/app/views/admin/sites/partials/_category_section.html.haml +7 -0
- data/app/views/admin/sites/partials/_category_types.html.haml +23 -0
- data/app/views/admin/sites/partials/_filters.html.haml +25 -0
- data/app/views/admin/sites/partials/_new_category.html.haml +3 -0
- data/app/views/admin/sites/partials/_new_category_type.html.haml +3 -0
- data/app/views/festivity_events/_event_filters.html.haml +39 -0
- data/app/views/festivity_events/_event_list.html.haml +62 -0
- data/app/views/festivity_events/_filter_bar_mobile.html.haml +22 -0
- data/app/views/festivity_events/index.html.haml +34 -0
- data/app/views/festivity_events/show.html.haml +152 -0
- data/app/views/festivity_location_areas/show.html.haml +29 -0
- data/app/views/festivity_locations/show.html.haml +66 -0
- data/app/views/header/_meta_tags.html.haml +8 -0
- data/app/views/navigation/_subnav_one_column.html.haml +15 -0
- data/app/views/navigation/_subnav_three_column.html.haml +7 -0
- data/app/views/navigation/_three_column_item.html.haml +11 -0
- data/app/views/search/_page.html.haml +1 -0
- data/app/views/search/_pagination_links.html.haml +7 -0
- data/app/views/search/_result_item.html.haml +6 -0
- data/app/views/search/show.html.haml +19 -0
- data/config/initializers/pluralizations.rb +0 -0
- data/config/initializers/radiant_config.rb +1 -0
- data/config/locales/en.yml +16 -0
- data/config/routes.rb +14 -0
- data/config/trustygems.yml +2 -0
- data/db/content/layouts/base.html +174 -0
- data/db/content/layouts/normal.html +5 -0
- data/db/fixtures/home_pages.yml +40 -0
- data/db/fixtures/layouts.yml +2 -0
- data/db/fixtures/pages.yml +23 -0
- data/db/fixtures/sites.yml +57 -0
- data/db/fixtures/users.yml +8 -0
- data/db/migrate/200150325136087799_add_event_performances_view.rb +27 -0
- data/db/migrate/200150425136087799_update_event_performances_view_with_site.rb +27 -0
- data/db/migrate/20150123175758_add_site_fields.rb +15 -0
- data/db/migrate/20150127090858995_add_base_event_fields.rb +24 -0
- data/db/migrate/20150127091005232_add_market_and_event_fields.rb +29 -0
- data/db/migrate/20150204113325731_add_category_types_table.rb +15 -0
- data/db/migrate/20150204113427832_add_categories_table.rb +15 -0
- data/db/migrate/20150204113510326_add_page_categories_table.rb +12 -0
- data/db/migrate/20150226131727777_add_location_page_fields.rb +19 -0
- data/db/migrate/20150302135485569_add_performances_table.rb +19 -0
- data/db/migrate/20150324135487799_add_indexes.rb +21 -0
- data/festivity_extension.rb +25 -0
- data/lib/festivity/admin/assets_helper.rb +17 -0
- data/lib/festivity/engine.rb +9 -0
- data/lib/festivity/extensions/page_extensions.rb +61 -0
- data/lib/festivity/extensions/pages_helper_extensions.rb +11 -0
- data/lib/festivity/extensions/paperclipped_extensions.rb +22 -0
- data/lib/festivity/extensions/site_extensions.rb +40 -0
- data/lib/festivity/mixins/not_found.rb +10 -0
- data/lib/tags/header_tags.rb +41 -0
- data/lib/tags/navigation_tags.rb +55 -0
- data/lib/tasks/active_record_utils.rb +35 -0
- data/lib/tasks/festivity_extension_tasks.rake +7 -0
- data/lib/tasks/setup.rake +101 -0
- data/lib/trusty-festivity-extension.rb +8 -0
- data/trusty-festivity-extension.gemspec +37 -0
- 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,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,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
|