// Code generated by hero.
// source: C:\Users\User\go\src\coursera\template_adv\template\index.html
// DO NOT EDIT!
package template

import (
	"bytes"
	"coursera/template_adv/item"

	"github.com/shiyanhui/hero"
)

func Index(items []*item.Item, buffer *bytes.Buffer) {
	buffer.WriteString(`<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
  </head>
  <body>
    `)
	buffer.WriteString(`
<div class="container">
    <h1>Posts</h1>
    <table class="table">
    <thead>
        <tr>
        <th>#</th>
        <th>Title</th>
        <th>Description</th>
        <th style="width:140px;"><a href="/items/new" class="btn btn-success">New</a></th>
        </tr>
    </thead>
    <tbody>
    `)
	for _, item := range items {
		buffer.WriteString(`
    <tr>
        <td>`)
		hero.FormatInt(int64(item.Id), buffer)
		buffer.WriteString(`</td>
        <td>`)
		hero.EscapeHTML(item.Title, buffer)
		buffer.WriteString(`</td>
        <td>`)
		hero.EscapeHTML(item.Description, buffer)
		buffer.WriteString(`</td>
        <td>
            <a href="/items/`)
		hero.FormatInt(int64(item.Id), buffer)
		buffer.WriteString(`" class="btn btn-primary">Edit</a>
            <span data-id="`)
		hero.FormatInt(int64(item.Id), buffer)
		buffer.WriteString(`" class="do-delete btn btn-danger">Del</span>
        </td>
    </tr>
    `)
	}
	buffer.WriteString(`
    </tbody>
</div>
`)

	buffer.WriteString(`
  </body>
</html>
`)

}
