actic 0.0.2.3 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/app/controllers/calendars_controller.rb +9 -8
- data/lib/app/controllers/events_controller.rb +101 -0
- data/lib/app/models/calendar.rb +13 -0
- data/lib/app/views/events/_form.html.haml +0 -0
- data/lib/app/views/events/edit.html.haml +0 -0
- data/lib/app/views/events/index.html.haml +0 -0
- data/lib/app/views/events/new.html.haml +0 -0
- data/lib/app/views/events/show.html.haml +0 -0
- data/lib/config/routes.rb +4 -2
- data/lib/generators/templates/migration.rb.tmpl +2 -1
- metadata +38 -5
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
class CalendarsController < ApplicationController
|
|
2
|
+
respond_to :json, :html
|
|
2
3
|
# GET /calendars
|
|
3
4
|
# GET /calendars.xml
|
|
4
5
|
def index
|
|
5
|
-
@calendars = Calendar.all
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
format.
|
|
9
|
-
|
|
10
|
-
end
|
|
6
|
+
respond_with(@calendars = Calendar.all)
|
|
7
|
+
# respond_to do |format|
|
|
8
|
+
# format.html # index.html.erb
|
|
9
|
+
# format.xml { render :xml => @calendars }
|
|
10
|
+
# end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
# GET /calendars/1
|
|
14
14
|
# GET /calendars/1.xml
|
|
15
15
|
def show
|
|
16
|
-
@calendar = Calendar.find(params[:id])
|
|
17
|
-
|
|
16
|
+
respond_with(@calendar = Calendar.find(params[:id]))
|
|
17
|
+
=begin
|
|
18
18
|
respond_to do |format|
|
|
19
19
|
format.html # show.html.erb
|
|
20
20
|
format.xml { render :xml => @calendar }
|
|
21
21
|
end
|
|
22
|
+
=end
|
|
22
23
|
end
|
|
23
24
|
|
|
24
25
|
# GET /calendars/new
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
class EventsController < ApplicationController
|
|
2
|
+
before_filter :get_calendar
|
|
3
|
+
# GET /events/new
|
|
4
|
+
# GET /events/new.xml
|
|
5
|
+
def new
|
|
6
|
+
#@event = @calendar.events.new
|
|
7
|
+
|
|
8
|
+
# respond_to do |format|
|
|
9
|
+
# format.html # new.html.erb
|
|
10
|
+
# format.xml { render :xml => @event }
|
|
11
|
+
# end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def index
|
|
15
|
+
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
def get_calendar
|
|
20
|
+
@calendar = Calendar.find(params[:calendar_id]) unless params[:calendar_id].nil?
|
|
21
|
+
end
|
|
22
|
+
# GET /calendars
|
|
23
|
+
# GET /calendars.xml
|
|
24
|
+
=begin
|
|
25
|
+
before_filter :get_calendar
|
|
26
|
+
|
|
27
|
+
def index
|
|
28
|
+
@events = @calendar.events.all
|
|
29
|
+
|
|
30
|
+
respond_to do |format|
|
|
31
|
+
format.html # index.html.erb
|
|
32
|
+
format.xml { render :xml => @events }
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# GET /events/1
|
|
37
|
+
# GET /events/1.xml
|
|
38
|
+
def show
|
|
39
|
+
@event = @calendar.events.find(params[:id])
|
|
40
|
+
|
|
41
|
+
respond_to do |format|
|
|
42
|
+
format.html # show.html.erb
|
|
43
|
+
format.xml { render :xml => @event }
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# GET /events/1/edit
|
|
48
|
+
def edit
|
|
49
|
+
@event = @calendar.events.find(params[:id])
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# POST /events
|
|
53
|
+
# POST /events.xml
|
|
54
|
+
def create
|
|
55
|
+
@event = @calendar.events.new(params[:event])
|
|
56
|
+
|
|
57
|
+
respond_to do |format|
|
|
58
|
+
if @event.save
|
|
59
|
+
format.html { redirect_to([@calendar,@event], :notice => 'Dummy resource was successfully created.') }
|
|
60
|
+
format.xml { render :xml => [@calendar,@event], :status => :created, :location => @event }
|
|
61
|
+
else
|
|
62
|
+
format.html { render :action => "new" }
|
|
63
|
+
format.xml { render :xml => @event.errors, :status => :unprocessable_entity }
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# PUT /events/1
|
|
69
|
+
# PUT /events/1.xml
|
|
70
|
+
def update
|
|
71
|
+
@event = @calendar.events.find(params[:id])
|
|
72
|
+
|
|
73
|
+
respond_to do |format|
|
|
74
|
+
if @event.update_attributes(params[:event])
|
|
75
|
+
format.html { redirect_to(@event, :notice => 'Dummy resource was successfully updated.') }
|
|
76
|
+
format.xml { head :ok }
|
|
77
|
+
else
|
|
78
|
+
format.html { render :action => "edit" }
|
|
79
|
+
format.xml { render :xml => @event.errors, :status => :unprocessable_entity }
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# DELETE /events/1
|
|
85
|
+
# DELETE /events/1.xml
|
|
86
|
+
def destroy
|
|
87
|
+
@event = @calendar.events.find(params[:id])
|
|
88
|
+
@event.destroy
|
|
89
|
+
|
|
90
|
+
respond_to do |format|
|
|
91
|
+
format.html { redirect_to(events_url) }
|
|
92
|
+
format.xml { head :ok }
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
private
|
|
97
|
+
def get_calendar
|
|
98
|
+
@calendar = Calendar.find(params[:event_id]) unless params[:event_id].nil?
|
|
99
|
+
end
|
|
100
|
+
=end
|
|
101
|
+
end
|
data/lib/app/models/calendar.rb
CHANGED
|
@@ -5,6 +5,19 @@ class Calendar < Component
|
|
|
5
5
|
has_many :todos, :after_add => :add_component, :after_remove => :reset_component
|
|
6
6
|
has_many :alarms, :as => :owner, :after_add => :add_component, :after_remove => :reset_component
|
|
7
7
|
#has_many :components
|
|
8
|
+
|
|
9
|
+
# def as_json
|
|
10
|
+
# self.attributes
|
|
11
|
+
# end
|
|
12
|
+
def as_json(options = {})
|
|
13
|
+
r = {
|
|
14
|
+
:guid => "/calendars/#{self.id}",
|
|
15
|
+
:id => self.id,
|
|
16
|
+
:ical => self.ical
|
|
17
|
+
}
|
|
18
|
+
r
|
|
19
|
+
end
|
|
20
|
+
|
|
8
21
|
end
|
|
9
22
|
|
|
10
23
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/config/routes.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
Rails.application.routes.draw do
|
|
2
|
-
resources :calendars
|
|
1
|
+
Rails.application.routes.draw do #|map|
|
|
2
|
+
resources :calendars do
|
|
3
|
+
resources :events#, :controller => "Calendars::Events"
|
|
4
|
+
end#, :controller => '../app/controllers/calendars'#, :only => [:new, :create]
|
|
3
5
|
end
|
metadata
CHANGED
|
@@ -5,9 +5,8 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
segments:
|
|
6
6
|
- 0
|
|
7
7
|
- 0
|
|
8
|
-
- 2
|
|
9
8
|
- 3
|
|
10
|
-
version: 0.0.
|
|
9
|
+
version: 0.0.3
|
|
11
10
|
platform: ruby
|
|
12
11
|
authors: []
|
|
13
12
|
|
|
@@ -15,7 +14,7 @@ autorequire:
|
|
|
15
14
|
bindir: bin
|
|
16
15
|
cert_chain: []
|
|
17
16
|
|
|
18
|
-
date: 2010-12-
|
|
17
|
+
date: 2010-12-23 00:00:00 +00:00
|
|
19
18
|
default_executable:
|
|
20
19
|
dependencies:
|
|
21
20
|
- !ruby/object:Gem::Dependency
|
|
@@ -72,6 +71,34 @@ dependencies:
|
|
|
72
71
|
type: :runtime
|
|
73
72
|
prerelease: false
|
|
74
73
|
version_requirements: *id004
|
|
74
|
+
- !ruby/object:Gem::Dependency
|
|
75
|
+
name: inherited_resources
|
|
76
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
|
77
|
+
none: false
|
|
78
|
+
requirements:
|
|
79
|
+
- - "="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
segments:
|
|
82
|
+
- 1
|
|
83
|
+
- 1
|
|
84
|
+
- 2
|
|
85
|
+
version: 1.1.2
|
|
86
|
+
type: :runtime
|
|
87
|
+
prerelease: false
|
|
88
|
+
version_requirements: *id005
|
|
89
|
+
- !ruby/object:Gem::Dependency
|
|
90
|
+
name: factory_girl
|
|
91
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
|
92
|
+
none: false
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
segments:
|
|
97
|
+
- 0
|
|
98
|
+
version: "0"
|
|
99
|
+
type: :development
|
|
100
|
+
prerelease: false
|
|
101
|
+
version_requirements: *id006
|
|
75
102
|
description: Actic is a calendaring engine for Rails3, it combines an iCal interface with ORM. It acts as a wrapper around the RiCal library
|
|
76
103
|
email:
|
|
77
104
|
executables: []
|
|
@@ -84,6 +111,7 @@ files:
|
|
|
84
111
|
- lib/actic/engine.rb
|
|
85
112
|
- lib/actic.rb
|
|
86
113
|
- lib/app/controllers/calendars_controller.rb
|
|
114
|
+
- lib/app/controllers/events_controller.rb
|
|
87
115
|
- lib/app/helpers/calendars_helper.rb
|
|
88
116
|
- lib/app/models/alarm.rb
|
|
89
117
|
- lib/app/models/calendar.rb
|
|
@@ -103,6 +131,11 @@ files:
|
|
|
103
131
|
- lib/app/views/calendars/index.html.haml
|
|
104
132
|
- lib/app/views/calendars/new.html.haml
|
|
105
133
|
- lib/app/views/calendars/show.html.haml
|
|
134
|
+
- lib/app/views/events/_form.html.haml
|
|
135
|
+
- lib/app/views/events/edit.html.haml
|
|
136
|
+
- lib/app/views/events/index.html.haml
|
|
137
|
+
- lib/app/views/events/new.html.haml
|
|
138
|
+
- lib/app/views/events/show.html.haml
|
|
106
139
|
- lib/config/routes.rb
|
|
107
140
|
- lib/generators/actic_install_generator.rb
|
|
108
141
|
- lib/generators/templates/migration.rb.tmpl
|
|
@@ -123,7 +156,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
123
156
|
requirements:
|
|
124
157
|
- - ">="
|
|
125
158
|
- !ruby/object:Gem::Version
|
|
126
|
-
hash:
|
|
159
|
+
hash: -2081845520581045814
|
|
127
160
|
segments:
|
|
128
161
|
- 0
|
|
129
162
|
version: "0"
|
|
@@ -132,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
132
165
|
requirements:
|
|
133
166
|
- - ">="
|
|
134
167
|
- !ruby/object:Gem::Version
|
|
135
|
-
hash:
|
|
168
|
+
hash: -2081845520581045814
|
|
136
169
|
segments:
|
|
137
170
|
- 0
|
|
138
171
|
version: "0"
|