98 lines
3.7 KiB
HTML
98 lines
3.7 KiB
HTML
{{define "body"}}
|
|
<h2 class="news-heading">News</h2>
|
|
{{template "flashes" .}}
|
|
<div class="row">
|
|
<div class="col-xs-2">
|
|
<a class="btn btn-lg btn-primary btn-block" href="{{template "launch-add" .}}">Add to transmet</a>
|
|
</div>
|
|
|
|
<div class="col-xs-6">
|
|
Drag this bookmarklet to bookmark bar and click anywhere to add a link
|
|
</div>
|
|
<div class="col-xs-4"></div>
|
|
|
|
<div class="col-xs-12"> </div>
|
|
|
|
<form method="GET" class="search" />
|
|
<input type="hidden" name="offset" value="{{.offset}}" />
|
|
<div class="col-xs-2">Filter by Category:</div>
|
|
<div class="col-xs-3">
|
|
{{template "select-category" dict "categories" .categories "id" -1 "fieldName" "category"}}
|
|
</div>
|
|
<div class="col-xs-1"> </div>
|
|
<div class="col-xs-4"><input name="search" class="form-control" placeholder="Search title" /></div>
|
|
<div class="col-xs-2"> </div>
|
|
</form>
|
|
|
|
{{template "pager" .}}
|
|
|
|
<div class="col-xs-12"> </div>
|
|
|
|
</div>
|
|
<div class="news-posts">
|
|
{{range $news_post := .news}}
|
|
{{template "row-news" dict "post" $news_post "categories" $.categories "csrfField" $.csrfField}}
|
|
{{end}}
|
|
</div>
|
|
|
|
<div class="row">
|
|
{{template "pager" .}}
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
<!-- print a news row -->
|
|
{{define "row-news"}}
|
|
<div class="news-row">
|
|
<div class="row">
|
|
<div class="col-xs-2 post-category">
|
|
{{fullCategoryPath .categories .post.Category_id}}
|
|
</div>
|
|
<div class="col-xs-8 post-title">
|
|
<strong>{{truncate .post.Title 100}}</strong>
|
|
</div>
|
|
<div class="col-xs-2 post-date">
|
|
{{dateFormat .post.Date}}
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-xs-2"> </div>
|
|
<div class="col-xs-8 post-url">
|
|
<a href="{{.post.Url}}">{{truncate .post.Url 100}}</a>
|
|
</div>
|
|
<div class="col-xs-2 post-edit"><a href="/news/{{.post.Id}}/edit" class="btn btn-default btn-sm btn-block">Edit</a></div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-xs-2"> </div>
|
|
<div class="col-xs-8 post-content state-up"> {{ .post.HTMLNotes }}</div>
|
|
<div class="col-xs-2 post-delete">
|
|
<form method="POST" action="/news/{{.post.Id}}/delete" class="confirm-news-delete">{{ .csrfField }}
|
|
<input type="submit" class="btn btn-default btn-sm btn-block" value="Delete" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-xs-2"> </div>
|
|
<div class="col-xs-8 btn-default btn content-slider state-up">v</div>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
|
|
{{define "pager"}}
|
|
<div class="col-xs-12"> </div>
|
|
|
|
<div class="col-xs-2">
|
|
{{if ge .count .amount }}
|
|
<a href="?offset={{ add .offset 1}}">< Prev</a>
|
|
{{end}}
|
|
</div>
|
|
<div class="col-xs-8"> </div>
|
|
<div class="col-xs-2">
|
|
{{ if ne .offset 0 }}
|
|
<a href="?offset={{ minus .offset 1 }}">Next ></a>
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|
|
|
|
<!-- JS for the launcher of the add bookmarklet -->
|
|
{{define "launch-add"}}javascript:(function() { var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='{{.url}}/news/add',l=d.location,e=encodeURIComponent,u=f+'?popup=1&url='+e(l.href)+'&title='+e(d.title)+'&selection='+e(s);a=function(){if(!w.open(u,'t','toolbar=0,resizable=1,scrollbars=1,status=1,width=720,height=480'))l.href=u;};if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0); else a();void(0) })();{{end}} |