Add types package
This commit is contained in:
@@ -7,9 +7,11 @@ import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/vcraescu/go-paginator"
|
||||
|
||||
"github.com/justinas/nosurf"
|
||||
|
||||
"git.mills.io/prologic/spyda"
|
||||
"git.mills.io/prologic/spyda/internal/session"
|
||||
"github.com/justinas/nosurf"
|
||||
"git.mills.io/prologic/spyda/types"
|
||||
)
|
||||
|
||||
type Meta struct {
|
||||
@@ -50,7 +52,8 @@ type Context struct {
|
||||
Title string
|
||||
Meta Meta
|
||||
|
||||
Pager *paginator.Paginator
|
||||
Results types.Results
|
||||
Pager *paginator.Paginator
|
||||
|
||||
// Report abuse
|
||||
ReportURL string
|
||||
|
||||
@@ -27,84 +27,13 @@
|
||||
{{ end }}
|
||||
|
||||
{{ define "item" }}
|
||||
<article id="{{ $.Item.Hash }}" class="h-entry">
|
||||
<div class="u-author h-card">
|
||||
<div>
|
||||
{{ if $.User.Is $.Twt.Twter.URL }}
|
||||
<a href="{{ $.User.URL | trimSuffix "/twtxt.txt" }}" class="u-url">
|
||||
<img class="avatar u-photo" src="/user/{{ $.User.Username }}/avatar" alt="" />
|
||||
</a>
|
||||
{{ else }}
|
||||
{{ if isLocalURL $.Twt.Twter.URL }}
|
||||
<a href="{{ $.Twt.Twter.URL | trimSuffix "/twtxt.txt" }}" class="u-url">
|
||||
<img class="avatar u-photo" src="/user/{{ $.Twt.Twter.Nick }}/avatar" alt="" />
|
||||
{{ else }}
|
||||
<a href="/external?uri={{ $.Twt.Twter.URL }}&nick={{ $.Twt.Twter.Nick }}" class="u-url">
|
||||
{{ if $.Twt.Twter.Avatar }}
|
||||
<img class="avatar u-photo" src="{{ $.Twt.Twter.Avatar }}" alt="" />
|
||||
{{ else }}
|
||||
<i class="icss-rss" style="font-size:3em"></i>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="author">
|
||||
{{ if $.User.Is $.Twt.Twter.URL }}
|
||||
<a href="{{ $.User.URL | trimSuffix "/twtxt.txt" }}" class="p-name">me</a>
|
||||
{{ else }}
|
||||
{{ if isLocalURL $.Twt.Twter.URL }}
|
||||
<a href="{{ $.Twt.Twter.URL | trimSuffix "/twtxt.txt" }}" class="p-name">{{ $.Twt.Twter.Nick }}</a>
|
||||
{{ else }}
|
||||
<a href="/external?uri={{ $.Twt.Twter.URL }}&nick={{ $.Twt.Twter.Nick }}" class="p-name">
|
||||
{{ $.Twt.Twter.Nick }}
|
||||
<span class="p-org">@{{ $.Twt.Twter.URL | hostnameFromURL }}</span>
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<div class="publish-time">
|
||||
<a class="u-url" href="/twt/{{ $.Twt.Hash }}">
|
||||
<time class="dt-published" datetime="{{ $.Twt.Created | date "2006-01-02T15:04:05Z07:00" }}">
|
||||
{{ dateInZone ($.Twt.Created | formatForDateTime) $.Twt.Created $.User.DisplayDatesInTimezone }}
|
||||
</time>
|
||||
</a>
|
||||
<span> ({{ $.Twt.Created | time }})</span>
|
||||
{{ if $.Authenticated }}
|
||||
<span>
|
||||
<a class="bookmark" href="/bookmark/{{ $.Twt.Hash }}" data-tooltip="{{ if $.User.Bookmarked $.Twt.Hash }}Remove Twt Bookmark{{ else }}Bookmark Twt{{ end }}">
|
||||
<i class="icss-{{ if $.User.Bookmarked $.Twt.Hash }}circle{{ else }}circle-o{{ end }}"></i>
|
||||
</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-summary">
|
||||
{{ $.Twt.Text | formatTwt }}
|
||||
</div>
|
||||
<hr />
|
||||
<nav>
|
||||
<ul>
|
||||
{{ if $.Authenticated }}
|
||||
{{ if eq $.LastTwt.Hash $.Twt.Hash }}
|
||||
<li><a class="edit" href="#" data-hash="{{ $.Twt.Hash }}" data-text="{{ $.Twt.Text | unparseTwt }}"><i class="icss-edit"></i>Edit</a></li>
|
||||
<li> </li>
|
||||
<li><a class="delete" href="#" data-hash="{{ $.Twt.Hash }}"><i class="icss-x"></i>Delete</a></li>
|
||||
<li> </li>
|
||||
{{ end }}
|
||||
<li><a class="reply" href="#" data-reply="{{ $.User.Reply $.Twt }}"><i class="icss-arrow-left"></i>Reply</a></li>
|
||||
<li> </li>
|
||||
{{ end }}
|
||||
{{ with urlForBlog $.Twt }}
|
||||
<li><a class="blog" href="{{ urlForBlog $.Twt }}"><i class="icss-quill-pen"></i>Blog</a></li>
|
||||
<li> </li>
|
||||
{{ end }}
|
||||
{{ with urlForConv $.Twt }}
|
||||
<li><a class="conv" href="{{ urlForConv $.Twt }}"><i class="icss-comment"></i>Conversation</a></li>
|
||||
<li> </li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</nav>
|
||||
<article>
|
||||
<hgroup>
|
||||
<h2><a href="{{ $.URL }}">{{ $.Title }}</a></h2>
|
||||
<h3>Updated {{ $.UpdatedAt | time }}</h3>
|
||||
</hgroup>
|
||||
<p{{ if $.Summary }}>{{ .Summary }}{{ else }} class="placeholder">No summary available{{ end }}</p>
|
||||
<p class="small"><a href="{{ $.URL }}">{{ $.URL }}</a> {{ .Length }} <a href="/cache/{{ .ID }}">View cached</a></p>
|
||||
</article>
|
||||
{{ end }}
|
||||
|
||||
@@ -115,7 +44,7 @@
|
||||
{{ range $idx, $item := $.Results }}
|
||||
{{ template "item" (dict "Item" $item) }}
|
||||
{{ else }}
|
||||
<small><i>No search results found.</i></small>
|
||||
<small><i>No search results found.</i></small>
|
||||
{{ end }}
|
||||
{{ template "pager" $.Pager }}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user