Source

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

package shortie

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

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

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

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

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

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

// 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 ProjectModifiedEvent.java.
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.