talks / appengine-demo-go / 9-user-urls / shortie / html.go

package shortie

const homeHTML = `
        <title>Shortie - The URL Shortener</title>
        <link rel="stylesheet" href="/static/style.css" />
        <link rel="shortcut icon" href="/static/logo.png" />
        <div class="header">
            The URL Shortener
            <span class="right">
				<a href="{{ .LoginURL }}">{{ .LoginTitle }}</a>

        {{ if .Error }}
        <div class="error">
            ERROR: {{ .Error | html}}
        {{ end }}

        {{ if .ShortURL }}
        <div class="short">
            Url shortened to <a href="{{ .ShortURL }}">{{ .ShortURL }}</a>
        {{ end }}

        <form method="post">
            <label for="url">Url:</label><input name="url" /> 
            <input type="submit" value="Shorten">

		{{ with .URLs }}
        <b>Your Urls</b>
        <table class="urls">
			{{ range $idx, $url := . }}
				<tr class="{{ $idx | oddeven }}">
					<td title="{{ .Long | html }}">
						<a href="{{ .Long }}">{{ .Short }}</a>
					<td>{{ .Created | strftime }}</td>
					<td>{{ .Hits }}</td>
            {{ end }}
        {{ end }}

        <div class="footer">
            G'day {{ .User }}, we've shortened {{ .Count }} urls so far.

// vim: ft=html
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.