actic 0.0.5 → 0.0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/app/controllers/alarms_controller.rb +9 -8
- data/lib/app/views/alarms/_form.html.haml +0 -0
- data/lib/app/views/alarms/edit.html.haml +0 -0
- data/lib/app/views/alarms/index.html.haml +0 -0
- data/lib/app/views/alarms/new.html.haml +0 -0
- data/lib/app/views/alarms/show.html.haml +0 -0
- data/lib/config/routes.rb +4 -4
- metadata +10 -4
@@ -5,31 +5,32 @@ class AlarmsController < ApplicationController
|
|
5
5
|
respond_to :json, :html
|
6
6
|
|
7
7
|
def index
|
8
|
-
|
8
|
+
@alarms = @base_model.alarms.all
|
9
|
+
respond_with(polymorphic_url(@base_model.class))
|
9
10
|
end
|
10
11
|
|
11
12
|
def show
|
12
|
-
respond_with(@base_model, (@alarm = @base_model.alarms.find(params[:id])))
|
13
|
+
respond_with(polymorphic_url([@base_model, (@alarm = @base_model.alarms.find(params[:id]))]))
|
13
14
|
end
|
14
15
|
|
15
16
|
def new
|
16
|
-
respond_with(@base_model, (@alarm = @base_model.alarms.new))
|
17
|
+
respond_with(polymorphic_url([@base_model, (@alarm = @base_model.alarms.new)]))
|
17
18
|
end
|
18
19
|
|
19
20
|
def edit
|
20
|
-
respond_with(@base_model, (@alarm = @base_model.alarms.find(params[:id])))
|
21
|
+
respond_with(polymorphic_url([@base_model, (@alarm = @base_model.alarms.find(params[:id]))]))
|
21
22
|
end
|
22
23
|
|
23
24
|
def create
|
24
25
|
@alarm = @base_model.alarms.create(params[:alarm])
|
25
26
|
flash[:notice] = "Alarm successfully created" if @alarm.save
|
26
|
-
respond_with(@base_model, @alarm)
|
27
|
+
respond_with([@base_model, @alarm])
|
27
28
|
end
|
28
29
|
|
29
30
|
def update
|
30
31
|
@alarm = @base_model.alarms.find(params[:id])
|
31
32
|
@alarm.update_attributes(params[:base_model])
|
32
|
-
respond_with(@base_model, @alarm)
|
33
|
+
respond_with(polymorphic_url([@base_model, @alarm]))
|
33
34
|
end
|
34
35
|
|
35
36
|
def destroy
|
@@ -45,9 +46,9 @@ class AlarmsController < ApplicationController
|
|
45
46
|
private
|
46
47
|
|
47
48
|
def get_base_model
|
48
|
-
[[
|
49
|
+
[['calendar_id', Calendar], ['event_id', Event]].each { |c|
|
49
50
|
if params.keys.include?(c[0])
|
50
|
-
@base_model = c[1].find(c[0])
|
51
|
+
@base_model = c[1].find(params[c[0]])
|
51
52
|
break
|
52
53
|
end
|
53
54
|
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/config/routes.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Rails.application.routes.draw do #|map|
|
2
|
-
resources :calendars
|
2
|
+
resources :calendars do
|
3
3
|
resources :events do
|
4
4
|
resources :alarms
|
5
5
|
end
|
@@ -8,8 +8,8 @@ Rails.application.routes.draw do #|map|
|
|
8
8
|
resources :todos
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
resources :events do
|
12
|
+
resources :alarms
|
13
|
+
end
|
14
14
|
|
15
15
|
end
|
metadata
CHANGED
@@ -6,7 +6,8 @@ version: !ruby/object:Gem::Version
|
|
6
6
|
- 0
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
|
9
|
+
- 1
|
10
|
+
version: 0.0.5.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Steve A Martin
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-29 00:00:00 +00:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
@@ -144,6 +145,11 @@ files:
|
|
144
145
|
- lib/app/models/patterns/r_rule.rb
|
145
146
|
- lib/app/models/sub_calendar.rb
|
146
147
|
- lib/app/models/todo.rb
|
148
|
+
- lib/app/views/alarms/_form.html.haml
|
149
|
+
- lib/app/views/alarms/edit.html.haml
|
150
|
+
- lib/app/views/alarms/index.html.haml
|
151
|
+
- lib/app/views/alarms/new.html.haml
|
152
|
+
- lib/app/views/alarms/show.html.haml
|
147
153
|
- lib/app/views/calendars/_form.html.haml
|
148
154
|
- lib/app/views/calendars/edit.html.haml
|
149
155
|
- lib/app/views/calendars/index.html.haml
|
@@ -186,7 +192,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
186
192
|
requirements:
|
187
193
|
- - ">="
|
188
194
|
- !ruby/object:Gem::Version
|
189
|
-
hash:
|
195
|
+
hash: 3940276186545721090
|
190
196
|
segments:
|
191
197
|
- 0
|
192
198
|
version: "0"
|
@@ -195,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
201
|
requirements:
|
196
202
|
- - ">="
|
197
203
|
- !ruby/object:Gem::Version
|
198
|
-
hash:
|
204
|
+
hash: 3940276186545721090
|
199
205
|
segments:
|
200
206
|
- 0
|
201
207
|
version: "0"
|