Skip to content

Commit

Permalink
Move navigation and footer partials to components
Browse files Browse the repository at this point in the history
This way it'll be easier to decide when they should be rendered.

In order to be consistent, we're using the `Layout` module for both
components; previously, the navigation partial was in the `shared`
folder while the footer partial was in the `layout` folder, which IMHO
didn't make much sense.
  • Loading branch information
javierm committed Jan 12, 2023
1 parent 7b25f4f commit b497631
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 4 deletions.
File renamed without changes.
2 changes: 2 additions & 0 deletions app/components/layout/footer_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Layout::FooterComponent < ApplicationComponent
end
File renamed without changes.
3 changes: 3 additions & 0 deletions app/components/layout/subnavigation_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Layout::SubnavigationComponent < ApplicationComponent
delegate :content_block, :layout_menu_link_to, to: :helpers
end
4 changes: 2 additions & 2 deletions app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<div class="show-for-small-only">
<div class="subnavigation subnavigation-with-top-links">
<%= render "shared/subnavigation" %>
<%= render Layout::SubnavigationComponent.new %>
<%= render "shared/top_links" %>
</div>
</div>
Expand All @@ -40,7 +40,7 @@

<div id="navigation_bar" class="subnavigation">
<div class="hide-for-small-only">
<%= render "shared/subnavigation" %>
<%= render Layout::SubnavigationComponent.new %>
</div>

<%= yield :header_addon %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<%= yield %>
</div>
<div class="footer">
<%= render "layouts/footer" %>
<%= render Layout::FooterComponent.new %>
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion app/views/layouts/devise.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</div>

<div class="footer">
<%= render "layouts/footer" %>
<%= render Layout::FooterComponent.new %>
</div>
</body>
</html>

0 comments on commit b497631

Please sign in to comment.