devape_calendar 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +36 -0
- data/app/controllers/member/calendars_controller.rb +84 -0
- data/app/models/member/calendar.rb +2 -0
- data/app/views/member/calendars/_form.html.erb +33 -0
- data/app/views/member/calendars/edit.html.erb +6 -0
- data/app/views/member/calendars/index.html.erb +48 -0
- data/app/views/member/calendars/new.html.erb +5 -0
- data/app/views/member/calendars/show.html.erb +23 -0
- data/config/routes.rb +3 -0
- data/lib/devape_calendar/engine.rb +4 -0
- data/lib/devape_calendar.rb +4 -0
- data/lib/rails/generators/devape_calendar/devape_calendar_generator.rb +14 -0
- data/lib/rails/generators/devape_calendar/templates/fullcalendar.css +618 -0
- data/lib/rails/generators/devape_calendar/templates/fullcalendar.js +5208 -0
- data/lib/rails/generators/devape_calendar/templates/fullcalendar.min.js +113 -0
- data/lib/rails/generators/devape_calendar/templates/fullcalendar.print.css +61 -0
- data/lib/rails/generators/devape_calendar/templates/gcal.js +112 -0
- data/lib/rails/generators/devape_calendar/templates/initializer.rb +8 -0
- data/lib/rails/generators/devape_calendar/templates/migration.rb +16 -0
- data/lib/rails/generators/devape_calendar/templates/schema.rb +11 -0
- data/lib/tasks/devape_calendar_tasks.rake +4 -0
- metadata +76 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2011 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'DevapeCalendar'
|
18
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
24
|
+
load 'rails/tasks/engine.rake'
|
25
|
+
|
26
|
+
require 'rake/testtask'
|
27
|
+
|
28
|
+
Rake::TestTask.new(:test) do |t|
|
29
|
+
t.libs << 'lib'
|
30
|
+
t.libs << 'test'
|
31
|
+
t.pattern = 'test/**/*_test.rb'
|
32
|
+
t.verbose = false
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
task :default => :test
|
@@ -0,0 +1,84 @@
|
|
1
|
+
class Member::CalendarsController < AbstractMemberController
|
2
|
+
# GET /member/calendars
|
3
|
+
# GET /member/calendars.json
|
4
|
+
def index
|
5
|
+
@member_calendars = Member::Calendar.find_by_sql("SELECT * from calendars")
|
6
|
+
@foo = @member_calendars.to_json
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.json { render json: @member_calendars }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /member/calendars/1
|
14
|
+
# GET /member/calendars/1.json
|
15
|
+
def show
|
16
|
+
@member_calendar = Member::Calendar.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.json { render json: @member_calendar }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /member/calendars/new
|
25
|
+
# GET /member/calendars/new.json
|
26
|
+
def new
|
27
|
+
@member_calendar = Member::Calendar.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.json { render json: @member_calendar }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /member/calendars/1/edit
|
36
|
+
def edit
|
37
|
+
@member_calendar = Member::Calendar.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /member/calendars
|
41
|
+
# POST /member/calendars.json
|
42
|
+
def create
|
43
|
+
@member_calendar = Member::Calendar.new(params[:member_calendar])
|
44
|
+
@member_calendar.user_id = current_user.id
|
45
|
+
|
46
|
+
respond_to do |format|
|
47
|
+
if @member_calendar.save
|
48
|
+
format.html { redirect_to @member_calendar, notice: 'Calendar was successfully created.' }
|
49
|
+
format.json { render json: @member_calendar, status: :created, location: @member_calendar }
|
50
|
+
else
|
51
|
+
format.html { render action: "new" }
|
52
|
+
format.json { render json: @member_calendar.errors, status: :unprocessable_entity }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# PUT /member/calendars/1
|
58
|
+
# PUT /member/calendars/1.json
|
59
|
+
def update
|
60
|
+
@member_calendar = Member::Calendar.find(params[:id])
|
61
|
+
|
62
|
+
respond_to do |format|
|
63
|
+
if @member_calendar.update_attributes(params[:member_calendar])
|
64
|
+
format.html { redirect_to @member_calendar, notice: 'Calendar was successfully updated.' }
|
65
|
+
format.json { head :ok }
|
66
|
+
else
|
67
|
+
format.html { render action: "edit" }
|
68
|
+
format.json { render json: @member_calendar.errors, status: :unprocessable_entity }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# DELETE /member/calendars/1
|
74
|
+
# DELETE /member/calendars/1.json
|
75
|
+
def destroy
|
76
|
+
@member_calendar = Member::Calendar.find(params[:id])
|
77
|
+
@member_calendar.destroy
|
78
|
+
|
79
|
+
respond_to do |format|
|
80
|
+
format.html { redirect_to member_calendars_url }
|
81
|
+
format.json { head :ok }
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<%= form_for(@member_calendar) do |f| %>
|
2
|
+
<% if @member_calendar.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@member_calendar.errors.count, "error") %> prohibited this member_calendar from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @member_calendar.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :event_id %><br />
|
16
|
+
<%= f.number_field :event_id %>
|
17
|
+
</div>
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :title %><br />
|
20
|
+
<%= f.text_field :title %>
|
21
|
+
</div>
|
22
|
+
<div class="field">
|
23
|
+
<%= f.label :start %><br />
|
24
|
+
<%= f.datetime_select :start %>
|
25
|
+
</div>
|
26
|
+
<div class="field">
|
27
|
+
<%= f.label :end %><br />
|
28
|
+
<%= f.datetime_select :end %>
|
29
|
+
</div>
|
30
|
+
<div class="actions">
|
31
|
+
<%= f.submit %>
|
32
|
+
</div>
|
33
|
+
<% end %>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<h1>Listing member_calendars</h1>
|
2
|
+
<%= link_to 'New Calendar', new_member_calendar_path %>
|
3
|
+
<script type='text/javascript'>
|
4
|
+
//var foo = {"bindings": [
|
5
|
+
// {"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"},
|
6
|
+
// {"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete.*"},
|
7
|
+
// {"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"}
|
8
|
+
// ]
|
9
|
+
//};
|
10
|
+
var foo = <%= raw @foo %>;
|
11
|
+
|
12
|
+
$(document).ready(function() {
|
13
|
+
var date = new Date();
|
14
|
+
var d = date.getDate();
|
15
|
+
var m = date.getMonth();
|
16
|
+
var y = date.getFullYear();
|
17
|
+
alert(Date(y,m,1));
|
18
|
+
$('#calendar').fullCalendar({
|
19
|
+
header: {
|
20
|
+
left: 'prev,next today',
|
21
|
+
center: 'title',
|
22
|
+
right: 'month,agendaWeek,agendaDay'
|
23
|
+
},
|
24
|
+
editable: false,
|
25
|
+
events:foo
|
26
|
+
});
|
27
|
+
|
28
|
+
});
|
29
|
+
|
30
|
+
</script>
|
31
|
+
<style type='text/css'>
|
32
|
+
|
33
|
+
body {
|
34
|
+
margin-top: 40px;
|
35
|
+
text-align: center;
|
36
|
+
font-size: 14px;
|
37
|
+
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
|
38
|
+
}
|
39
|
+
|
40
|
+
#calendar {
|
41
|
+
width: 900px;
|
42
|
+
margin: 0 auto;
|
43
|
+
}
|
44
|
+
|
45
|
+
</style>
|
46
|
+
<div id='calendar'></div>
|
47
|
+
</body>
|
48
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<p>
|
2
|
+
<b>Event:</b>
|
3
|
+
<%= @member_calendar.event_id %>
|
4
|
+
</p>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<b>Notes:</b>
|
8
|
+
<%= @member_calendar.title %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<b>Start date:</b>
|
13
|
+
<%= @member_calendar.start %>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p>
|
17
|
+
<b>End date:</b>
|
18
|
+
<%= @member_calendar.end %>
|
19
|
+
</p>
|
20
|
+
|
21
|
+
|
22
|
+
<%= link_to 'Edit', edit_member_calendar_path(@member_calendar) %> |
|
23
|
+
<%= link_to 'Back', member_calendars_path %>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
|
4
|
+
class DevapeCalendarGenerator < Rails::Generators::Base
|
5
|
+
include Rails::Generators::Migration
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
def copy_initializer_file
|
8
|
+
copy_file "migration.rb", "db/migrate/0000000003_migrate_devape_calendar.rb"
|
9
|
+
copy_file "fullcalendar.css", "app/assets/stylesheets/fullcalendar.css"
|
10
|
+
copy_file "fullcalendar.js", "app/assets/javascripts/fullcalendar.js"
|
11
|
+
copy_file "gcal.js", "app/assets/javascripts/gcal.js"
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|