refinerycms-calendar 1.1.0 → 2.0.0.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. data/app/controllers/refinery/calendar/admin/events_controller.rb +43 -0
  2. data/app/controllers/refinery/calendar/events_controller.rb +34 -0
  3. data/app/models/refinery/calendar/core_calendar.rb +36 -0
  4. data/app/models/refinery/calendar/event.rb +51 -0
  5. data/app/views/refinery/calendar/admin/events/_actions.html.erb +25 -0
  6. data/app/views/refinery/calendar/admin/events/_event.html.erb +10 -0
  7. data/app/views/refinery/calendar/admin/events/_events.html.erb +2 -0
  8. data/app/views/refinery/calendar/admin/events/_form.html.erb +31 -0
  9. data/app/views/refinery/calendar/admin/events/_records.html.erb +18 -0
  10. data/app/views/refinery/calendar/admin/events/_sortable_list.html.erb +5 -0
  11. data/app/views/refinery/calendar/admin/events/edit.html.erb +1 -0
  12. data/app/views/refinery/calendar/admin/events/index.html.erb +8 -0
  13. data/app/views/refinery/calendar/admin/events/new.html.erb +1 -0
  14. data/app/views/refinery/calendar/events/index.html.erb +11 -0
  15. data/app/views/refinery/calendar/events/show.html.erb +27 -0
  16. data/config/locales/en.yml +25 -43
  17. data/config/locales/es.yml +28 -0
  18. data/config/locales/fr.yml +25 -43
  19. data/config/locales/nb.yml +25 -18
  20. data/config/locales/nl.yml +25 -18
  21. data/config/routes.rb +12 -10
  22. data/db/seeds.rb +23 -0
  23. data/lib/generators/refinery/calendar_generator.rb +29 -0
  24. data/lib/refinery/calendar.rb +28 -0
  25. data/lib/refinery/calendar/configuration.rb +7 -0
  26. data/lib/refinery/calendar/engine.rb +26 -0
  27. data/lib/refinery/calendar/version.rb +17 -0
  28. data/lib/refinery/engine/multi_parameter_assignment.rb +6 -0
  29. data/lib/refinerycms-calendar.rb +1 -24
  30. data/lib/tasks/{events.rake → refinery/calendar.rake} +6 -6
  31. data/readme.md +8 -40
  32. metadata +56 -96
  33. data/app/controllers/admin/event_categories_controller.rb +0 -9
  34. data/app/controllers/admin/events_controller.rb +0 -26
  35. data/app/controllers/event_categories_controller.rb +0 -15
  36. data/app/controllers/events_controller.rb +0 -65
  37. data/app/helpers/event_categories_helper.rb +0 -3
  38. data/app/helpers/events_helper.rb +0 -44
  39. data/app/models/event.rb +0 -86
  40. data/app/models/event_categorization.rb +0 -4
  41. data/app/models/event_category.rb +0 -10
  42. data/app/views/admin/event_categories/_event_categories.html.erb +0 -1
  43. data/app/views/admin/event_categories/_event_category.html.erb +0 -18
  44. data/app/views/admin/event_categories/_form.html.erb +0 -26
  45. data/app/views/admin/event_categories/_sortable_list.html.erb +0 -3
  46. data/app/views/admin/event_categories/edit.html.erb +0 -1
  47. data/app/views/admin/event_categories/index.html.erb +0 -40
  48. data/app/views/admin/event_categories/new.html.erb +0 -1
  49. data/app/views/admin/events/_event.html.erb +0 -18
  50. data/app/views/admin/events/_events.html.erb +0 -1
  51. data/app/views/admin/events/_form.html.erb +0 -126
  52. data/app/views/admin/events/_sortable_list.html.erb +0 -20
  53. data/app/views/admin/events/edit.html.erb +0 -1
  54. data/app/views/admin/events/index.html.erb +0 -41
  55. data/app/views/admin/events/new.html.erb +0 -1
  56. data/app/views/event_categories/show.html.erb +0 -15
  57. data/app/views/events/_event.html.erb +0 -111
  58. data/app/views/events/_sidebar.html.erb +0 -38
  59. data/app/views/events/archive.html.erb +0 -17
  60. data/app/views/events/index.html.erb +0 -17
  61. data/app/views/events/index.rss.builder +0 -24
  62. data/app/views/events/show.html.erb +0 -15
  63. data/app/views/events/show.ics.erb +0 -16
  64. data/changelog.md +0 -35
  65. data/config/locales/lolcat.yml +0 -24
  66. data/db/migrate/01_create_events.rb +0 -33
  67. data/db/migrate/02_create_event_categories.rb +0 -13
  68. data/db/migrate/03_create_event_categorizations.rb +0 -17
  69. data/db/migrate/04_add_cached_slugs.rb +0 -11
  70. data/db/seeds/events.rb +0 -17
  71. data/features/manage_events.feature +0 -54
  72. data/features/step_definitions/event_steps.rb +0 -14
  73. data/features/support/factories/event_categories.rb +0 -3
  74. data/features/support/factories/events.rb +0 -6
  75. data/features/support/paths.rb +0 -17
  76. data/lib/generators/refinerycms_calendar_generator.rb +0 -6
  77. data/public/stylesheets/refinerycms-events.css +0 -73
  78. data/refinerycms-calendar-1.0.4.gem +0 -0
  79. data/refinerycms-calendar.gemspec +0 -17
  80. data/spec/controllers/events_controller_spec.rb +0 -14
  81. data/spec/helpers/events_helper_spec.rb +0 -16
  82. data/spec/models/event_category_spec.rb +0 -29
  83. data/spec/models/event_spec.rb +0 -77
@@ -1,11 +0,0 @@
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
@@ -1,17 +0,0 @@
1
- User.find(:all).each do |user|
2
- if user.plugins.find_by_name('events').nil?
3
- user.plugins.create(:name => 'events',
4
- :position => (user.plugins.maximum(:position) || -1) +1)
5
- end
6
- end
7
-
8
- page = Page.create(
9
- :title => 'Events',
10
- :link_url => '/events',
11
- :deletable => false,
12
- :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
13
- :menu_match => '^/events(\/|\/.+?|)$'
14
- )
15
- Page.default_parts.each_with_index do |default_page_part, idx|
16
- page.parts.create(:title => default_page_part, :body => nil, :position => idx)
17
- end
@@ -1,54 +0,0 @@
1
- @events
2
- Feature: Events
3
- In order to have events on my website
4
- As an administrator
5
- I want to manage events
6
-
7
- Background:
8
- Given I am a logged in refinery user
9
- And I have no events
10
-
11
- @events-list @list
12
- Scenario: Events List
13
- Given I have events titled UniqueTitleOne, UniqueTitleTwo
14
- When I go to the list of events
15
- # And show me the page
16
- Then I should see "UniqueTitleOne"
17
- And I should see "UniqueTitleTwo"
18
-
19
- @events-valid @valid
20
- Scenario: Create Valid Event
21
- When I go to the list of events
22
- And I follow "Add New Event"
23
- And I fill in "Title" with "This is a test of the first string field"
24
- And I press "Save"
25
- Then I should see "'This is a test of the first string field' was successfully added."
26
- And I should have 1 event
27
-
28
- @events-invalid @invalid
29
- Scenario: Create Invalid Event (without title)
30
- When I go to the list of events
31
- And I follow "Add New Event"
32
- And I press "Save"
33
- Then I should see "Title can't be blank"
34
- And I should have 0 events
35
-
36
- @events-edit @edit
37
- Scenario: Edit Existing Event
38
- Given I have events titled "A title"
39
- When I go to the list of events
40
- And I follow "Edit this event" within ".actions"
41
- Then I fill in "Title" with "A different title"
42
- And I press "Save"
43
- Then I should see "'A different title' was successfully updated."
44
- And I should be on the list of events
45
- And I should not see "A title"
46
-
47
- @events-delete @delete
48
- Scenario: Delete Event
49
- Given I only have events titled UniqueTitleOne
50
- When I go to the list of events
51
- And I follow "Remove this event forever"
52
- Then I should see "'UniqueTitleOne' was successfully removed."
53
- And I should have 0 events
54
-
@@ -1,14 +0,0 @@
1
- Given /^I have no events$/ do
2
- Event.delete_all
3
- end
4
-
5
- Given /^I (only )?have events titled "?([^\"]*)"?$/ do |only, titles|
6
- Event.delete_all if only
7
- titles.split(', ').each do |title|
8
- Factory(:event, :title => title)
9
- end
10
- end
11
-
12
- Then /^I should have ([0-9]+) events?$/ do |count|
13
- Event.count.should == count.to_i
14
- end
@@ -1,3 +0,0 @@
1
- Factory.define :event_category do |f|
2
- f.sequence(:name) { |n| "Class/Lecture #{n}" }
3
- end
@@ -1,6 +0,0 @@
1
- Factory.define :event do |f|
2
- f.sequence(:title) { |n| "Top #{n} Shopping Centers in Chicago" }
3
- f.description "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it."
4
- f.start_at Time.now
5
- f.end_at Time.now.advance(:hours => 1)
6
- end
@@ -1,17 +0,0 @@
1
- module NavigationHelpers
2
- module Refinery
3
- module Events
4
- def path_to(page_name)
5
- case page_name
6
- when /the list of events/
7
- admin_events_path
8
-
9
- when /the new event form/
10
- new_admin_event_path
11
- else
12
- nil
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,6 +0,0 @@
1
- class RefinerycmsCalendar < Refinery::Generators::EngineInstaller
2
-
3
- source_root File.expand_path('../../../', __FILE__)
4
- engine_name "calendar"
5
-
6
- end
@@ -1,73 +0,0 @@
1
- .individual_event {
2
- padding: 15px;
3
- margin: 0 0 10px;
4
- background-color: #f4f4f4;
5
- }
6
- .individual_event h1 {
7
- margin: 0 0 10px;
8
- padding: 0;
9
- }
10
- .individual_event .event_image {
11
- float: left;
12
- margin: 0 15px 10px 0;
13
- }
14
- #featured_events h2 {
15
- margin: 15px 0 10px;
16
- }
17
-
18
- .sidebar_module {
19
- padding: 15px;
20
- }
21
- .sidebar_module h2 {
22
- margin: 0 0 10px;
23
- }
24
- .categories a {
25
- display: block;
26
- margin: 5px 0;
27
- }
28
- .sidebar_module ul {
29
- list-style: square;
30
- padding: 0 0 0 26px;
31
- margin: 0;
32
- }
33
- .sidebar_module ul li {
34
- margin: 2px 0;
35
- padding: 2px 0;
36
- }
37
-
38
- #share_this_event {
39
- border-top: 1px solid #ddd;
40
- border-bottom: 1px solid #ddd;
41
- padding: 20px 0;
42
- margin: 20px 0;
43
- }
44
- #share_this_event ul {
45
- list-style: none;
46
- border: 0;
47
- padding: 0;
48
- margin: 0;
49
- }
50
- #share_this_event ul li {
51
- float: left;
52
- height: 70px;
53
- margin: 0 15px 0 0;
54
- }
55
-
56
- #prevnext_nav {
57
- clear: both;
58
- display: block;
59
- height: 100px;
60
- }
61
- #prevnext_nav .prev {
62
- width: 33%;
63
- float: left;
64
- }
65
- #prevnext_nav .home {
66
- width: 33%;
67
- float: left;
68
- }
69
- #prevnext_nav .next {
70
- width: 33%;
71
- float: left;
72
- }
73
-
@@ -1,17 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.platform = Gem::Platform::RUBY
3
- s.name = 'refinerycms-calendar'
4
- s.version = '1.1.0'
5
- s.description = 'Ruby on Rails Events engine for Refinery CMS'
6
- s.date = Time.now.strftime('%Y-%m-%d')
7
- s.summary = 'Events engine for Refinery CMS'
8
- s.require_paths = %w(lib)
9
- s.files = Dir['**/*']
10
- s.authors = ["Neoteric Design", "Joe Sak", "Philip Arndt"]
11
- s.email = %q{joe@neotericdesign.com}
12
- s.homepage = "https://github.com/resolve/refinerycms-calendar"
13
-
14
- s.add_dependency 'refinerycms-core', '>= 0.9.9.1'
15
- end
16
-
17
-
@@ -1,14 +0,0 @@
1
- require 'spec_helper'
2
- Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory}
3
-
4
- describe EventsController do
5
-
6
- describe "GET 'index' RSS" do
7
- it "should be successful" do
8
- get 'index', :format => :rss
9
- response.should be_success
10
- end
11
-
12
- end
13
-
14
- end
@@ -1,16 +0,0 @@
1
- require 'spec_helper'
2
-
3
- # Specs in this file have access to a helper object that includes
4
- # the EventsHelper. For example:
5
- #
6
- # describe EventsHelper do
7
- # describe "string concat" do
8
- # it "concats two strings with spaces" do
9
- # helper.concat_strings("this","that").should == "this that"
10
- # end
11
- # end
12
- # end
13
-
14
- # describe EventsHelper do
15
- # pending "add some examples to (or delete) #{__FILE__}"
16
- # end
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
- Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory}
3
-
4
- describe EventCategory do
5
- before(:each) do
6
- @attr = Factory(:event_category).attributes
7
- end
8
-
9
- context "validations" do
10
-
11
- it "requires a name" do
12
- EventCategory.new(@attr.merge(:name => nil)).should_not be_valid
13
- end
14
-
15
- end
16
-
17
- context "events" do
18
- it "can associate with many events" do
19
- event1 = Factory(:event)
20
- event2 = Factory(:event)
21
- category = Factory(:event_category)
22
-
23
- category.events << event1
24
- category.events << event2
25
-
26
- category.events.size.should be 2
27
- end
28
- end
29
- end
@@ -1,77 +0,0 @@
1
- require 'spec_helper'
2
- Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory}
3
-
4
- describe Event do
5
-
6
- def reset_event(options = {})
7
- @valid_attributes = {
8
- :id => 1,
9
- :title => "RSpec is great for testing too"
10
- }
11
-
12
- @event.destroy! if @event
13
- @event = Event.create!(@valid_attributes.update(options))
14
- end
15
-
16
- context "validations" do
17
-
18
- before(:each) do
19
- reset_event
20
- end
21
-
22
- it "rejects empty title" do
23
- Event.new(@valid_attributes.merge(:title => "")).should_not be_valid
24
- end
25
-
26
- it "rejects a non-numerical ticket price" do
27
- Event.new({
28
- :title => "I have a bad ticket price",
29
- :ticket_price => "$25"
30
- }).should_not be_valid
31
-
32
- Event.new({
33
- :title => "I have a good ticket price",
34
- :ticket_price => "25"
35
- }).should be_valid
36
-
37
- Event.new({
38
- :title => "I have a decimal ticket price",
39
- :ticket_price => "25.00"
40
- }).should be_valid
41
- end
42
- end
43
-
44
- context "instance methods" do
45
- it "can find the next item" do
46
- event1 = Factory(:event)
47
- event2 = Factory(:event, :start_at => Time.now.advance(:days => 1), :end_at => Time.now.advance(:days => 1, :hours => 1))
48
- event1.next.should == event2
49
- end
50
-
51
- it "can find the previous item" do
52
- event1 = Factory(:event)
53
- event2 = Factory(:event, :start_at => Time.now.advance(:days => 1), :end_at => Time.now.advance(:days => 1, :hours => 1))
54
- event2.prev.should == event1
55
- end
56
- end
57
-
58
- context "categories" do
59
- it "has many categories" do
60
- event = Factory(:event)
61
- event.should respond_to :categories
62
- end
63
-
64
- it "can be assigned categories" do
65
- event = Factory(:event)
66
- cat1 = Factory(:event_category)
67
- cat2 = Factory(:event_category)
68
-
69
- event.categories << cat1
70
- event.categories << cat2
71
-
72
- event.categories.size.should be 2
73
- end
74
-
75
- end
76
-
77
- end