Skip to content

Commit

Permalink
'Partial Links', header & footer templates
Browse files Browse the repository at this point in the history
  • Loading branch information
isabps committed Sep 25, 2024
1 parent 37e4175 commit 595c789
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
32 changes: 32 additions & 0 deletions app/views/home/_header.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<%= link_to 'app to learn', root_path, class:"navbar-brand" %>

<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">

<li class="nav-item">
<%= link_to 'About Us', home_about_path, class:"nav-link" %>
</li>

<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
<li/>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
1 change: 1 addition & 0 deletions app/views/home/about.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Hello fucking World!</h1>
3 changes: 2 additions & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
<link rel="icon" href="/icon.png" type="image/png">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/icon.png">
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_importmap_tags %>
</head>

<body>
<%= render 'home/header' %>
<div class="container">
<br/>
<%= yield %>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Rails.application.routes.draw do
root to: "home#index"
get "home/index"
get "home/about"
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html

# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
Expand Down

0 comments on commit 595c789

Please sign in to comment.