-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do you customize the title of admin pages? #47
Comments
As you've found, it's not currently possible to change the title in this way without editing the template file (the only way would be to add some custom translations to your i18n However this is very high on my list of priorities, along with changing the default breadcrumbs. Expect to see something on this within the next week. |
Does the |
For now, setting titles via cloning templates and using However I am right now working on a new API for defining toolbars, which will lead directly into the new actions API. Once that's in place, only extreme customizations will require overriding the templates. |
You rock man!
Working on plugins I’m thinking... any suggestions?
…--
Joshua F. Rountree | UX Developer
The E.W. Scripps Company
312 Walnut Street, Suite 2800, Floor 29th, Office 29W109
Cincinnati, Ohio 45202-4024
(513) 977-3840 (office, M-F, 7a-4p)
(513) 827-7936 (mobile)
On Aug 16, 2018, 8:26 PM -0400, Sam Pohlenz ***@***.***>, wrote:
For now, setting titles via cloning templates and using content_for is still the best solution.
However I am right now working on a new API for defining toolbars, which will lead directly into the new actions API. Once that's in place, only extreme customizations will require overriding the templates.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I'm not experienced enough with content_for() to figure out how to make use of that method... but did end up realizing it was the show.html.erb that was responsible fro the record titles, not the edit or new. |
Any updates in this space? Trying to customize the "human name" for a model which in turn would change the title of a dialog |
@jfrux what is |
i am on 0.8.12 can i change title of the form for the "new route" i saw the code says I want it to be someothing other than model name for one of the resource/admin |
hi:) I know this is a bit stale, but is there still no way to customise not only the titles but also labels for resources? |
I know it is "a bit" to late, but I leave this for future references: en:
admin:
authority_cards:
breadcrumbs:
index: "Authority Cards"
titles:
index: "List of Authority cards" where authority_cards is the name of the resource. This way you can customise all admin pages Restarting servers is required/advisable after modification if the translations are not loaded EDIT: Turns out that this work only for index. To override other actions you need to duplicate the templates show.html.erb and edit.html.erb |
So still there isn't a way to make this dynamic other than replacing the whole view, right? |
So this is what I was able to do so far:
<%
content_for(
:title,
admin.respond_to?(:custom_index_title) ?
admin.custom_index_title :
admin.t("titles.index", default: "Listing %{pluralized_model_name}")
)
%>
Trestle.resource(:credentials) do
admin.define_method(:custom_index_title) do
title = 'Credentials'
if @context.params[:lock_id]
title += " for #{Lock.find(@context.params[:lock_id]).serial_number}"
end
title
end
end @spohlenz will you be interested into a PR to do? Trestle.resource(:name) do
index_title do # self = admin or self = Admin::Controller ?
# ...
end
end |
I have a model called
Activity
. How do I get the title to displayEditing #{instance.name}
instead of the generic"Editing Activity"
without writing my own `resource/show.html.erb?I looked for a hook for this and didn't see if this was possible.
The text was updated successfully, but these errors were encountered: