refinerycms-calendar 1.0.4 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/event_categories_controller.rb +5 -0
- data/app/controllers/events_controller.rb +1 -0
- data/app/helpers/events_helper.rb +6 -0
- data/app/models/event.rb +11 -3
- data/app/views/admin/events/_event.html.erb +1 -1
- data/app/views/admin/events/_form.html.erb +1 -1
- data/app/views/events/_event.html.erb +13 -5
- data/app/views/events/show.ics.erb +16 -0
- data/changelog.md +9 -0
- data/config/routes.rb +4 -2
- data/db/migrate/04_add_cached_slugs.rb +11 -0
- data/features/manage_events.feature +0 -10
- data/readme.md +2 -7
- data/refinerycms-calendar-1.0.4.gem +0 -0
- data/refinerycms-calendar.gemspec +1 -1
- data/spec/models/event_spec.rb +1 -6
- metadata +5 -2
@@ -5,6 +5,11 @@ class EventCategoriesController < ApplicationController
|
|
5
5
|
@event_category = EventCategory.find(params[:id])
|
6
6
|
@event_categories = EventCategory.all
|
7
7
|
@other_events = Event.live.limit(5)
|
8
|
+
# @events = @event_category.events.paginate({
|
9
|
+
# :page => params[:page],
|
10
|
+
# :per_page => RefinerySetting.find_or_set(:events_per_page, 10)
|
11
|
+
# })
|
12
|
+
# render :template => 'events/index'
|
8
13
|
end
|
9
14
|
|
10
15
|
end
|
@@ -1,4 +1,10 @@
|
|
1
1
|
module EventsHelper
|
2
|
+
|
3
|
+
def custom_url_for(event, format = nil)
|
4
|
+
port = request.port == 80 ? nil : ":#{request.port}"
|
5
|
+
"#{request.protocol}#{request.host}#{port}/events/#{event.friendly_id}#{format}"
|
6
|
+
end
|
7
|
+
|
2
8
|
def events_archive_list
|
3
9
|
events = Event.select('start_at').for_archive_list
|
4
10
|
return nil if events.blank?
|
data/app/models/event.rb
CHANGED
@@ -16,7 +16,7 @@ class Event < ActiveRecord::Base
|
|
16
16
|
|
17
17
|
acts_as_indexed :fields => [:title, :venue_name, :venue_address, :ticket_link, :description]
|
18
18
|
|
19
|
-
validates :title, :presence => true
|
19
|
+
validates :title, :presence => true
|
20
20
|
validates :ticket_price, :numericality => true, :allow_blank => true
|
21
21
|
validates :ticket_link, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix, :allow_blank => true
|
22
22
|
validate :ends_after_start
|
@@ -48,11 +48,19 @@ class Event < ActiveRecord::Base
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def next
|
51
|
-
Event.where(['
|
51
|
+
Event.where(['start_at > ?', start_at]).first
|
52
52
|
end
|
53
53
|
|
54
54
|
def prev
|
55
|
-
Event.where(['
|
55
|
+
Event.where(['start_at < ?', start_at]).reverse.first
|
56
|
+
end
|
57
|
+
|
58
|
+
def single_day?
|
59
|
+
end_at.blank? || start_at.blank? || (end_at - start_at) < 24*60*60
|
60
|
+
end
|
61
|
+
|
62
|
+
def multi_day?
|
63
|
+
!single_day?
|
56
64
|
end
|
57
65
|
|
58
66
|
def self.archive
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(event) -%>">
|
2
2
|
<span class='title'>
|
3
|
-
<%= event.title %>
|
3
|
+
<%= truncate strip_tags(event.title), :length => 60 %>
|
4
4
|
<span class="preview">(<%= event.start_at.strftime('%b %d, %Y') %>) <%= '***Featured***' if event.featured? %></span>
|
5
5
|
</span>
|
6
6
|
<span class='actions'>
|
@@ -27,11 +27,19 @@
|
|
27
27
|
<%= event.venue_name %></p>
|
28
28
|
</section>
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
|
31
|
+
|
32
|
+
<% if event.venue_address.present? -%>
|
33
|
+
<section class="address">
|
34
|
+
<p>Address:<br/>
|
35
|
+
<%= event.venue_address %>
|
36
|
+
</p>
|
37
|
+
</section>
|
38
|
+
|
39
|
+
<section id="event_map">
|
40
|
+
<iframe width="400" height="200" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?q=<%= CGI::escape(event.venue_address) %>&z=14&output=embed"></iframe>
|
41
|
+
</section><!-- #event_map -->
|
42
|
+
<% end -%>
|
35
43
|
|
36
44
|
<% unless archive -%>
|
37
45
|
<% unless event.ticket_price.blank? -%>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
BEGIN:VCALENDAR
|
2
|
+
VERSION:2.0
|
3
|
+
PRODID:-//iCalendar export//EN
|
4
|
+
BEGIN:VEVENT
|
5
|
+
UID:<%= @event.id %>@<%= request.host %>
|
6
|
+
SUMMARY:<%= @event.title %>
|
7
|
+
DESCRIPTION:<%= truncate(strip_tags(@event.description.gsub(/\n/," ").gsub(/\r/," ")), :length => 200) %>
|
8
|
+
LOCATION:<%= @event.venue_address %>
|
9
|
+
URL:<%= custom_url_for @event %>
|
10
|
+
STATUS:CONFIRMED
|
11
|
+
CLASS:PUBLIC
|
12
|
+
DTSTART:<%= @event.start_at.strftime('%Y%m%dT%H%M%S') %>
|
13
|
+
DTEND:<%= @event.end_at.strftime('%Y%m%dT%H%M%S') %>
|
14
|
+
DTSTAMP:<%= @event.start_at.strftime('%Y%m%dT%H%M%S') %>
|
15
|
+
END:VEVENT
|
16
|
+
END:VCALENDAR
|
data/changelog.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## 1.2 [UNRELEASED]
|
2
|
+
|
3
|
+
## 1.1 [07 July 2011]
|
4
|
+
* No more unique titles [joemsak](https://github.com/joemsak)
|
5
|
+
* Cached slugs for performance boost [joemsak](https://github.com/joemsak)
|
6
|
+
* Controller & view template refactoring [joemsak](https://github.com/joemsak)
|
7
|
+
* Easy multi-day or single-day detection for date formatting [mdoel](https://github.com/mdoel)
|
8
|
+
* iCal (ics) export [joemsak](https://github.com/joemsak)
|
9
|
+
* Google map of venue address [joemsak](https://github.com/joemsak)
|
1
10
|
|
2
11
|
## 1.0.4 [02 June 2011]
|
3
12
|
* Archive listing should be reversed
|
data/config/routes.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
Refinery::Application.routes.draw do
|
2
2
|
resources :events do
|
3
|
-
|
4
|
-
|
3
|
+
collection do
|
4
|
+
get 'archive/:year(/:month)' => 'events#archive', :as => 'archive'
|
5
|
+
get 'category/:id' => 'event_categories#show', :as => 'category'
|
6
|
+
end
|
5
7
|
end
|
6
8
|
|
7
9
|
scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class AddCachedSlugs < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :event_categories, :cached_slug, :string
|
4
|
+
add_column :events, :cached_slug, :string
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.down
|
8
|
+
remove_column :event_categories, :cached_slug
|
9
|
+
remove_column :events, :cached_slug
|
10
|
+
end
|
11
|
+
end
|
@@ -44,16 +44,6 @@ Feature: Events
|
|
44
44
|
And I should be on the list of events
|
45
45
|
And I should not see "A title"
|
46
46
|
|
47
|
-
@events-duplicate @duplicate
|
48
|
-
Scenario: Create Duplicate Event
|
49
|
-
Given I only have events titled UniqueTitleOne, UniqueTitleTwo
|
50
|
-
When I go to the list of events
|
51
|
-
And I follow "Add New Event"
|
52
|
-
And I fill in "Title" with "UniqueTitleTwo"
|
53
|
-
And I press "Save"
|
54
|
-
Then I should see "There were problems"
|
55
|
-
And I should have 2 events
|
56
|
-
|
57
47
|
@events-delete @delete
|
58
48
|
Scenario: Delete Event
|
59
49
|
Given I only have events titled UniqueTitleOne
|
data/readme.md
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
|
16
16
|
Using Rails 3 / Bundler Gemfile:
|
17
17
|
|
18
|
-
gem 'refinerycms-calendar', '~>1.0'
|
18
|
+
gem 'refinerycms-calendar', '~>1.1.0'
|
19
19
|
|
20
20
|
bash:
|
21
21
|
|
@@ -29,16 +29,11 @@ bash:
|
|
29
29
|
|
30
30
|
Maintained by [joemsak](http://github.com/joemsak)
|
31
31
|
|
32
|
-
## TODO for 1.
|
32
|
+
## TODO for 1.2 Release:
|
33
33
|
|
34
34
|
* Import events from Facebook fan page?
|
35
35
|
* JS datepicker in admin backend
|
36
36
|
* Calendar grid view? (can be kinda gross, honestly)
|
37
|
-
* iCal export
|
38
|
-
|
39
|
-
## TODO for 1.2
|
40
|
-
|
41
|
-
* Google map of address
|
42
37
|
* Address finder?
|
43
38
|
|
44
39
|
## Acknowledgements
|
Binary file
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.platform = Gem::Platform::RUBY
|
3
3
|
s.name = 'refinerycms-calendar'
|
4
|
-
s.version = '1.0
|
4
|
+
s.version = '1.1.0'
|
5
5
|
s.description = 'Ruby on Rails Events engine for Refinery CMS'
|
6
6
|
s.date = Time.now.strftime('%Y-%m-%d')
|
7
7
|
s.summary = 'Events engine for Refinery CMS'
|
data/spec/models/event_spec.rb
CHANGED
@@ -22,11 +22,6 @@ describe Event do
|
|
22
22
|
it "rejects empty title" do
|
23
23
|
Event.new(@valid_attributes.merge(:title => "")).should_not be_valid
|
24
24
|
end
|
25
|
-
|
26
|
-
it "rejects non unique title" do
|
27
|
-
# as one gets created before each spec by reset_event
|
28
|
-
Event.new(@valid_attributes).should_not be_valid
|
29
|
-
end
|
30
25
|
|
31
26
|
it "rejects a non-numerical ticket price" do
|
32
27
|
Event.new({
|
@@ -79,4 +74,4 @@ describe Event do
|
|
79
74
|
|
80
75
|
end
|
81
76
|
|
82
|
-
end
|
77
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: refinerycms-calendar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0
|
5
|
+
version: 1.1.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Neoteric Design
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2011-
|
15
|
+
date: 2011-07-07 00:00:00 -05:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- app/views/events/index.html.erb
|
66
66
|
- app/views/events/index.rss.builder
|
67
67
|
- app/views/events/show.html.erb
|
68
|
+
- app/views/events/show.ics.erb
|
68
69
|
- changelog.md
|
69
70
|
- config/locales/en.yml
|
70
71
|
- config/locales/fr.yml
|
@@ -75,6 +76,7 @@ files:
|
|
75
76
|
- db/migrate/01_create_events.rb
|
76
77
|
- db/migrate/02_create_event_categories.rb
|
77
78
|
- db/migrate/03_create_event_categorizations.rb
|
79
|
+
- db/migrate/04_add_cached_slugs.rb
|
78
80
|
- db/seeds/events.rb
|
79
81
|
- features/manage_events.feature
|
80
82
|
- features/step_definitions/event_steps.rb
|
@@ -86,6 +88,7 @@ files:
|
|
86
88
|
- lib/tasks/events.rake
|
87
89
|
- public/stylesheets/refinerycms-events.css
|
88
90
|
- readme.md
|
91
|
+
- refinerycms-calendar-1.0.4.gem
|
89
92
|
- refinerycms-calendar.gemspec
|
90
93
|
- spec/controllers/events_controller_spec.rb
|
91
94
|
- spec/helpers/events_helper_spec.rb
|