๐ŸŽ‰ BIG NEWS ๐ŸŽ‰  โœฆ  Avo 4 has officially SHIPPED  โœฆ  ๐Ÿš€ the beta is over, 4.0 is here  โœฆ  ๐Ÿ› ๏ธ build admin panels, dashboards & internal tools at light speed  โœฆ  โญ you are visitor #1,136,462  โœฆ  ๐ŸŽŠ tell a friend  โœฆ  best viewed in Ruby on Rails  โœฆ  ๐Ÿ‘‰ click here to see what’s new  โœฆ 

Back to pricing
Gemfile

Custom Controls

Add to your plan

Define exactly what actions users can take based on their role or context. Prevent costly mistakes while empowering users.

# $20/mo

1 gem "avo-custom_controls"

The row of buttons at the top of every record, Edit, Delete, Save, Back, is the part of Avo your team clicks all day. By default Avo decides what sits there. Custom Controls hands you that decision: define show_controls, edit_controls, index_controls, or row_controls on a resource and build each bar from the pieces you want, in the order you want, across your Show, Edit, Index, and table-row views.

Compose the built-in buttons (back_button, edit_button, delete_button, save_button) with your own link_to links, Avo actions, and dropdown groups, set each one's label, icon, style, and color, and wrap any of them in plain Ruby conditionals so a control only shows when the record calls for it. It's a gem you add and a few methods you write, not a view layer you fork and then keep in sync with every Avo release.

See it in action

Show controls bar
Show controls
Edit controls bar
Edit controls
Index controls bar
Index controls
Row controls bar
Row controls

What it looks like

Each bar is a block on the resource. Compose built-in buttons, your own links, and Avo actions, and reach for default_controls when you only want to add to Avo's defaults rather than replace them.

Docs for each bar: Show, Edit, Index, and Row.

# app/avo/resources/post.rb
class Avo::Resources::Post < Avo::BaseResource
  # Show: built-ins plus a custom link and an action, shown conditionally
  self.show_controls = -> do
    back_button label: ""
    link_to "View on site", post_path(record), target: :_blank
    action Avo::Actions::Publish, style: :primary unless record.published?
    delete_button
    edit_button
  end

  # Edit: keep Avo's defaults, add one button of your own
  self.edit_controls = -> do
    link_to "Preview", preview_post_path(record), target: :_blank
    default_controls
  end

  # Index: group links into a dropdown, then the create button
  self.index_controls = -> do
    list label: "Export", icon: "heroicons/outline/arrow-down-tray" do
      link_to "CSV", export_posts_path(format: :csv)
      action Avo::Actions::EmailReport
    end
    create_button label: "New post"
  end

  # Row: per-record buttons, hidden in grid view
  self.row_controls = -> do
    action Avo::Actions::Feature, label: "Feature", style: :primary unless params[:view_type] == "grid"
    show_button
    edit_button
    delete_button
  end
end

What you get

  • Separate control bars for Show, Edit, Index, and table-row views via show_controls, edit_controls, index_controls, and row_controls
  • Built-in buttons to compose: back_button, edit_button, delete_button, save_button, create_button, detach_button, and attach_button
  • Add your own link_to links, trigger Avo actions, and group items into dropdown lists with dividers
  • Per-control label, title, icon (Heroicons), style (:primary, :outline, :text), and color
  • Plain Ruby conditionals to show or hide a control based on the record
  • default_controls to drop Avo's standard buttons back in alongside your custom ones

Why it pays off

  • Rearranging a control bar with a custom button takes a few lines in the resource this afternoon, not a custom view layer you spec and build over a sprint.
  • Every Avo release makes it better: the control bars on Show, Edit, Index, and row views keep working through upgrades, without you re-patching overridden templates.
  • The DSL covers Show, Edit, Index, and row contexts across many apps, so it handles authorization and per-view differences a one-off override tends to skip.
  • One less piece of admin UI for your team to own, document, and support.

# included in

# ready to ship?

You ship it this afternoon. We keep it solid for years.