i was thinking, that for alot of my application, when i have a record, i
want a menu with all the related ajax calls linked to a that record.
there might me a gem to do this, or an easier way, but this is what i
did. i am open to new ideas, as this was made to work easily from any
view by calling a partial and setting up the ajax info in the helpers.
what do you all think about this type of DRY? is there another better
way? i got it working on link_to but now working on link_to_remote.
well, you are a lot smarter then me, so i might not be doing this right.
in each controller, i already have a layout template, that is pretty
complex.
i need to use that.
so, when i edit or show a record, i was gonna display the table data,
and then, under that, show the menu for remote links.
it all seems to work nice, and is really fast to add ajax menu items.
well, for my application. you just have to watch with layout you use in
a controller, depending on what method is going to be called.
and i need to track what menu was selected. so i can gray the menu
background. and fix up a few more things.
i am installing in several places, and i will update it tomorrow if you
want to see it in action. it is not perfectly clean yet, but that is
just me doing some clean up.
if you have another idea, let me know. i will try it on a table.
We use something here to select which menu item is selected. I can’t
show
you the exact code, but basically you give the containing element of the
link a class depending on an argument passed in.
def menu_selected(menu_item)
if menu_item == “edit” && params[:action] == “edit”
“selected”
end
We use something here to select which menu item is selected. I can’t
show
you the exact code, but basically you give the containing element of the
link a class depending on an argument passed in.
def menu_selected(menu_item)
if menu_item == “edit” && params[:action] == “edit”
“selected”
end