event-calendar 2.3.1 → 2.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,6 +21,16 @@ To generate the necessary static files AND the example below:
21
21
 
22
22
  === Rails 3
23
23
 
24
+ As a gem:
25
+
26
+ gem install event-calendar
27
+
28
+ Add this to your Gemfile:
29
+
30
+ gem 'event-calendar', :require => 'event_calendar'
31
+
32
+ Or as a plugin:
33
+
24
34
  rails plugin install git://github.com/elevation/event_calendar.git
25
35
 
26
36
  To generate the necessary static files AND the example below:
@@ -90,8 +100,14 @@ An event can also have a *color* field (any string which is a valid CSS color) w
90
100
  end
91
101
 
92
102
  ====config/routes.rb
93
-
103
+
104
+ Rails 2:
105
+
94
106
  map.calendar '/calendar/:year/:month', :controller => 'calendar', :action => 'index', :requirements => {:year => /\d{4}/, :month => /\d{1,2}/}, :year => nil, :month => nil
107
+
108
+ Rails 3:
109
+
110
+ match '/calendar(/:year(/:month))' => 'calendar#index', :as => :calendar, :constraints => {:year => /\d{4}/, :month => /\d{1,2}/}
95
111
 
96
112
  ====app/controllers/calendar_controller.rb
97
113
 
@@ -130,7 +146,7 @@ Some helper methods are created, but you could put this in the view. The key is
130
146
  :month => @month,
131
147
  :event_strips => @event_strips,
132
148
  :month_name_text => I18n.localize(@shown_month, :format => "%B %Y"),
133
- :previous_month_text => "<< " + month_link(@shown_month.last_month),
149
+ :previous_month_text => "<< " + month_link(@shown_month.prev_month),
134
150
  :next_month_text => month_link(@shown_month.next_month) + " >>"
135
151
  }
136
152
  end
data/Rakefile CHANGED
@@ -5,9 +5,9 @@ begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "event-calendar"
8
- gem.summary = "Rails helper for generating a calendar of events."
8
+ gem.summary = "Rails helper for showing multiple, overlapping events across calendar days and rows."
9
9
  gem.email = ""
10
- gem.description = "Rails helper for generating a calendar of events. These events can optionally span multiple days."
10
+ gem.description = "Rails helper for showing multiple, overlapping events across calendar days and rows."
11
11
  gem.authors = ["Jeff Schuil"]
12
12
  gem.homepage = "http://github.com/elevation/event_calendar"
13
13
  gem.require_path = 'lib'
@@ -18,12 +18,28 @@ rescue LoadError
18
18
  puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
19
  end
20
20
 
21
- require 'spec/rake/spectask'
22
- task :default => :spec
23
- desc "Run all specs"
24
- Spec::Rake::SpecTask.new do |t|
25
- t.spec_files = FileList['spec/**/*_spec.rb']
26
- t.spec_opts = ['--options', 'spec/spec.opts']
21
+ begin
22
+ # Rspec 1.3
23
+ require 'spec/rake/spectask'
24
+ task :default => :spec
25
+ desc "Run all specs"
26
+ Spec::Rake::SpecTask.new do |t|
27
+ t.spec_files = FileList['spec/**/*_spec.rb']
28
+ t.spec_opts = ['--options', 'spec/spec.opts']
29
+ end
30
+
31
+ rescue LoadError
32
+ # RSpec 2
33
+ require 'rspec/core/rake_task'
34
+ task :default => :spec
35
+ desc "Run all specs"
36
+ RSpec::Core::RakeTask.new do |t|
37
+ t.pattern = "spec/**/*_spec.rb"
38
+ t.rspec_opts = %w(-fs --color)
39
+ end
40
+
41
+ rescue LoadError
42
+ puts "Rspec not available. Install it with: gem install rspec"
27
43
  end
28
44
 
29
45
  require 'rake/rdoctask'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.1
1
+ 2.3.2
@@ -0,0 +1,78 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{event-calendar}
8
+ s.version = "2.3.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jeff Schuil"]
12
+ s.date = %q{2010-12-29}
13
+ s.description = %q{Rails helper for showing multiple, overlapping events across calendar days and rows.}
14
+ s.email = %q{}
15
+ s.extra_rdoc_files = [
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ "CHANGELOG.rdoc",
20
+ "MIT-LICENSE",
21
+ "README.rdoc",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "event-calendar.gemspec",
25
+ "generators/event_calendar/USAGE",
26
+ "generators/event_calendar/event_calendar_generator.rb",
27
+ "generators/event_calendar/lib/insert_routes.rb",
28
+ "generators/event_calendar/templates/controller.rb.erb",
29
+ "generators/event_calendar/templates/helper.rb.erb",
30
+ "generators/event_calendar/templates/javascript.js",
31
+ "generators/event_calendar/templates/jq_javascript.js",
32
+ "generators/event_calendar/templates/migration.rb.erb",
33
+ "generators/event_calendar/templates/model.rb.erb",
34
+ "generators/event_calendar/templates/stylesheet.css",
35
+ "generators/event_calendar/templates/view.html.erb",
36
+ "init.rb",
37
+ "install.rb",
38
+ "lib/event_calendar.rb",
39
+ "lib/event_calendar/calendar_helper.rb",
40
+ "lib/event_calendar/railtie.rb",
41
+ "lib/generators/event_calendar/USAGE",
42
+ "lib/generators/event_calendar/event_calendar_generator.rb",
43
+ "lib/generators/event_calendar/templates/controller.rb.erb",
44
+ "lib/generators/event_calendar/templates/helper.rb.erb",
45
+ "lib/generators/event_calendar/templates/javascript.js",
46
+ "lib/generators/event_calendar/templates/jq_javascript.js",
47
+ "lib/generators/event_calendar/templates/migration.rb.erb",
48
+ "lib/generators/event_calendar/templates/model.rb.erb",
49
+ "lib/generators/event_calendar/templates/stylesheet.css",
50
+ "lib/generators/event_calendar/templates/view.html.erb",
51
+ "lib/tasks/event_calendar_tasks.rake",
52
+ "spec/event_calendar_spec.rb",
53
+ "spec/fixtures/models.rb",
54
+ "spec/spec.opts",
55
+ "spec/spec_helper.rb",
56
+ "uninstall.rb"
57
+ ]
58
+ s.homepage = %q{http://github.com/elevation/event_calendar}
59
+ s.require_paths = ["lib"]
60
+ s.rubygems_version = %q{1.3.7}
61
+ s.summary = %q{Rails helper for showing multiple, overlapping events across calendar days and rows.}
62
+ s.test_files = [
63
+ "spec/event_calendar_spec.rb",
64
+ "spec/fixtures/models.rb",
65
+ "spec/spec_helper.rb"
66
+ ]
67
+
68
+ if s.respond_to? :specification_version then
69
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
70
+ s.specification_version = 3
71
+
72
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
73
+ else
74
+ end
75
+ else
76
+ end
77
+ end
78
+
@@ -175,12 +175,13 @@ module EventCalendar
175
175
  end
176
176
 
177
177
  def adjust_all_day_dates
178
- if self[:all_day]
179
- self[:start_at] = self[:start_at].beginning_of_day
180
- if self[:end_at]
181
- self[:end_at] = self[:end_at].beginning_of_day + 1.day - 1.second
178
+ if self.all_day
179
+ self.start_at = self.start_at.beginning_of_day
180
+
181
+ if self.end_at
182
+ self.end_at = self.end_at.beginning_of_day + 1.day - 1.second
182
183
  else
183
- self[:end_at] = self[:start_at].beginning_of_day + 1.day - 1.second
184
+ self.end_at = self.start_at + 1.day - 1.second
184
185
  end
185
186
  end
186
187
  end
@@ -5,8 +5,12 @@ require 'rails'
5
5
  module EventCalendar
6
6
  class Railtie < Rails::Engine
7
7
  initializer :after_initialize do
8
- ActionController::Base.helper EventCalendar::CalendarHelper
9
- ActiveRecord::Base.extend EventCalendar::ClassMethods
8
+ if defined?(ActionController::Base)
9
+ ActionController::Base.helper EventCalendar::CalendarHelper
10
+ end
11
+ if defined?(ActiveRecord::Base)
12
+ ActiveRecord::Base.extend EventCalendar::ClassMethods
13
+ end
10
14
  end
11
15
  end
12
16
  end
@@ -1,20 +1,14 @@
1
- ENV["RAILS_ROOT"] ||= File.dirname(__FILE__) + '/../../../..'
2
- ENV["RAILS_ENV"] = "test"
3
-
4
- #require File.expand_path(File.dirname(ENV['RAILS_ROOT']) + "/config/environment")
5
1
  require 'rubygems'
6
- require 'spec'
7
2
 
8
3
  require 'active_record'
9
4
  require 'action_controller'
10
5
  require 'action_view'
11
6
 
12
-
13
7
  require 'event_calendar'
14
8
  require 'event_calendar/calendar_helper'
15
9
 
16
10
  require File.dirname(__FILE__) + '/../init.rb'
17
- require 'spec/fixtures/models'
11
+ require File.dirname(__FILE__) + "/fixtures/models"
18
12
 
19
13
  ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
20
14
  ActiveRecord::Migration.verbose = false
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event-calendar
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 3
9
- - 1
10
- version: 2.3.1
9
+ - 2
10
+ version: 2.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jeff Schuil
@@ -15,11 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-17 00:00:00 -08:00
18
+ date: 2010-12-29 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
22
- description: Rails helper for generating a calendar of events. These events can optionally span multiple days.
22
+ description: Rails helper for showing multiple, overlapping events across calendar days and rows.
23
23
  email: ""
24
24
  executables: []
25
25
 
@@ -33,6 +33,7 @@ files:
33
33
  - README.rdoc
34
34
  - Rakefile
35
35
  - VERSION
36
+ - event-calendar.gemspec
36
37
  - generators/event_calendar/USAGE
37
38
  - generators/event_calendar/event_calendar_generator.rb
38
39
  - generators/event_calendar/lib/insert_routes.rb
@@ -98,7 +99,7 @@ rubyforge_project:
98
99
  rubygems_version: 1.3.7
99
100
  signing_key:
100
101
  specification_version: 3
101
- summary: Rails helper for generating a calendar of events.
102
+ summary: Rails helper for showing multiple, overlapping events across calendar days and rows.
102
103
  test_files:
103
104
  - spec/event_calendar_spec.rb
104
105
  - spec/fixtures/models.rb