Skip to content

Commit

Permalink
chore(gomall/tutorial): add product link on home page ch10
Browse files Browse the repository at this point in the history
  • Loading branch information
baiyutang committed Jun 3, 2024
1 parent b6a6854 commit eba28d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions gomall/tutorial/ch10/app/frontend/template/header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
<a class="nav-link" href="/about" >About</a>
</li>
</ul>
<form class="d-flex" role="search">
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
<form class="d-flex ms-auto" role="search" action="/search" method="get">
<input class="form-control me-2" type="search" name="q" placeholder="Search"
aria-label="Search" value="{{ .q }}">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>

Expand Down
12 changes: 7 additions & 5 deletions gomall/tutorial/ch10/app/frontend/template/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
<div class="row">
{{range .items}}
<div class="card col-xl-3 col-lg-4 col-md-6 col-sm-12 p-5 border-0" >
<img src="{{.Picture}}" class="card-img-top" alt="...">
<div class="card-body">
<p class="card-text">{{ .Name}}</p>
<h5 class="card-title">{{ .Price}}</h5>
</div>
<a href="/product?id={{ .Id }}" class="btn">
<img src="{{.Picture}}" class="card-img-top" alt="...">
<div class="card-body">
<p class="card-text">{{ .Name}}</p>
<h5 class="card-title">{{ .Price}}</h5>
</div>
</a>
</div>
{{end}}
</div>
Expand Down

0 comments on commit eba28d3

Please sign in to comment.