-
Notifications
You must be signed in to change notification settings - Fork 178
Home
coezbek edited this page Dec 7, 2021
·
21 revisions
Full documentation is coming soon.
A: In config/initializers/trestle.rb
set config.favicon = "favicon.ico"
A: In config/locales/en.yml
set en.admin.<model>.titles.index
(see issue). For instance if you model is called AuthorityCard
:
# config/locales/en.yml
en:
admin:
authority_cards:
breadcrumbs:
index: "Authority Cards"
titles:
index: "List of Authority cards"
A: You can remove default actions (e.g. create
, destroy
) from a resource like so:
Trestle.resource(:articles) do
remove_action :destroy
This will result in the delete button no longer being present on the index or show pages.
Note that if you want to remove the "New resource" button to prevent resources from being created, you should remove both :new
and :create
:
Trestle.resource(:articles) do
remove_action :new, :create
A: If you need to create a button that brings you to the resource in the "frontend" using the Rails routes you can use the follow (given model
is your admin instance):
/app/admin/model_admin.rb
unless model.new_record?
concat content_tag(:hr)
concat link_to("Preview", Rails.application.routes.url_helpers.model_path(model), class: "btn btn-primary", target: :_blank)
end