how i opposite rjs templates same rails controller?


i have controller slight advantage list dump down gets rendered partial, nonetheless depending where biased being used, rjs template needs different. i pass parameter controller establish rjs gets used?



here controller method, unequivocally simple:



def services
respond_to |format|
format.js {
@type = hospitalcriteria.find_by_id(params[:type_id])
@services = @type.children.all
}
end
end


and here rjs template gets rendered automatically



page.replace_html 'select_service', :partial => 'hospital/services'
page.replace_html 'select_condition', :partial => 'hospital/conditions'
page.replace_html 'select_procedure', :partial => 'hospital/procedures'

page << 'if ($("chosentype") != null) {'
page.replace_html 'chosentype', @type.name
page.replace_html 'chosenservice', 'selected service'
page.replace_html 'chosencondition', 'selected condition'
page.replace_html 'chosenprocedure', 'selected procedure'
page << '}'


Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?