A modern, responsive admin framework for Ruby on Rails
toolbar(:primary).clear!
# or
toolbar(:primary, clear: true) do |t|
t.button ...
end
toolbar(:primary) do |t|
# Buttons and links render a split button dropdown (primary button plus toggle)
t.button "Button" do |d|
d.header "Dropdown Header"
d.link "Dropdown Link", "#"
d.divider
end
t.link "Button link", "#" do |d|
d.link "Dropdown Link", "#"
end
# Dropdowns render an integrated button dropdown (primary button triggers the dropdown)
t.dropdown "Dropdown" do |d|
d.link "Dropdown Link", "#"
end
end
scopes do
Tag.all do |tag|
scope tag.name, -> { Post.tagged(tag) }
end
end
menu
blocks to access controller methodsconfig.favicon
to set favicon within adminid
and data
attributes to be passed to panel
helper:en
locale is unavailablecurrent_user
, request
, etc)header: false
option to disable table header:if
/:unless
options to be passed to table columnshelp: { text: "message", float: true }
#delete_instance
and #save_instance
adapter methodstoolbar(:secondary) do |t|
t.group do
t.button "Approve", style: :success, icon: "fa fa-thumbs-up"
t.button "Reject", style: :danger, icon: "fa fa-ban"
end
t.link "More Info", "...", style: :info
end
content_for(:primary_toolbar) do
timestamp
and datestamp
helpers:header
option:if
/:unless
options for hooksconfig.timestamp_precision
option defaulting to :minutes
config.root
option to set title and root breadcrumb link targetsview.title
hook for overriding sidebar headerresource.index.header
and resource.index.footer
hooksdata-toggle="confirm"
:append!
/:prepend!
optionstrestle_form_for
to override defaultsavatar
helper to div tagTrestle.resource(:name, singular: true) do ...
)config.reload
option to customize admin reloading strategy (:always
or :on_update
)Trestle::Resource#instance_path(instance, options)
methodadmin_for(instance)
helperbreadcrumb false
form_group
helper behavior within templateswill_paginate
gem (must set custom Kaminari.config.page_method_name
)data-dialog-class
link attribute:if
and :unless
(Proc) options to navigation item builderh1
..h6
helpers for headings within formsunscoped
adapter methodfinalize_collection
adapter methodscope
blockspaginate per: X
return_to { :back }
to redirect to previous page after actionform dialog: true do...
)remove_action
resource builder method to disable default actionsreturn_to
resource builder method to customize create/update/delete return locationbreadcrumb
admin builder method to override breadcrumbautolink: false
table option to disable automatic row linkingTrestle.init
JS callback for scoped element initializationTrestle.cookie.get
~> 1.1.0
Trestle.cookie
)options[:label]
option to navigation items to explicitly set labelTrestle::Options
hash merging in edge Railsformat: :tags
admin_link_to
and admin_url_for
no longer fall back to the current adminTrestle::Adapters::SequelAdapter
)#build_instance
and #update_instance
Adapter methods#human_attribute_name
Adapter methodAdapter#default_attributes
into #default_form_attributes
and #default_table_attributes
railties
rather than rails
coffee-rails
rails generate trestle:admin NAME
)config.helper
configuration optionconfig.before_action
, config.after_action
and config.around_action
configuration optionsbefore_action
, after_action
and around_action
sort_column
resource method for defining custom column sorts