bobbytables/table_cloth

Re-think actions syntax

bobbytables opened this issue · 1 comments

Been contemplating how to approach the action column syntax. I've heard that it is essentially useless since you can make it with a normal column. However I believe being able to define certain actions to be omitted is great.

My proposal is this

actions do
  action { |object| link_to "Edit", edit_object_path(object) }
  action(if: :admin?) { |object| link_to "Delete", object_path(object), method: :delete }
end

# OR

actions class: 'actions', valign: 'top' do
  action { |object| link_to "Edit", edit_object_path(object) }
  action(if: :admin?) { |object| link_to "Delete", object_path(object), method: :delete }
end