Xavier Noria wrote:
> On Thu, Jun 11, 2009 at 10:19 PM, Tyler
> Knappe<[email protected]> wrote:
>
> If the real code is different please paste it.
Here is the code:
session[:next_week] = Date.today.cweek
render :update do |page|
page["Current_Week_div_1"].replace_html
session[:next_week].to_s
page["Week_div"].replace_html session[:next_week].to_s
page["test_div_1"].replace_html "Test 1"
page["test_div_2"].replace_html "Test 2"
page["test_div_3"].replace_html "Test 3"
page["test_div_4"].replace_html "Test 4"
page["test_div_5"].replace_html "Test 5"
page["test_div_6"].replace_html "Test 6"
page["test_div_7"].replace_html "Test 7"
for i in 0..23 do
for j in 0..6 do
if
(Date.today.beginning_of_week.to_time.to_i + ( j * 86400) + ( i * 3600)
+ ((session[:next_week] - session[:current_week]) * 7 * 86400 )) <
(session[:lab_object].end_time.to_time.to_i) &&
(Date.today.beginning_of_week.to_time.to_i + ( j * 86400) + ( i * 3600)
+ ((session[:next_week] - session[:current_week]) * 7 * 86400 )) >
(session[:lab_object].start_time.to_time.to_i - 3600)
page["test_div"].replace_html
"Checked Out"
else
page["test_div"].replace_html
"Available"
end
end
end
end
Executing this code only updates a single element.
BEFORE:
Monday Tuesday Wednesday Thursday Friday Saturday Sunday
0:00 Available Available Available Checked Out Checked Out Checked Out
Checked Out
1:00 Available Available Available Checked Out Checked Out Checked Out
Checked Out
[this continues for an entire week]
AFTER:
Monday Tuesday Wednesday Thursday Friday Saturday Sunday
0:00 <b>Checked Out</b> Available Available Checked Out Checked Out
Checked Out Checked Out
1:00 Available Available Available Checked Out Checked Out Checked Out
Checked Out
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---