Greg wrote:> ---
>
> #link_controller helper:
>
> def update_link_list(new_link)
> if @saved
> page[''listing-status''].replace_html
"You''ve created
> #{@num_links} links in #{@num_cats} categories"
> page[''no-links''].remove if @num_links == 1
&& page[''no-links'']
> page.insert_html :after,
"category-#{new_link.category_id}",
> :partial => ''link'', :object => new_link
> page.visual_effect :highlight, "link-#{new_link.id}"
> page.replace_html ''new_link_error'',
''''
> page[''link_url''].value =
''http://''
> page[''link_name''].value = ''''
> page[''link_description''].value =
''''
> else # not saved, present error messages
> page.replace_html ''new_link_error'',
error_messages_for(new_link)
> page.visual_effect :appear, ''new_link_error'',
:duration => 0.5
> page.visual_effect :highlight, ''new_link_error'',
:duration =>
> 0.5
> end
> end
>
> ----
Ooops ... should be this (apologies):
def update_link_list(new_link, was_saved, num_links, num_cats)
if was_saved
page[''listing-status''].replace_html
"You''ve created #{num_links}
links in #{num_cats} categories"
page[''no-links''].remove if num_links == 1 &&
page[''no-links'']
page.insert_html :after, "category-#{new_link.category_id}",
:partial => ''link'', :object => new_link
page.visual_effect :highlight, "link-#{new_link.id}"
page.replace_html ''new_link_error'',
''''
page[''link_url''].value = ''http://''
page[''link_name''].value = ''''
page[''link_description''].value = ''''
else # not saved, present error messages
page.replace_html ''new_link_error'',
error_messages_for(new_link)
page.visual_effect :appear, ''new_link_error'',
:duration => 0.5
page.visual_effect :highlight, ''new_link_error'',
:duration =>
0.5
end
end
--
Posted via http://www.ruby-forum.com/.