ruby on rails - How do you change the displayed order of ActiveScaffold "actions"? -


i using activescaffold in ruby on rails app, , have replaced default "actions" text in table (ie. "edit", "delete", "show") icons using css. have added couple of custom actions action_link.add ("move" , "copy").

for clarity, i have icons displayed in different order are. specifically, "edit" first icon displayed.

i seem able change order of action_links changing order of definition in controller. have been able change order of default actions first config.actions.excluding everything, , adding them config.actions.add in specific order.

however, my custom actions seem appear before default actions in list.

ideally them display "edit" "copy" "move" "delete" (ie - built-in, custom, custom, built-in). can suggest how might this?

one idea had re-define "edit" custom action (with default functionality), don't know how go either.

caveat: don't know activescaffold. answer based on me reading source code.

it looks action_links variable custom data structure, called actionlinks. it's defined in activescaffold::datastructures.

internally, has @set variable, not set @ all, array. actionlinks has add, delete, , each methods serve gatekeepers of @set variable.

when displaying links, activescaffold (in _list_actions.rhtml):

<% active_scaffold_config.action_links.each :record |link| -%>   # displays link (code removed brevity) <% end -%> 

so, short of extending activescaffold::datastructures::actionlinks add method sort values in @set differently, there doesn't seem way it, @ least not generally.

if you, i'd add called order_by!, pass array of symbols, proper order, , resorts @set. way, can call after you're done adding custom actions.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -