actic 0.0.2.2 → 0.0.2.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/actic.rb +1 -1
- data/lib/actic/engine.rb +14 -0
- data/lib/app/controllers/calendars_controller.rb +83 -0
- data/lib/app/helpers/calendars_helper.rb +3 -0
- data/lib/app/models/component.rb +13 -2
- data/lib/app/views/calendars/_form.html.haml +0 -0
- data/lib/app/views/calendars/edit.html.haml +0 -0
- data/lib/app/views/calendars/index.html.haml +0 -0
- data/lib/app/views/calendars/new.html.haml +0 -0
- data/lib/app/views/calendars/show.html.haml +0 -0
- data/lib/config/routes.rb +3 -0
- data/lib/generators/actic_install_generator.rb +21 -0
- data/lib/{migrate/20101217173535_create_components.rb → generators/templates/migration.rb.tmpl} +0 -0
- metadata +40 -7
- data/lib/app/models/inspectable.rb +0 -2
- data/lib/migrate/20101218062739_create_inspectables.rb +0 -12
data/lib/actic.rb
CHANGED
data/lib/actic/engine.rb
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
module Actic
|
|
3
3
|
class Engine < Rails::Engine
|
|
4
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__)
|
|
5
8
|
config.autoload_paths << File.expand_path("../../migrate", __FILE__)
|
|
9
|
+
config.autoload_paths << File.expand_path("../../app/helpers", __FILE__)
|
|
10
|
+
|
|
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
|
+
|
|
16
|
+
rake_tasks do
|
|
17
|
+
#load "your_railtie/railties/tasks.rake"
|
|
18
|
+
end
|
|
19
|
+
|
|
6
20
|
end
|
|
7
21
|
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
class CalendarsController < ApplicationController
|
|
2
|
+
# GET /calendars
|
|
3
|
+
# GET /calendars.xml
|
|
4
|
+
def index
|
|
5
|
+
@calendars = Calendar.all
|
|
6
|
+
|
|
7
|
+
respond_to do |format|
|
|
8
|
+
format.html # index.html.erb
|
|
9
|
+
format.xml { render :xml => @calendars }
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# GET /calendars/1
|
|
14
|
+
# GET /calendars/1.xml
|
|
15
|
+
def show
|
|
16
|
+
@calendar = Calendar.find(params[:id])
|
|
17
|
+
|
|
18
|
+
respond_to do |format|
|
|
19
|
+
format.html # show.html.erb
|
|
20
|
+
format.xml { render :xml => @calendar }
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# GET /calendars/new
|
|
25
|
+
# GET /calendars/new.xml
|
|
26
|
+
def new
|
|
27
|
+
@calendar = Calendar.new
|
|
28
|
+
|
|
29
|
+
respond_to do |format|
|
|
30
|
+
format.html # new.html.erb
|
|
31
|
+
format.xml { render :xml => @calendar }
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# GET /calendars/1/edit
|
|
36
|
+
def edit
|
|
37
|
+
@calendar = Calendar.find(params[:id])
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# POST /calendars
|
|
41
|
+
# POST /calendars.xml
|
|
42
|
+
def create
|
|
43
|
+
@calendar = Calendar.new(params[:calendar])
|
|
44
|
+
|
|
45
|
+
respond_to do |format|
|
|
46
|
+
if @calendar.save
|
|
47
|
+
format.html { redirect_to(@calendar, :notice => 'Dummy resource was successfully created.') }
|
|
48
|
+
format.xml { render :xml => @calendar, :status => :created, :location => @calendar }
|
|
49
|
+
else
|
|
50
|
+
format.html { render :action => "new" }
|
|
51
|
+
format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# PUT /calendars/1
|
|
57
|
+
# PUT /calendars/1.xml
|
|
58
|
+
def update
|
|
59
|
+
@calendar = Calendar.find(params[:id])
|
|
60
|
+
|
|
61
|
+
respond_to do |format|
|
|
62
|
+
if @calendar.update_attributes(params[:calendar])
|
|
63
|
+
format.html { redirect_to(@calendar, :notice => 'Dummy resource was successfully updated.') }
|
|
64
|
+
format.xml { head :ok }
|
|
65
|
+
else
|
|
66
|
+
format.html { render :action => "edit" }
|
|
67
|
+
format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# DELETE /calendars/1
|
|
73
|
+
# DELETE /calendars/1.xml
|
|
74
|
+
def destroy
|
|
75
|
+
@calendar = Calendar.find(params[:id])
|
|
76
|
+
@calendar.destroy
|
|
77
|
+
|
|
78
|
+
respond_to do |format|
|
|
79
|
+
format.html { redirect_to(calendars_url) }
|
|
80
|
+
format.xml { head :ok }
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
data/lib/app/models/component.rb
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
class Component < ActiveRecord::Base
|
|
2
2
|
attr_accessor :component
|
|
3
3
|
after_initialize :set_component
|
|
4
|
+
before_save :trigger_parent_component#, :except => :create
|
|
4
5
|
|
|
5
6
|
def set_component
|
|
6
|
-
|
|
7
|
+
#@component = self.ical if (self.ical != nil)
|
|
7
8
|
|
|
8
9
|
[[Calendar, RiCal.Calendar], [Event, RiCal.Event], [Todo, RiCal.Todo],
|
|
9
10
|
[Journal, RiCal.Journal], [Alarm, RiCal.Alarm], [FreeBusy, RiCal.Freebusy]].each {|comp|
|
|
@@ -34,7 +35,7 @@ class Component < ActiveRecord::Base
|
|
|
34
35
|
|
|
35
36
|
def component_names
|
|
36
37
|
self.class.reflect_on_all_associations.map do |a|
|
|
37
|
-
a.name if a.klass.ancestors.include?
|
|
38
|
+
a.name if a.klass.ancestors.include?(Component) && (a.macro != :belongs_to)
|
|
38
39
|
end.compact
|
|
39
40
|
end
|
|
40
41
|
|
|
@@ -51,6 +52,16 @@ class Component < ActiveRecord::Base
|
|
|
51
52
|
}
|
|
52
53
|
end
|
|
53
54
|
|
|
55
|
+
def belongs_to
|
|
56
|
+
self.class.reflect_on_all_associations.select {|a| a.macro == :belongs_to }
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def trigger_parent_component
|
|
60
|
+
self.belongs_to.each {|asc|
|
|
61
|
+
self.send(asc.name).add_component(self) unless self.send(asc.name).nil?
|
|
62
|
+
} if self.new_record?
|
|
63
|
+
end
|
|
64
|
+
|
|
54
65
|
#These methods override ActiveRecords methods
|
|
55
66
|
class << self
|
|
56
67
|
def table_name
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# require 'rails/generators'
|
|
2
|
+
# require 'rails/generators/migration'
|
|
3
|
+
require 'rails/generators/active_record'
|
|
4
|
+
class ActicInstallGenerator < Rails::Generators::Base
|
|
5
|
+
include Rails::Generators::Migration
|
|
6
|
+
|
|
7
|
+
source_root File.expand_path("../templates", __FILE__)
|
|
8
|
+
|
|
9
|
+
# def self.source_root
|
|
10
|
+
# @source_root ||= File.join(File.dirname(__FILE__), 'templates')
|
|
11
|
+
# end
|
|
12
|
+
|
|
13
|
+
def self.next_migration_number(dirname)
|
|
14
|
+
ActiveRecord::Generators::Base.next_migration_number(dirname)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def create_migration_file
|
|
18
|
+
migration_template 'migration.rb.tmpl', "db/migrate/create_actic_components.rb"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
data/lib/{migrate/20101217173535_create_components.rb → generators/templates/migration.rb.tmpl}
RENAMED
|
File without changes
|
metadata
CHANGED
|
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
|
|
|
6
6
|
- 0
|
|
7
7
|
- 0
|
|
8
8
|
- 2
|
|
9
|
-
-
|
|
10
|
-
version: 0.0.2.
|
|
9
|
+
- 3
|
|
10
|
+
version: 0.0.2.3
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors: []
|
|
13
13
|
|
|
@@ -46,6 +46,32 @@ dependencies:
|
|
|
46
46
|
type: :runtime
|
|
47
47
|
prerelease: false
|
|
48
48
|
version_requirements: *id002
|
|
49
|
+
- !ruby/object:Gem::Dependency
|
|
50
|
+
name: haml
|
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
|
52
|
+
none: false
|
|
53
|
+
requirements:
|
|
54
|
+
- - ">="
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
segments:
|
|
57
|
+
- 0
|
|
58
|
+
version: "0"
|
|
59
|
+
type: :runtime
|
|
60
|
+
prerelease: false
|
|
61
|
+
version_requirements: *id003
|
|
62
|
+
- !ruby/object:Gem::Dependency
|
|
63
|
+
name: haml-rails
|
|
64
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
|
65
|
+
none: false
|
|
66
|
+
requirements:
|
|
67
|
+
- - ">="
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
segments:
|
|
70
|
+
- 0
|
|
71
|
+
version: "0"
|
|
72
|
+
type: :runtime
|
|
73
|
+
prerelease: false
|
|
74
|
+
version_requirements: *id004
|
|
49
75
|
description: Actic is a calendaring engine for Rails3, it combines an iCal interface with ORM. It acts as a wrapper around the RiCal library
|
|
50
76
|
email:
|
|
51
77
|
executables: []
|
|
@@ -57,12 +83,13 @@ extra_rdoc_files: []
|
|
|
57
83
|
files:
|
|
58
84
|
- lib/actic/engine.rb
|
|
59
85
|
- lib/actic.rb
|
|
86
|
+
- lib/app/controllers/calendars_controller.rb
|
|
87
|
+
- lib/app/helpers/calendars_helper.rb
|
|
60
88
|
- lib/app/models/alarm.rb
|
|
61
89
|
- lib/app/models/calendar.rb
|
|
62
90
|
- lib/app/models/component.rb
|
|
63
91
|
- lib/app/models/event.rb
|
|
64
92
|
- lib/app/models/free_busy.rb
|
|
65
|
-
- lib/app/models/inspectable.rb
|
|
66
93
|
- lib/app/models/journal.rb
|
|
67
94
|
- lib/app/models/pattern.rb
|
|
68
95
|
- lib/app/models/patterns/ex_date.rb
|
|
@@ -71,8 +98,14 @@ files:
|
|
|
71
98
|
- lib/app/models/patterns/r_rule.rb
|
|
72
99
|
- lib/app/models/sub_calendar.rb
|
|
73
100
|
- lib/app/models/todo.rb
|
|
74
|
-
- lib/
|
|
75
|
-
- lib/
|
|
101
|
+
- lib/app/views/calendars/_form.html.haml
|
|
102
|
+
- lib/app/views/calendars/edit.html.haml
|
|
103
|
+
- lib/app/views/calendars/index.html.haml
|
|
104
|
+
- lib/app/views/calendars/new.html.haml
|
|
105
|
+
- lib/app/views/calendars/show.html.haml
|
|
106
|
+
- lib/config/routes.rb
|
|
107
|
+
- lib/generators/actic_install_generator.rb
|
|
108
|
+
- lib/generators/templates/migration.rb.tmpl
|
|
76
109
|
- MIT-LICENSE
|
|
77
110
|
- Rakefile
|
|
78
111
|
- README.rdoc
|
|
@@ -90,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
90
123
|
requirements:
|
|
91
124
|
- - ">="
|
|
92
125
|
- !ruby/object:Gem::Version
|
|
93
|
-
hash:
|
|
126
|
+
hash: 106874503336549993
|
|
94
127
|
segments:
|
|
95
128
|
- 0
|
|
96
129
|
version: "0"
|
|
@@ -99,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
99
132
|
requirements:
|
|
100
133
|
- - ">="
|
|
101
134
|
- !ruby/object:Gem::Version
|
|
102
|
-
hash:
|
|
135
|
+
hash: 106874503336549993
|
|
103
136
|
segments:
|
|
104
137
|
- 0
|
|
105
138
|
version: "0"
|