actic 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,23 @@
1
1
  = Actic
2
2
 
3
- This project rocks and uses MIT-LICENSE.
3
+ WARNING: THIS IS STILL VERY ALPHA!
4
+ This project is an icalendar engine for Rails3, it fuses ActiveRecord with iCal ( using the RiCal library ) and uses MIT-LICENSE.
5
+
6
+ This is a very alpha software, functionality is currently incomplete, the model layer is close to finished,
7
+ but the controller and views are a long way off.
8
+
9
+
10
+ To install
11
+
12
+ in your Gemfile
13
+ gem 'actic'
14
+
15
+ bundle install
16
+
17
+ to install the engine into your app:
18
+
19
+ rails g actic_install
20
+
21
+ This will give you
22
+ Calendars that can accept events and other components, the specs are still very limited, there is alot
23
+ more that I would like to ( and will ) add to this engine.
@@ -1,77 +1,33 @@
1
1
  class CalendarsController < ApplicationController
2
2
  respond_to :json, :html
3
- # GET /calendars
4
- # GET /calendars.xml
3
+ #verify :method => :post, :only => :create
4
+
5
5
  def index
6
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
7
  end
12
8
 
13
- # GET /calendars/1
14
- # GET /calendars/1.xml
15
9
  def show
16
10
  respond_with(@calendar = Calendar.find(params[:id]))
17
- =begin
18
- respond_to do |format|
19
- format.html # show.html.erb
20
- format.xml { render :xml => @calendar }
21
- end
22
- =end
23
11
  end
24
12
 
25
- # GET /calendars/new
26
- # GET /calendars/new.xml
27
13
  def new
28
- @calendar = Calendar.new
29
-
30
- respond_to do |format|
31
- format.html # new.html.erb
32
- format.xml { render :xml => @calendar }
33
- end
14
+ respond_with(@calendar = Calendar.new)
34
15
  end
35
16
 
36
- # GET /calendars/1/edit
37
17
  def edit
38
- @calendar = Calendar.find(params[:id])
18
+ respond_with(@calendar = Calendar.find(params[:id]))
39
19
  end
40
20
 
41
- # POST /calendars
42
- # POST /calendars.xml
43
21
  def create
44
- @calendar = Calendar.new(params[:calendar])
45
-
46
- respond_to do |format|
47
- if @calendar.save
48
- format.html { redirect_to(@calendar, :notice => 'Dummy resource was successfully created.') }
49
- format.xml { render :xml => @calendar, :status => :created, :location => @calendar }
50
- else
51
- format.html { render :action => "new" }
52
- format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }
53
- end
54
- end
22
+ respond_with(@calendar = Calendar.create(params[:calendar]))
55
23
  end
56
24
 
57
- # PUT /calendars/1
58
- # PUT /calendars/1.xml
59
25
  def update
60
26
  @calendar = Calendar.find(params[:id])
61
-
62
- respond_to do |format|
63
- if @calendar.update_attributes(params[:calendar])
64
- format.html { redirect_to(@calendar, :notice => 'Dummy resource was successfully updated.') }
65
- format.xml { head :ok }
66
- else
67
- format.html { render :action => "edit" }
68
- format.xml { render :xml => @calendar.errors, :status => :unprocessable_entity }
69
- end
70
- end
27
+ @calendar.update_attributes(params[:calendar])
28
+ respond_with(@calendar)
71
29
  end
72
30
 
73
- # DELETE /calendars/1
74
- # DELETE /calendars/1.xml
75
31
  def destroy
76
32
  @calendar = Calendar.find(params[:id])
77
33
  @calendar.destroy
@@ -2,100 +2,49 @@ class EventsController < ApplicationController
2
2
  before_filter :get_calendar
3
3
  # GET /events/new
4
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
5
+ respond_to :json, :html
26
6
 
27
7
  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
8
+ respond_with(@calendar, (@events = @calendar.events.all))
34
9
  end
35
10
 
36
- # GET /events/1
37
- # GET /events/1.xml
38
11
  def show
39
- @event = @calendar.events.find(params[:id])
12
+ respond_with(@calendar, (@event = @calendar.events.find(params[:id])))
13
+ end
40
14
 
41
- respond_to do |format|
42
- format.html # show.html.erb
43
- format.xml { render :xml => @event }
44
- end
15
+ def new
16
+ respond_with(@calendar, (@event = @calendar.events.new))
45
17
  end
46
18
 
47
- # GET /events/1/edit
48
19
  def edit
49
- @event = @calendar.events.find(params[:id])
20
+ respond_with(@calendar, (@event = @calendar.events.find(params[:id])))
50
21
  end
51
22
 
52
- # POST /events
53
- # POST /events.xml
54
23
  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
24
+ @event = @calendar.events.create(params[:event])
25
+ flash[:notice] = "Event successfully created" if @event.save
26
+ respond_with(@calendar, @event)
66
27
  end
67
28
 
68
- # PUT /events/1
69
- # PUT /events/1.xml
70
29
  def update
71
30
  @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
31
+ @event.update_attributes(params[:calendar])
32
+ respond_with(@calendar, @event)
82
33
  end
83
34
 
84
- # DELETE /events/1
85
- # DELETE /events/1.xml
86
35
  def destroy
87
36
  @event = @calendar.events.find(params[:id])
88
37
  @event.destroy
89
38
 
90
39
  respond_to do |format|
91
- format.html { redirect_to(events_url) }
40
+ format.html { redirect_to(calendars_events_url(@calendar, @event)) }
92
41
  format.xml { head :ok }
93
42
  end
94
43
  end
95
-
44
+
96
45
  private
97
46
  def get_calendar
98
- @calendar = Calendar.find(params[:event_id]) unless params[:event_id].nil?
99
- end
100
- =end
47
+ @calendar = Calendar.find(params[:calendar_id]) unless params[:calendar_id].nil?
48
+ end
49
+
101
50
  end
@@ -1,4 +1,5 @@
1
1
  class Component < ActiveRecord::Base
2
+ validates :ical, :presence => true, :format => /BEGIN:\.*/
2
3
  attr_accessor :component
3
4
  after_initialize :set_component
4
5
  before_save :trigger_parent_component#, :except => :create
@@ -0,0 +1,5 @@
1
+ = form_for @calendar do |f|
2
+ =f.label :name
3
+ =f.text_field :name
4
+
5
+ =f.submit
@@ -0,0 +1 @@
1
+ =render :partial => 'form'
@@ -0,0 +1,20 @@
1
+ %h1 Listing calendars
2
+
3
+ %table
4
+ %tr
5
+ %th Name
6
+ %th Ical
7
+ %th
8
+ %th
9
+
10
+ - @calendars.each do |calendar|
11
+ %tr
12
+ %td= calendar.name
13
+ %td= calendar.ical
14
+ %td= link_to 'Show', calendar
15
+ %td= link_to 'Edit', edit_calendar_path(calendar)
16
+ %td= link_to 'Destroy', calendar, :confirm => 'Are you sure?', :method => :delete
17
+
18
+ %br
19
+
20
+ = link_to 'New calendar', new_calendar_path
@@ -0,0 +1 @@
1
+ =render :partial => 'form'
@@ -0,0 +1,3 @@
1
+ %p
2
+ Name
3
+ =@calendar.name
@@ -1,5 +1,5 @@
1
1
  Rails.application.routes.draw do #|map|
2
2
  resources :calendars do
3
- resources :events#, :controller => "Calendars::Events"
4
- end#, :controller => '../app/controllers/calendars'#, :only => [:new, :create]
3
+ resources :events
4
+ end
5
5
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors: []
12
12
 
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-23 00:00:00 +00:00
17
+ date: 2010-12-27 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -99,6 +99,19 @@ dependencies:
99
99
  type: :development
100
100
  prerelease: false
101
101
  version_requirements: *id006
102
+ - !ruby/object:Gem::Dependency
103
+ name: database_cleaner
104
+ requirement: &id007 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ segments:
110
+ - 0
111
+ version: "0"
112
+ type: :development
113
+ prerelease: false
114
+ version_requirements: *id007
102
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
103
116
  email:
104
117
  executables: []
@@ -156,7 +169,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
156
169
  requirements:
157
170
  - - ">="
158
171
  - !ruby/object:Gem::Version
159
- hash: -2081845520581045814
172
+ hash: 2712728654667936074
160
173
  segments:
161
174
  - 0
162
175
  version: "0"
@@ -165,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
178
  requirements:
166
179
  - - ">="
167
180
  - !ruby/object:Gem::Version
168
- hash: -2081845520581045814
181
+ hash: 2712728654667936074
169
182
  segments:
170
183
  - 0
171
184
  version: "0"