app/controllers/contract_controller.rb
# constructs a timeslot hash to store as a serialized yaml value
# in the database
#
constructs a timeslot hash to store as a serialized yaml value
in the database
constructs a timeslot hash to store as a serialized yaml value in the database
def add_timeslot
		valid = true
		notice=""
		tparams = params[:timeslot]
		if tparams[:weekdays].nil?
			notice = "Please specify at least one meeting day for the class."
			render :update do |page|
				page.replace_html 'timeslot_form_notice', notice
			end
			return
		end
		if tparams[:use_other]
			timeslot = ClassPeriod.new(tparams[:start_time][:hour]+':'+tparams[:start_time][:minute],
			                         tparams[:end_time][:hour]+':'+tparams[:end_time][:minute])
		else
		  timeslot = ClassPeriod.from_period_string(tparams[:period])
		end
		a=[]
		tparams[:weekdays].each do |key, value|
			a << value.to_i
		end
		timeslot.weekdays = a
		render :update do |page|
			page.insert_html :before, 'add_timeslot', :partial => "timeslot_line", :object => timeslot
			page.replace_html "add_timeslot", :partial => "timeslot_link"
		end
	end
def add_timeslot valid = true notice = "" tparams = params [ :timeslot ] if tparams [ :weekdays ] . nil? notice = "Please specify at least one meeting day for the class." render :update do | page | page . replace_html 'timeslot_form_notice' , notice end return end if tparams [ :use_other ] timeslot = ClassPeriod . new ( tparams [ :start_time ] [ :hour ] + ':' + tparams [ :start_time ] [ :minute ] , tparams [ :end_time ] [ :hour ] + ':' + tparams [ :end_time ] [ :minute ] ) else timeslot = ClassPeriod . from_period_string ( tparams [ :period ] ) end a = [ ] tparams [ :weekdays ] . each do | key , value | a << value . to_i end timeslot . weekdays = a render :update do | page | page . insert_html :before , 'add_timeslot' , :partial => "timeslot_line" , :object => timeslot page . replace_html "add_timeslot" , :partial => "timeslot_link" end end
constructs a timeslot hash to store as a serialized yaml value
in the database
constructs a timeslot hash to store as a serialized yaml value in the database
# at least one weekly meeting day is required for a timeslot # if custom timeslot not specified, store the timeslot # info from the canned list # store the custom values # store the weekdays # add the dom element to the page and close the timeslot form