added validation for all schedule fields (presence of) and working on a new way to dynamically update your calendar upon submission of a new calendar event
This commit is contained in:
@@ -17,6 +17,12 @@ class ScheduleController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_pto_schedule
|
||||||
|
respond_to do |format|
|
||||||
|
format.json {render :json => %q{[{"id":111,"title":"Event1","start":"2013-05-31","url":"http:\/\/yahoo.com\/"},{"id":222,"title":"Event2","start":"2013-05-30","end":"2013-05-30","url":"http:\/\/yahoo.com\/"}] }}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# Returns a two part array consisting of dates
|
# Returns a two part array consisting of dates
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ class Schedule < ActiveRecord::Base
|
|||||||
attr_accessible :date_begin, :date_end, :event_desc, :event_name, :event_type
|
attr_accessible :date_begin, :date_end, :event_desc, :event_name, :event_type
|
||||||
belongs_to :paid_time_off
|
belongs_to :paid_time_off
|
||||||
|
|
||||||
validates_presence_of :date_begin, :date_end
|
validates_presence_of :date_begin, :date_end, :event_desc, :event_name, :event_type
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -127,7 +127,7 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
$('#calendar').fullCalendar({
|
$('#calendar').fullCalendar({
|
||||||
|
events: <%= get_pto_schedule_schedule_index_path.inspect.html_safe %>,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ resources :tutorials do
|
|||||||
end
|
end
|
||||||
|
|
||||||
resources :schedule do
|
resources :schedule do
|
||||||
|
collection do
|
||||||
|
get "get_pto_schedule"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -53,6 +56,7 @@ resources :dashboard do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
root :to => "sessions#new"
|
root :to => "sessions#new"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user