actic 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- Copyright 2010 YOURNAME
1
+ Copyright 2010 Steve Martin
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -3,7 +3,7 @@
3
3
  WARNING: THIS IS STILL VERY ALPHA!
4
4
  This project is an icalendar engine for Rails3, it fuses ActiveRecord with iCal ( using the RiCal library ) and uses MIT-LICENSE.
5
5
 
6
- This is a very alpha software, functionality is currently incomplete, the model layer is close to finished,
6
+ This is very alpha software, functionality is currently incomplete, the model layer is close to finished,
7
7
  but the controller and views are a long way off.
8
8
 
9
9
 
@@ -1,4 +1,6 @@
1
1
  module Actic
2
2
  require 'actic/engine' if defined?(Rails)
3
3
  #require 'generators/actic/actic_install_generator' if defined?(Rails)
4
+
5
+
4
6
  end
@@ -1,21 +1,50 @@
1
1
 
2
2
  module Actic
3
3
  class Engine < Rails::Engine
4
- config.autoload_paths << File.expand_path("../../app/models", __FILE__)
5
- #config.autoload_paths << File.expand_path("../../app/views", __FILE__)
6
- #config.autoload_paths << File.expand_path("../../app/views/calendars", __FILE__)
7
- config.autoload_paths << File.expand_path("../../app/controllers", __FILE__)
4
+ paths.config.app File.expand_path("../../app", __FILE__), :eager_load => true, :glob => "*"
5
+ paths.app.models File.expand_path("../../app/models", __FILE__), :eager_load => true
6
+ paths.app.controllers File.expand_path("../../app/controllers", __FILE__), :eager_load => true
7
+ paths.app.helpers File.expand_path("../../app/helpers", __FILE__), :eager_load => true
8
+ paths.app.views File.expand_path("../../app/views", __FILE__), :eager_load => true
9
+ paths.config.routes File.expand_path("../../config/routes.rb", __FILE__)
8
10
  config.autoload_paths << File.expand_path("../../migrate", __FILE__)
9
- config.autoload_paths << File.expand_path("../../app/helpers", __FILE__)
11
+ paths.config.initializers File.expand_path("../../config/initializers", __FILE__), :glob => "**/*.rb"
10
12
 
11
- paths.config.routes = File.expand_path("../../config/routes.rb", __FILE__)
12
- paths.app.views = File.expand_path("../../app/views", __FILE__)
13
-
14
- # paths.config.app = File.expand_path("../../app", __FILE__)
15
13
 
16
14
  rake_tasks do
17
15
  #load "your_railtie/railties/tasks.rake"
18
16
  end
19
17
 
18
+ initializer "icalendar_renderers.initialize" do |app|
19
+ ActionController.add_renderer :ical do |ical, options|
20
+ self.content_type ||= Mime::ICAL
21
+ self.response_body = ical.respond_to?(:to_ical) ? ical.to_ical(options) : ical
22
+ end
23
+
24
+ ActionController.add_renderer :ics do |ical, options|
25
+ self.content_type ||= Mime::ICS
26
+ self.response_body = ical.respond_to?(:to_ical) ? ical.to_ical(options) : ical
27
+ end
28
+ end
29
+
20
30
  end
21
- end
31
+ end
32
+
33
+ =begin
34
+ paths.app "app", :eager_load => true, :glob => "*"
35
+ paths.app.controllers "app/controllers", :eager_load => true
36
+ paths.app.helpers "app/helpers", :eager_load => true
37
+ paths.app.models "app/models", :eager_load => true
38
+ paths.app.mailers "app/mailers", :eager_load => true
39
+ paths.app.views "app/views"
40
+ paths.lib "lib", :load_path => true
41
+ paths.lib.tasks "lib/tasks", :glob => "**/*.rake"
42
+ paths.config "config"
43
+ paths.config.initializers "config/initializers", :glob => "**/*.rb"
44
+ paths.config.locales "config/locales", :glob => "*.{rb,yml}"
45
+ paths.config.routes "config/routes.rb"
46
+ paths.public "public"
47
+ paths.public.javascripts "public/javascripts"
48
+ paths.public.stylesheets "public/stylesheets"
49
+ paths
50
+ =end
@@ -0,0 +1,56 @@
1
+ # Experimental
2
+ #=begin
3
+ class AlarmsController < ApplicationController
4
+ before_filter :get_base_model
5
+ respond_to :json, :html
6
+
7
+ def index
8
+ respond_with(@base_model, (@alarms = @base_model.alarms.all))
9
+ end
10
+
11
+ def show
12
+ respond_with(@base_model, (@alarm = @base_model.alarms.find(params[:id])))
13
+ end
14
+
15
+ def new
16
+ respond_with(@base_model, (@alarm = @base_model.alarms.new))
17
+ end
18
+
19
+ def edit
20
+ respond_with(@base_model, (@alarm = @base_model.alarms.find(params[:id])))
21
+ end
22
+
23
+ def create
24
+ @alarm = @base_model.alarms.create(params[:alarm])
25
+ flash[:notice] = "Alarm successfully created" if @alarm.save
26
+ respond_with(@base_model, @alarm)
27
+ end
28
+
29
+ def update
30
+ @alarm = @base_model.alarms.find(params[:id])
31
+ @alarm.update_attributes(params[:base_model])
32
+ respond_with(@base_model, @alarm)
33
+ end
34
+
35
+ def destroy
36
+ @alarm = @base_model.alarms.find(params[:id])
37
+ @alarm.destroy
38
+
39
+ respond_to do |format|
40
+ format.html { redirect_to([@base_model, @alarm]) }
41
+ format.xml { head :ok }
42
+ end
43
+ end
44
+
45
+ private
46
+
47
+ def get_base_model
48
+ [[:calendar_id, Calendar], [:event_id, Event]].each { |c|
49
+ if params.keys.include?(c[0])
50
+ @base_model = c[1].find(c[0])
51
+ break
52
+ end
53
+ }
54
+ end
55
+ end
56
+ #=end
@@ -1,5 +1,5 @@
1
1
  class CalendarsController < ApplicationController
2
- respond_to :json, :html
2
+ respond_to :json, :html, :ical, :ics
3
3
  #verify :method => :post, :only => :create
4
4
 
5
5
  def index
@@ -0,0 +1,56 @@
1
+ # Experimental
2
+ =begin
3
+ class ComponentsController < ApplicationController
4
+ before_filter :get_super_component
5
+ respond_to :json, :html
6
+
7
+ def index
8
+ respond_with(@calendar, (@events = @calendar.events.all))
9
+ end
10
+
11
+ def show
12
+ respond_with(@calendar, (@event = @calendar.events.find(params[:id])))
13
+ end
14
+
15
+ def new
16
+ respond_with(@calendar, (@event = @calendar.events.new))
17
+ end
18
+
19
+ def edit
20
+ respond_with(@calendar, (@event = @calendar.events.find(params[:id])))
21
+ end
22
+
23
+ def create
24
+ @event = @calendar.events.create(params[:event])
25
+ flash[:notice] = "Event successfully created" if @event.save
26
+ respond_with(@calendar, @event)
27
+ end
28
+
29
+ def update
30
+ @event = @calendar.events.find(params[:id])
31
+ @event.update_attributes(params[:calendar])
32
+ respond_with(@calendar, @event)
33
+ end
34
+
35
+ def destroy
36
+ @event = @calendar.events.find(params[:id])
37
+ @event.destroy
38
+
39
+ respond_to do |format|
40
+ format.html { redirect_to(calendars_events_url(@calendar, @event)) }
41
+ format.xml { head :ok }
42
+ end
43
+ end
44
+
45
+ private
46
+
47
+ def get_super_component
48
+ [[:calendar_id, Calendar], [:event_id, Event]].each { |c|
49
+ if params.keys.include?(c[0])
50
+ @base_model = c[1].find(c[0])
51
+ break
52
+ end
53
+ }
54
+ end
55
+ end
56
+ =end
@@ -1,7 +1,5 @@
1
1
  class EventsController < ApplicationController
2
2
  before_filter :get_calendar
3
- # GET /events/new
4
- # GET /events/new.xml
5
3
  respond_to :json, :html
6
4
 
7
5
  def index
@@ -0,0 +1,48 @@
1
+ class JournalsController < ApplicationController
2
+ before_filter :get_calendar
3
+ respond_to :json, :html
4
+
5
+ def index
6
+ respond_with(@calendar, (@journals = @calendar.journals.all))
7
+ end
8
+
9
+ def show
10
+ respond_with(@calendar, (@journal = @calendar.journals.find(params[:id])))
11
+ end
12
+
13
+ def new
14
+ respond_with(@calendar, (@journal = @calendar.journals.new))
15
+ end
16
+
17
+ def edit
18
+ respond_with(@calendar, (@journal = @calendar.journals.find(params[:id])))
19
+ end
20
+
21
+ def create
22
+ @journal = @calendar.journals.create(params[:journal])
23
+ flash[:notice] = "Journal successfully created" if @journal.save
24
+ respond_with(@calendar, @journal)
25
+ end
26
+
27
+ def update
28
+ @journal = @calendar.journals.find(params[:id])
29
+ @journal.update_attributes(params[:calendar])
30
+ respond_with(@calendar, @journal)
31
+ end
32
+
33
+ def destroy
34
+ @journal = @calendar.journals.find(params[:id])
35
+ @journal.destroy
36
+
37
+ respond_to do |format|
38
+ format.html { redirect_to(calendars_journals_url(@calendar, @journal)) }
39
+ format.xml { head :ok }
40
+ end
41
+ end
42
+
43
+ private
44
+ def get_calendar
45
+ @calendar = Calendar.find(params[:calendar_id]) unless params[:calendar_id].nil?
46
+ end
47
+
48
+ end
@@ -0,0 +1,48 @@
1
+ class TodosController < ApplicationController
2
+ before_filter :get_calendar
3
+ respond_to :json, :html
4
+
5
+ def index
6
+ respond_with(@calendar, (@todos = @calendar.todos.all))
7
+ end
8
+
9
+ def show
10
+ respond_with(@calendar, (@todo = @calendar.todos.find(params[:id])))
11
+ end
12
+
13
+ def new
14
+ respond_with(@calendar, (@todo = @calendar.todos.new))
15
+ end
16
+
17
+ def edit
18
+ respond_with(@calendar, (@todo = @calendar.todos.find(params[:id])))
19
+ end
20
+
21
+ def create
22
+ @todo = @calendar.todos.create(params[:todo])
23
+ flash[:notice] = "Todo successfully created" if @todo.save
24
+ respond_with(@calendar, @todo)
25
+ end
26
+
27
+ def update
28
+ @todo = @calendar.todos.find(params[:id])
29
+ @todo.update_attributes(params[:calendar])
30
+ respond_with(@calendar, @todo)
31
+ end
32
+
33
+ def destroy
34
+ @todo = @calendar.todos.find(params[:id])
35
+ @todo.destroy
36
+
37
+ respond_to do |format|
38
+ format.html { redirect_to(calendars_todos_url(@calendar, @todo)) }
39
+ format.xml { head :ok }
40
+ end
41
+ end
42
+
43
+ private
44
+ def get_calendar
45
+ @calendar = Calendar.find(params[:calendar_id]) unless params[:calendar_id].nil?
46
+ end
47
+
48
+ end
@@ -18,6 +18,8 @@ class Calendar < Component
18
18
  r
19
19
  end
20
20
 
21
+
22
+
21
23
  end
22
24
 
23
25
 
@@ -103,5 +103,9 @@ class Component < ActiveRecord::Base
103
103
  end
104
104
  end
105
105
 
106
+ def to_ical(options ={})
107
+ self.ical.to_rfc2445_string
108
+ end
109
+
106
110
  end
107
111
 
@@ -1,4 +1,5 @@
1
1
  class Journal < Component
2
+ belongs_to :calendar
2
3
  has_many :components, :as => :parent
3
4
  has_many :alarms, :as => :owner
4
5
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ #Mime::Type.register "text/calendar", :ics
2
+ Mime::Type.register "text/calendar", :ical
@@ -1,5 +1,15 @@
1
1
  Rails.application.routes.draw do #|map|
2
- resources :calendars do
3
- resources :events
2
+ resources :calendars, :shallow => true do
3
+ resources :events do
4
+ resources :alarms
5
+ end
6
+ resources :journals
7
+ resources :alarms
8
+ resources :todos
4
9
  end
10
+
11
+ # resources :events do
12
+ # resources :alarms
13
+ # end
14
+
5
15
  end
@@ -0,0 +1,9 @@
1
+ ActionController.add_renderer :ical do |ical, options|
2
+ self.content_type ||= Mime::ICAL
3
+ self.response_body = ical.respond_to?(:to_ical) ? ical.to_ical(options) : ical
4
+ end
5
+
6
+ ActionController.add_renderer :ics do |ical, options|
7
+ self.content_type ||= Mime::ICS
8
+ self.response_body = ical.respond_to?(:to_ical) ? ical.to_ical(options) : ical
9
+ end
metadata CHANGED
@@ -5,16 +5,16 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
- authors: []
12
-
11
+ authors:
12
+ - Steve A Martin
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-27 00:00:00 +00:00
17
+ date: 2010-12-28 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -114,6 +114,7 @@ dependencies:
114
114
  version_requirements: *id007
115
115
  description: Actic is a calendaring engine for Rails3, it combines an iCal interface with ORM. It acts as a wrapper around the RiCal library
116
116
  email:
117
+ - steve@apptrix.net
117
118
  executables: []
118
119
 
119
120
  extensions: []
@@ -123,8 +124,12 @@ extra_rdoc_files: []
123
124
  files:
124
125
  - lib/actic/engine.rb
125
126
  - lib/actic.rb
127
+ - lib/app/controllers/alarms_controller.rb
126
128
  - lib/app/controllers/calendars_controller.rb
129
+ - lib/app/controllers/components_controller.rb
127
130
  - lib/app/controllers/events_controller.rb
131
+ - lib/app/controllers/journals_controller.rb
132
+ - lib/app/controllers/todos_controller.rb
128
133
  - lib/app/helpers/calendars_helper.rb
129
134
  - lib/app/models/alarm.rb
130
135
  - lib/app/models/calendar.rb
@@ -149,14 +154,26 @@ files:
149
154
  - lib/app/views/events/index.html.haml
150
155
  - lib/app/views/events/new.html.haml
151
156
  - lib/app/views/events/show.html.haml
157
+ - lib/app/views/journals/_form.html.haml
158
+ - lib/app/views/journals/edit.html.haml
159
+ - lib/app/views/journals/index.html.haml
160
+ - lib/app/views/journals/new.html.haml
161
+ - lib/app/views/journals/show.html.haml
162
+ - lib/app/views/todos/_form.html.haml
163
+ - lib/app/views/todos/edit.html.haml
164
+ - lib/app/views/todos/index.html.haml
165
+ - lib/app/views/todos/new.html.haml
166
+ - lib/app/views/todos/show.html.haml
167
+ - lib/config/initializers/mime_types.rb
152
168
  - lib/config/routes.rb
153
169
  - lib/generators/actic_install_generator.rb
154
170
  - lib/generators/templates/migration.rb.tmpl
171
+ - lib/renderers/ical.rb
155
172
  - MIT-LICENSE
156
173
  - Rakefile
157
174
  - README.rdoc
158
175
  has_rdoc: true
159
- homepage:
176
+ homepage: http://apptrix.net
160
177
  licenses: []
161
178
 
162
179
  post_install_message:
@@ -169,7 +186,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
169
186
  requirements:
170
187
  - - ">="
171
188
  - !ruby/object:Gem::Version
172
- hash: 2712728654667936074
189
+ hash: -38276750148363735
173
190
  segments:
174
191
  - 0
175
192
  version: "0"
@@ -178,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
195
  requirements:
179
196
  - - ">="
180
197
  - !ruby/object:Gem::Version
181
- hash: 2712728654667936074
198
+ hash: -38276750148363735
182
199
  segments:
183
200
  - 0
184
201
  version: "0"
@@ -188,6 +205,6 @@ rubyforge_project: actic
188
205
  rubygems_version: 1.3.7
189
206
  signing_key:
190
207
  specification_version: 3
191
- summary: iCal for ORM
208
+ summary: A fusion of ORM and ical
192
209
  test_files: []
193
210