administrate icon indicating copy to clipboard operation
administrate copied to clipboard

Page title does not appear for custom controller with no resource

Open alex-benoit opened this issue 3 years ago • 2 comments

Title is defined by: https://github.com/thoughtbot/administrate/blob/main/app/views/layouts/administrate/application.html.erb#L22

For custom controllers as described in https://administrate-demo.herokuapp.com/adding_controllers_without_related_model the title of the page is only "- AppName"

Intended behavior: Use the resource name defined in (example): app/dashboards/stat_dashboard.rb

alex-benoit avatar Nov 22 '22 03:11 alex-benoit

add this in your view

<% content_for(:title) { "Some words" } %>

jubilee2 avatar Nov 23 '22 14:11 jubilee2

@alex-benoit, thank you for your report. At the moment, the titles are defined in templates (index, show, new, edit), so I think @jubilee2's suggestion is the way to go.

Having said that, this should at the very least be documented. Would you be able to create a PR add a note on this to the "Adding Controllers without a related Model" page?

pablobm avatar Dec 13 '22 12:12 pablobm