trusty-festivity-extension 2.1.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +8 -8
  2. data/app/assets/javascripts/admin/sites/site_bindings.js +90 -0
  3. data/app/assets/stylesheets/admin/modules/_form_styles.scss +1 -1
  4. data/app/controllers/admin/festivity_performances_controller.rb +1 -1
  5. data/app/controllers/festivity_events_controller.rb +6 -4
  6. data/app/models/festivity_event_list.rb +13 -7
  7. data/app/models/festivity_performance.rb +2 -2
  8. data/app/presenters/festivity_date_presenter.rb +7 -0
  9. data/app/presenters/festivity_datetime_filter_presenter.rb +14 -0
  10. data/app/presenters/festivity_datetime_presenter.rb +36 -0
  11. data/app/presenters/festivity_time_presenter.rb +7 -0
  12. data/app/presenters/social/feed_presenter.rb +9 -0
  13. data/app/presenters/social/instagram_post_presenter.rb +44 -0
  14. data/app/services/instagram_feed_service.rb +13 -0
  15. data/app/services/social_feed_service.rb +18 -0
  16. data/app/views/admin/pages/partials/_performances.html.haml +1 -1
  17. data/app/views/admin/sites/_festivity_site_fields.html.haml +12 -4
  18. data/app/views/festivity_events/_event_filters.html.haml +12 -4
  19. data/app/views/festivity_events/_event_list.html.haml +1 -1
  20. data/app/views/festivity_events/show.html.haml +1 -1
  21. data/app/views/social/_instagram_posts.html.haml +4 -0
  22. data/db/migrate/20151018190155_update_site_for_hourly_filters.rb +14 -0
  23. data/db/migrate/20151105155407_add_buy_ticket_text_to_site.rb +5 -0
  24. data/festivity_extension.rb +2 -0
  25. data/lib/festivity/extensions/site_extensions.rb +19 -6
  26. data/lib/tags/social_feed_tags.rb +16 -0
  27. data/lib/trusty-festivity-extension.rb +1 -1
  28. data/trusty-festivity-extension.gemspec +3 -0
  29. metadata +56 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODcyMWZmMTZkNGUyNDhjZWE3YmI0Y2M2MmVhNzZhYzJjYzliZmI1ZA==
4
+ ZDAxODFiOTU5ZTc5NzMwOGNiNjhlYWFlMmRlZTQ4ZWMzMmFiZTY0YQ==
5
5
  data.tar.gz: !binary |-
6
- YzZiZmVlODhiNjM0M2ZhZTQyNDIyNTVmMjAwM2ExMDI5NjJjNzQ4ZQ==
6
+ ODRhMjdkZWZiMzg1Mzk3ZjBiNjBmYWYwNjc3ODJmNWNmYjcxOTkxZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjczYzlhMzMwZDkzNmM0OWYwOGE5NjRkYjdhODc4ODdkYjk0ZWMzZjc1N2Uy
10
- ZWU4M2FlZGNhYmQ3NTE4MTdlYmU1NTIwOGVjZjRkNTU3YTQ2NzUyMTA0ZGJm
11
- NzJhZTFmZWRjYjJmOGY5MjU3MzAyMTc3ZDI3ODkyYTEzMTFlNDI=
9
+ YTk1YjNlOTQzY2QzZjIzYzQ4ZTFlNTBiMDAzODliMGMyMzZmNzZlMzUyNTc0
10
+ NjY5NjdjN2IwOGJkNjkwNGJiODMxNGFlODc4OWJkZTY5ZjY3Y2U0MTI1ZTI1
11
+ OThjN2VlMzAwYTAyNGZlYTQyM2NmNWVmODYyYjg0YTZkZGJlM2M=
12
12
  data.tar.gz: !binary |-
13
- Nzk0YzI2MjgxOWEyMWRjZWUxYmViMDg4MjZkMjhhMDdjZWJlYmYzNjJlMDdm
14
- OTQwMWQzOWM0MTU1OWVhZDU3MWQ2NTkzMmM4OWQwZmI5MTVmZTI4N2RlYjA1
15
- MDg4MDJiMmVjZjY4OThmMjE0OWY2NjYzZjRmYjViOThlYWQxN2Y=
13
+ YzIyNWRhMWUxYWMwMjkxZWQ2NjYwOTdhZjM2MGIwNDAwZTZiNTAwNTAyNGNl
14
+ ZmQ2MTEzYjRhYThjYTYyMWVjNjk1YzA2OGZjMmUwZDhlMjk0ODNjNDcwMzlk
15
+ ZjZhNmI2OWI3M2MyZDEzODMyNGVhNzVjOWIyNDM5NWVmZjQ5ZTY=
@@ -1,4 +1,94 @@
1
1
  $(function () {
2
+ $.extend($.inputmask.defaults.aliases, {
3
+ festivitydatetime12: {
4
+ mask: "1/2/y h:s t\\m",
5
+ placeholder: "mm/dd/yyyy hh:mm xm",
6
+ alias: "mm/dd/yyyy",
7
+ hourFormat: "12",
8
+ regex: {
9
+ hrspre: new RegExp("[012]"),
10
+ hrs24: new RegExp("2[0-4]|1[3-9]"),
11
+ hrs: new RegExp("[01][0-9]|2[0-4]"),
12
+ ampm: new RegExp("^[a|p|A|P][m|M]"),
13
+ mspre: new RegExp("[0-5]"),
14
+ ms: new RegExp("[0-5][0-9]")
15
+ },
16
+ timeseparator: ":",
17
+ definitions: {
18
+ h: {
19
+ validator: function(chrs, maskset, pos, strict, opts) {
20
+ if ("24" == opts.hourFormat && 24 == parseInt(chrs, 10)) return maskset.buffer[pos - 1] = "0",
21
+ maskset.buffer[pos] = "0", {
22
+ refreshFromBuffer: {
23
+ start: pos - 1,
24
+ end: pos
25
+ },
26
+ c: "0"
27
+ };
28
+ var isValid = opts.regex.hrs.test(chrs);
29
+ if (!strict && !isValid && (chrs.charAt(1) == opts.timeseparator || -1 != "-.:".indexOf(chrs.charAt(1))) && (isValid = opts.regex.hrs.test("0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0",
30
+ maskset.buffer[pos] = chrs.charAt(0), pos++, {
31
+ refreshFromBuffer: {
32
+ start: pos - 2,
33
+ end: pos
34
+ },
35
+ pos: pos,
36
+ c: opts.timeseparator
37
+ };
38
+ if (isValid && "24" !== opts.hourFormat && opts.regex.hrs24.test(chrs)) {
39
+ var tmp = parseInt(chrs, 10);
40
+ return 24 == tmp ? (maskset.buffer[pos + 5] = "a", maskset.buffer[pos + 6] = "m") : (maskset.buffer[pos + 5] = "p",
41
+ maskset.buffer[pos + 6] = "m"), tmp -= 12, 10 > tmp ? (maskset.buffer[pos] = tmp.toString(),
42
+ maskset.buffer[pos - 1] = "0") : (maskset.buffer[pos] = tmp.toString().charAt(1),
43
+ maskset.buffer[pos - 1] = tmp.toString().charAt(0)), {
44
+ refreshFromBuffer: {
45
+ start: pos - 1,
46
+ end: pos + 6
47
+ },
48
+ c: maskset.buffer[pos]
49
+ };
50
+ }
51
+ return isValid;
52
+ },
53
+ cardinality: 2,
54
+ prevalidator: [ {
55
+ validator: function(chrs, maskset, pos, strict, opts) {
56
+ var isValid = opts.regex.hrspre.test(chrs);
57
+ return strict || isValid || !(isValid = opts.regex.hrs.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
58
+ pos++, {
59
+ pos: pos
60
+ });
61
+ },
62
+ cardinality: 1
63
+ } ]
64
+ },
65
+ s: {
66
+ validator: "[0-5][0-9]",
67
+ cardinality: 2,
68
+ prevalidator: [ {
69
+ validator: function(chrs, maskset, pos, strict, opts) {
70
+ var isValid = opts.regex.mspre.test(chrs);
71
+ return strict || isValid || !(isValid = opts.regex.ms.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
72
+ pos++, {
73
+ pos: pos
74
+ });
75
+ },
76
+ cardinality: 1
77
+ } ]
78
+ },
79
+ t: {
80
+ validator: function(chrs, maskset, pos, strict, opts) {
81
+ return opts.regex.ampm.test(chrs + "m");
82
+ },
83
+ casing: "lower",
84
+ cardinality: 1
85
+ }
86
+ },
87
+ insertMode: !1,
88
+ autoUnmask: !1
89
+ }
90
+ });
2
91
  Festivity.CategoryTypes.bindEvents();
3
92
  Festivity.Categories.bindEvents(null);
93
+ $(".date_field").inputmask("festivitydatetime12");
4
94
  });
@@ -14,7 +14,7 @@
14
14
  .festivity-title {
15
15
  margin: 2em 0;
16
16
  padding: 1em .5em;
17
- background-color: $dark-background;
17
+ background-color: $light-background;
18
18
  }
19
19
 
20
20
  .festivity-error {
@@ -3,7 +3,7 @@ class Admin::FestivityPerformancesController < Admin::ResourceController
3
3
  event = FestivityEventPage.find(params[:event_page_id])
4
4
  performance = event.festivity_performances.new
5
5
  if performance.save
6
- render partial: 'admin/pages/partials/performance', :locals => { :performance => performance, :locations => FestivityLocationPage.all }
6
+ render partial: 'admin/pages/partials/performance', :locals => {:performance => performance, :locations => FestivityLocationPage.where(site_id: event.site.id) }
7
7
  else
8
8
  render status: :bad_request
9
9
  end
@@ -9,10 +9,12 @@ class FestivityEventsController < ApplicationController
9
9
  def index
10
10
  order_by = params[:sort] ? params[:sort] : "start_date"
11
11
  @title = "#{current_site.festivity_festival_name}: Events"
12
+ @filter_type = current_site.festivity_filter_type
12
13
  @events = Rails.cache.fetch("#{cache_key}", expires_in: 2.hours) do
13
14
  FestivityEventList.search(
14
15
  {dates: search_dates.join(","),
15
- categories: params[:categories]},
16
+ categories: params[:categories],
17
+ filter_type: current_site.festivity_filter_type},
16
18
  order_by).events
17
19
  end
18
20
 
@@ -59,9 +61,9 @@ class FestivityEventsController < ApplicationController
59
61
  end
60
62
 
61
63
  def collect_festival_dates
62
- festival_dates = current_site.festival_dates
63
- if current_site.date_during_festival?(Date.today)
64
- festival_dates = festival_dates.select{ |date| date == Date.today }
64
+ festival_dates = current_site.festival_datetimes
65
+ if current_site.date_during_festival?(DateTime.now)
66
+ festival_dates = festival_dates.select{ |date| date == DateTime.now }
65
67
  end
66
68
 
67
69
  festival_dates.map{ |date| date.to_s }
@@ -51,16 +51,16 @@ class FestivityEventList
51
51
  private
52
52
 
53
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
54
+ def self.event_ids_for_datetimes(datetimes, filter_type)
55
+ FestivityEventList::FestivityEventPerformance.where(datetime_criteria(datetimes, filter_type)).map {|e| e.event_id}.uniq
56
56
  end
57
57
 
58
58
  # Create a condition for start and end date between midnight and 11:59pm
59
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)
60
+ def self.datetime_criteria(datetimes_string, filter_type)
61
+ date_queries = datetimes_string.split(',').map do |date_string|
62
+ start_date = DateTime.parse(URI.decode(date_string))
63
+ end_date = start_date.advance(advance_by(filter_type))
64
64
  <<-SQL
65
65
  (
66
66
  (start_date >= '#{start_date}' AND start_date <= '#{end_date}')
@@ -72,13 +72,19 @@ class FestivityEventList
72
72
  date_queries.join(" OR ")
73
73
  end
74
74
 
75
+ def self.advance_by(filter_type)
76
+ advance_by_hash = {minutes: 59}
77
+ advance_by_hash[:hours] = 23 if filter_type == "date"
78
+ advance_by_hash
79
+ end
80
+
75
81
  # The order of querying, depending on what is passed:
76
82
  # - If dates are passed, we search both start and end date between midnight and 11:59pm of that date.
77
83
  # That query returns any matching event ids.
78
84
  # - The event ids returned, if any, are added to the where clause for the next query
79
85
  # - Any category ids passed are added to the where clause as well.
80
86
  def self.parse_criteria(criteria)
81
- event_ids = event_ids_for_dates(criteria[:dates]) if criteria[:dates]
87
+ event_ids = event_ids_for_datetimes(criteria[:dates], criteria[:filter_type]) if criteria[:dates]
82
88
  where_clause = "site_id = #{ Page.current_site.id}"
83
89
  where_clause += " AND event_id IN (#{event_ids.join(",")})" if event_ids.present?
84
90
  where_clause += " AND #{parse_categories(criteria[:categories].split(","))}" if criteria[:categories]
@@ -2,6 +2,7 @@ class FestivityPerformance < ActiveRecord::Base
2
2
  validates_presence_of :event_page_id
3
3
  belongs_to :festivity_event_page, foreign_key: :event_page_id
4
4
  belongs_to :festivity_location_page, foreign_key: :location_page_id
5
+ default_scope {order :start_date}
5
6
 
6
7
  attr_accessible :start_date, :end_date, :festivity_location_page, :notes
7
8
 
@@ -20,8 +21,7 @@ class FestivityPerformance < ActiveRecord::Base
20
21
  private
21
22
 
22
23
  def parse_date(date)
23
- time = Time.strptime("#{date}", '%m/%d/%Y %I:%M %p')
24
- Time.zone.local(time.year, time.month, time.day, time.hour, time.min, time.sec)
24
+ Time.parse(Time.strptime(date, "%m/%d/%Y %l:%M %P").to_s)
25
25
  rescue
26
26
  nil
27
27
  end
@@ -0,0 +1,7 @@
1
+ class FestivityDatePresenter < FestivityDatetimePresenter
2
+
3
+ def display
4
+ display_as_date
5
+ end
6
+
7
+ end
@@ -0,0 +1,14 @@
1
+ class FestivityDatetimeFilterPresenter
2
+
3
+ def self.new(datetimes, datetime_type)
4
+ datetimes.map { |datetime| datetime_type_class(datetime_type).new(datetime) }
5
+
6
+ end
7
+
8
+ private
9
+
10
+ def self.datetime_type_class(datetime_type)
11
+ datetime_type == "date" ? FestivityDatePresenter : FestivityTimePresenter
12
+ end
13
+
14
+ end
@@ -0,0 +1,36 @@
1
+ class FestivityDatetimePresenter
2
+ attr_reader :datetime
3
+
4
+ def initialize(datetime)
5
+ @datetime = datetime
6
+ end
7
+
8
+ def display_as_date
9
+ @datetime.strftime("%a, %B %-d")
10
+ end
11
+
12
+ def to_s
13
+ @datetime.to_s
14
+ end
15
+
16
+ def to_date
17
+ @datetime.to_date
18
+ end
19
+
20
+ def display_as_time_range
21
+ "#{display_start_time} - #{display_end_time}"
22
+ end
23
+
24
+ def display_start_time
25
+ @datetime.strftime(display_time_format)
26
+ end
27
+
28
+ def display_end_time
29
+ (@datetime + 1.hour).strftime(display_time_format)
30
+ end
31
+
32
+ def display_time_format
33
+ "%l:%M %P"
34
+ end
35
+
36
+ end
@@ -0,0 +1,7 @@
1
+ class FestivityTimePresenter < FestivityDatetimePresenter
2
+
3
+ def display
4
+ display_as_time_range
5
+ end
6
+
7
+ end
@@ -0,0 +1,9 @@
1
+ module Social
2
+ class FeedPresenter
3
+
4
+ def initializer
5
+
6
+ end
7
+
8
+ end
9
+ end
@@ -0,0 +1,44 @@
1
+ Social::InstagramPostPresenter = ImmutableStruct.new(
2
+ :user_full_name,
3
+ :user_id,
4
+ :user_profile_picture_url,
5
+ :user_username,
6
+ :id,
7
+ :text,
8
+ :filter,
9
+ :id,
10
+ :low_res_image_url,
11
+ :low_res_image_height,
12
+ :low_res_image_width,
13
+ :standard_res_image_url,
14
+ :standard_res_image_height,
15
+ :standard_res_image_width,
16
+ :thumbnail_image_url,
17
+ :thumbnail_res_image_height,
18
+ :thumbnail_res_image_width,
19
+ :url,
20
+ :created_time
21
+ ) do
22
+
23
+ def self.from_instagram_post(post)
24
+ self.new(user_profile_picture_url: post.user.profile_picture,
25
+ user_full_name: post.user.full_name,
26
+ user_id: post.user.id,
27
+ user_username: post.user.username,
28
+ id: post.id,
29
+ created_time: Time.at(post.created_time.to_i),
30
+ text: post.caption.text,
31
+ filter: post.filter,
32
+ low_res_image_url: post.images.low_resolution.url,
33
+ low_res_image_height: post.images.low_resolution.height,
34
+ low_res_image_width: post.images.low_resolution.width,
35
+ standard_res_image_url: post.images.standard_resolution.url,
36
+ standard_res_image_height: post.images.standard_resolution.height,
37
+ standard_res_image_width: post.images.standard_resolution.width,
38
+ thumbnail_image_url: post.images.thumbnail.url,
39
+ thumbnail_image_height: post.images.thumbnail.height,
40
+ thumbnail_image_width: post.images.thumbnail.width,
41
+ url: post.link)
42
+
43
+ end
44
+ end
@@ -0,0 +1,13 @@
1
+ class InstagramFeedService
2
+
3
+ def initialize
4
+ @client = Instagram.client
5
+ end
6
+
7
+ def get_feed_for_tag(tag)
8
+ @client.tag_recent_media(tag).map do |post|
9
+ Social::InstagramPostPresenter.from_instagram_post(post)
10
+ end
11
+ end
12
+
13
+ end
@@ -0,0 +1,18 @@
1
+ class SocialFeedService
2
+
3
+ def initialize
4
+
5
+ end
6
+
7
+ def get_feed(options)
8
+
9
+ end
10
+
11
+
12
+ private
13
+
14
+ def query_feeds(options)
15
+
16
+ end
17
+
18
+ end
@@ -1,4 +1,4 @@
1
- - locations = FestivityLocationPage.all
1
+ - locations = FestivityLocationPage.where(site_id: @page.site.id)
2
2
  .festivity-full.festivity-list.festivity-div
3
3
  = render partial: 'admin/pages/partials/performances_table', locals: {performances: performances, locations: locations, page_id: page_id}
4
4
  .right
@@ -12,12 +12,20 @@
12
12
  = self.text_field( :site, :festivity_festival_name, class: "textbox festivity-control")
13
13
  %p.festivity-third
14
14
  %label{for: "site_festivity_start_date"}
15
- Start Date
16
- = self.text_field :site, :festivity_start_date, :class=> "textbox date festivity-control", :type=>"date", :value => (@site.festivity_start_date ? I18n.localize(@site.festivity_start_date.to_date, :format =>:default) : nil)
15
+ Festival Start
16
+ = self.text_field :site, :festivity_start_date, :class=> "date_field textbox date festivity-control", :value => (@site.festivity_start_date ? format_date(@site.festivity_start_date) : nil)
17
17
  %p.festivity-third
18
18
  %label{for: "site_festivity_end_date"}
19
- End Date
20
- = self.text_field :site, :festivity_end_date, :class=> "textbox date festivity-control", :type=>"date", :value => (@site.festivity_end_date ? I18n.localize(@site.festivity_end_date.to_date, :format =>:default) : nil)
19
+ Festival End
20
+ = self.text_field :site, :festivity_end_date, :class=> "date_field textbox date festivity-control", :value => (@site.festivity_end_date ? format_date(@site.festivity_end_date) : nil)
21
+ %p.festivity-third
22
+ %label{for: "site_festivity_end_date"}
23
+ Festival Filter Type
24
+ = self.select :site, :festivity_filter_type, [['Date', 'date'], ['Time', 'time']], :class=> "textbox festivity-control"
25
+ %p.festivity-third
26
+ %label{for: "site_festivity_end_date"}
27
+ Buy Tickets Button Text
28
+ = self.text_field :site, :festivity_buy_ticket_text, :class=> "textbox festivity-control"
21
29
  %p.festivity-third
22
30
  %label{for: "site_festivity_google_api_key"}
23
31
  Google Search API Key
@@ -1,3 +1,4 @@
1
+ - current_date = FestivityDatetimePresenter.new current_site.festival_datetimes.first.datetime - 1.day
1
2
  .events-filter-bar__wrapper
2
3
 
3
4
  %p.event-filter-bar__header
@@ -8,17 +9,24 @@
8
9
  Done
9
10
 
10
11
  %form
12
+ -
11
13
  %div#collapse-wrapper{data: {collapse: true}}
12
14
  %h3.open
13
15
  Dates
14
16
  %ul.filter-bar_filters.date-filters
15
- - current_site.festival_dates.each do |day|
17
+ - current_site.festival_datetimes.each do |datetime|
18
+ - unless current_site.date_filter?
19
+ - unless current_date.to_date == datetime.to_date
20
+ - current_date = datetime
21
+ %li
22
+ %h4
23
+ = current_date.display_as_date
16
24
  %li
17
25
  .checkbox
18
26
  %label
19
- - checked = @selected_dates.include? day.to_s
20
- %input{type: "checkbox", value: day.to_s, checked: checked, data: {filter: "Date", sort: day.to_s}}
21
- = day.strftime("%a, %B %-d")
27
+ - checked = @selected_dates.include? datetime
28
+ %input{type: "checkbox", value: datetime.to_s, checked: checked, data: {filter: "Date", sort: datetime.to_s}}
29
+ = datetime.display
22
30
  - current_site.festivity_active_category_types.each do |type|
23
31
  %h3
24
32
  = type.name
@@ -56,7 +56,7 @@
56
56
  .event-list-item__button-group
57
57
  = link_to "Details", event_path(event.id), class: 'btn event-list-item__btn'
58
58
  - unless event.buy_url.blank?
59
- = link_to "Tickets", "#{event.buy_url}", class: 'btn event-list-item__btn', target: '_blank'
59
+ = link_to current_site.festivity_buy_ticket_text, "#{event.buy_url}", class: 'btn event-list-item__btn', target: '_blank'
60
60
  -#%button.btn.event-list-item__btn{href: "", data: {toggle:"modal", target:"#share-modal"}, type: "button"}
61
61
  Share
62
62
  - unless event.locations.first.directions_url.blank?
@@ -18,7 +18,7 @@
18
18
  - if @event.can_buy?
19
19
  .tickets.sidebar-item
20
20
  %a.tickets-button.btn.btn-primary.btn-lg.btn-block{href: "#{@event.buy_url}", target: "_blank"}
21
- Buy Tickets
21
+ = current_site.festivity_buy_ticket_text
22
22
  .event-sidebar__location.sidebar-item
23
23
  %ul.list-group
24
24
  %li.list-group-item.list-group-title
@@ -0,0 +1,4 @@
1
+ .social-posts
2
+ - posts.each do |post|
3
+ "BUTTS"
4
+ = post.text
@@ -0,0 +1,14 @@
1
+ class UpdateSiteForHourlyFilters < ActiveRecord::Migration
2
+ def up
3
+ change_column :sites, :festivity_start_date, :datetime
4
+ change_column :sites, :festivity_end_date, :datetime
5
+ add_column :sites, :festivity_filter_type, :string
6
+
7
+ end
8
+
9
+ def down
10
+ change_column :sites, :festivity_start_date, :date
11
+ change_column :sites, :festivity_end_date, :date
12
+ remove_column :sites, :festivity_filter_type, :string
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ class AddBuyTicketTextToSite < ActiveRecord::Migration
2
+ def change
3
+ add_column :sites, :festivity_buy_ticket_text, :string, default: "Buy Tickets"
4
+ end
5
+ end
@@ -19,8 +19,10 @@ class FestivityExtension < TrustyCms::Extension
19
19
  Site.send :include, Festivity::Extensions::SiteExtensions
20
20
  Page.send :include, Festivity::Extensions::PageExtensions
21
21
  Admin::PagesHelper.send :include, Festivity::Extensions::PagesHelperExtensions
22
+ Admin::SitesHelper.send :include, Festivity::Extensions::PagesHelperExtensions
22
23
  Page.send :include, Tags::NavigationTags
23
24
  Page.send :include, Tags::HeaderTags
25
+ Page.send :include, Tags::SocialFeedTags
24
26
  end
25
27
 
26
28
  end
@@ -11,28 +11,41 @@ module Festivity
11
11
 
12
12
  module SiteMethods
13
13
 
14
+ def festivity_start_date=(value)
15
+ super(Time.strptime(value, "%m/%d/%Y %l:%M %P"))
16
+ end
17
+
18
+ def festivity_end_date=(value)
19
+ super(Time.strptime(value, "%m/%d/%Y %l:%M %P"))
20
+ end
21
+
14
22
  def festivity_active_category_types
15
23
  self.festivity_category_types.where(["inactive = false"])
16
24
  end
17
25
 
18
26
  def date_during_festival?(date)
19
- self.festival_dates.include?(date)
27
+ self.festival_datetimes.include?(date)
20
28
  end
21
29
 
22
- def festival_dates
23
- @festival_dates ||= calculate_festival_dates
30
+ def festival_datetimes
31
+ @festival_datetimes ||= calculate_festival_datetimes
24
32
  end
25
33
 
26
- def calculate_festival_dates
34
+ def calculate_festival_datetimes
27
35
  dates = [self.festivity_start_date]
36
+ advance_by = date_filter? ? {days: 1} : {hours: 1}
28
37
  until dates.last >= self.festivity_end_date do
29
- dates << dates.last.advance(days: 1)
38
+ dates << dates.last.advance(advance_by)
30
39
  end
31
- dates
40
+ FestivityDatetimeFilterPresenter.new(dates, self.festivity_filter_type)
32
41
  rescue
33
42
  []
34
43
  end
35
44
 
45
+ def date_filter?
46
+ self.festivity_filter_type == "date"
47
+ end
48
+
36
49
  end
37
50
 
38
51
  end
@@ -0,0 +1,16 @@
1
+ module Tags::SocialFeedTags
2
+ include TrustyCms::Taggable
3
+
4
+ desc %{Instagram posts feed
5
+
6
+ *Usage:*
7
+ <pre><code><r:instagram_posts tag="culturaltrust">/code></pre>}
8
+ tag "instagram_posts" do |tag|
9
+
10
+ posts = InstagramFeedService.new.get_feed_for_tag(tag.attr['tag'])
11
+ request.env["action_controller.instance"].render_to_string :partial => "social/instagram_posts",
12
+ :locals => {:posts => posts}
13
+
14
+ end
15
+
16
+ end
@@ -1,5 +1,5 @@
1
1
  module TrustyFestivityExtension
2
- VERSION = "2.1.1"
2
+ VERSION = "2.2.0"
3
3
  SUMMARY = "Festival microsite engine for Trusty CMS"
4
4
  DESCRIPTION = "Event management for arts festivals."
5
5
  URL = "http://github.com/pgharts/trusty-festivity-extension"
@@ -31,6 +31,9 @@ Gem::Specification.new do |s|
31
31
  s.add_dependency "trusty-multi-site-extension" , "~> 2.0"
32
32
  s.add_dependency 'actionpack-action_caching' , '~> 1.1.1'
33
33
  s.add_dependency 'dalli-elasticache' ,'~> 0.1.2'
34
+ s.add_dependency 'instagram' , '~> 1.1'
35
+ s.add_dependency 'twitter' , '~> 5.15'
36
+ s.add_dependency 'immutable-struct' , '~> 2.1'
34
37
 
35
38
  s.add_dependency 'trusty_google_custom_search'
36
39
  s.add_dependency 'fog' , "~> 1.26"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trusty-festivity-extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Sipple
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-10 00:00:00.000000000 Z
11
+ date: 2015-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trusty-cms
@@ -136,6 +136,48 @@ dependencies:
136
136
  - - ~>
137
137
  - !ruby/object:Gem::Version
138
138
  version: 0.1.2
139
+ - !ruby/object:Gem::Dependency
140
+ name: instagram
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ~>
144
+ - !ruby/object:Gem::Version
145
+ version: '1.1'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ~>
151
+ - !ruby/object:Gem::Version
152
+ version: '1.1'
153
+ - !ruby/object:Gem::Dependency
154
+ name: twitter
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ~>
158
+ - !ruby/object:Gem::Version
159
+ version: '5.15'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ~>
165
+ - !ruby/object:Gem::Version
166
+ version: '5.15'
167
+ - !ruby/object:Gem::Dependency
168
+ name: immutable-struct
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ~>
172
+ - !ruby/object:Gem::Version
173
+ version: '2.1'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ~>
179
+ - !ruby/object:Gem::Version
180
+ version: '2.1'
139
181
  - !ruby/object:Gem::Dependency
140
182
  name: trusty_google_custom_search
141
183
  requirement: !ruby/object:Gem::Requirement
@@ -358,6 +400,14 @@ files:
358
400
  - app/models/festivity_market_page.rb
359
401
  - app/models/festivity_page_category.rb
360
402
  - app/models/festivity_performance.rb
403
+ - app/presenters/festivity_date_presenter.rb
404
+ - app/presenters/festivity_datetime_filter_presenter.rb
405
+ - app/presenters/festivity_datetime_presenter.rb
406
+ - app/presenters/festivity_time_presenter.rb
407
+ - app/presenters/social/feed_presenter.rb
408
+ - app/presenters/social/instagram_post_presenter.rb
409
+ - app/services/instagram_feed_service.rb
410
+ - app/services/social_feed_service.rb
361
411
  - app/views/admin/pages/_festivity_base_fields.html.haml
362
412
  - app/views/admin/pages/_festivity_featured_image_fields.html.haml
363
413
  - app/views/admin/pages/_festivity_includes.html.haml
@@ -392,6 +442,7 @@ files:
392
442
  - app/views/search/_pagination_links.html.haml
393
443
  - app/views/search/_result_item.html.haml
394
444
  - app/views/search/show.html.haml
445
+ - app/views/social/_instagram_posts.html.haml
395
446
  - config/initializers/pluralizations.rb
396
447
  - config/initializers/radiant_config.rb
397
448
  - config/locales/en.yml
@@ -415,6 +466,8 @@ files:
415
466
  - db/migrate/20150226131727777_add_location_page_fields.rb
416
467
  - db/migrate/20150302135485569_add_performances_table.rb
417
468
  - db/migrate/20150324135487799_add_indexes.rb
469
+ - db/migrate/20151018190155_update_site_for_hourly_filters.rb
470
+ - db/migrate/20151105155407_add_buy_ticket_text_to_site.rb
418
471
  - festivity_extension.rb
419
472
  - lib/festivity/admin/assets_helper.rb
420
473
  - lib/festivity/engine.rb
@@ -425,6 +478,7 @@ files:
425
478
  - lib/festivity/mixins/not_found.rb
426
479
  - lib/tags/header_tags.rb
427
480
  - lib/tags/navigation_tags.rb
481
+ - lib/tags/social_feed_tags.rb
428
482
  - lib/tasks/active_record_utils.rb
429
483
  - lib/tasks/festivity_extension_tasks.rake
430
484
  - lib/tasks/setup.rake