-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add several layout hooks to provide extra content (#2574)
This commit allows us to add content in some additional places, from around the header to around the main body, which means users can more easily customise their templates without needing to override the whole file.
- Loading branch information
Showing
7 changed files
with
114 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 3 additions & 28 deletions
31
spec/example_app/app/views/admin/customers/_index_header.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,8 @@ | ||
<% content_for(:title) do %> | ||
<%= display_resource_name(page.resource_name) %> | ||
<% end %> | ||
|
||
<header class="main-content__header"> | ||
<h1 class="main-content__page-title" id="page-title"> | ||
<%= content_for(:title) %> | ||
</h1> | ||
|
||
<% content_for(:header_middle) do %> | ||
<div> | ||
You are logged in as <em><%= pundit_user.name %></em>. | ||
<%= link_to("Become the Admin", become_admin_customer_path("admin")) unless pundit_user.admin? %> | ||
</div> | ||
<% end %> | ||
|
||
<% if show_search_bar %> | ||
<%= render( | ||
"search", | ||
search_term: search_term, | ||
resource_name: display_resource_name(page.resource_name) | ||
) %> | ||
<% end %> | ||
|
||
<div> | ||
<%= link_to( | ||
t( | ||
"administrate.actions.new_resource", | ||
name: display_resource_name(page.resource_name, singular: true).downcase | ||
), | ||
[:new, namespace, page.resource_path.to_sym], | ||
class: "button", | ||
) if accessible_action?(new_resource, :new) %> | ||
</div> | ||
</header> | ||
<%= render template: 'administrate/application/_index_header', locals: local_assigns %> |