index.gohtml 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. {{ define "index.gohtml" }}
  2. {{block "content" . }}
  3. <form action="/contacts" method="get" class="tool-bar">
  4. <label for="search">Search Term</label>
  5. <input id="search" type="search" name="q" value="{{ .search }}"/>
  6. <input type="submit" value="Search"/>
  7. </form>
  8. <table>
  9. <thead>
  10. <tr>
  11. <th>First</th>
  12. <th>Last</th>
  13. <th>Phone</th>
  14. <th>Email</th>
  15. <th></th>
  16. </tr>
  17. </thead>
  18. <tbody>
  19. {{ range .contacts }}
  20. <tr>
  21. <td>{{ .First }}</td>
  22. <td>{{ .Last }}</td>
  23. <td>{{ .Phone }}</td>
  24. <td>{{ .Email }}</td>
  25. <td><a href="/contacts/{{ .ID }}/edit">Edit</a>
  26. <a href="/contacts/{{ .ID }}">View</a></td>
  27. </tr>
  28. {{ else }}
  29. <tr>
  30. <td>No contacts founds.</td>
  31. </tr>
  32. {{ end }}
  33. </tbody>
  34. </table>
  35. <p><a href="/contacts/new">Add Contact</a></p>
  36. {{ end}}
  37. {{ end }}