tweak roll up css, add pagination

This commit is contained in:
Dan Ballard 2016-01-09 09:04:31 -08:00
parent 94221611c1
commit 9476bf1e74
4 changed files with 28 additions and 5 deletions

View File

@ -40,8 +40,7 @@ body {
.post-content {
font-size: 12px;
min-height: 5em;
height: 5em;
max-height: 5em;
overflow: hidden;
padding-bottom: 10px;
}

View File

@ -46,7 +46,7 @@ $(document).ready( function () {
$(".content-slider").click(function (e) {
var contentDiv = $(this).parents('.news-row').find('.post-content');
if (contentDiv.hasClass("state-up")) {
contentDiv.removeClass('state-up').addClass('state-down').animate({height: '100%'});
contentDiv.removeClass('state-up').addClass('state-down').animate({'max-height': '100%', 'height': '100%'});
$(this).html('^');
} else {
contentDiv.removeClass('state-down').addClass('state-up').animate({height: '5em'});

View File

@ -418,7 +418,7 @@ func newsFormHandler(w http.ResponseWriter, r *http.Request, user *user.User, se
session.AddFlash("Error loading news", flash_err)
}
ShowTemplate("news", w, r, map[string]interface{}{"user": user, "flashes": flashes, "news": news, "count": count, "categories": categories.CategoriesFlat, "url": config.Url})
ShowTemplate("news", w, r, map[string]interface{}{"user": user, "flashes": flashes, "news": news, "count": count, "offset": argOffset, "amount": amount, "categories": categories.CategoriesFlat, "url": config.Url})
}
func ServeFileHandler(res http.ResponseWriter, req *http.Request) {

View File

@ -10,7 +10,11 @@
Drag this bookmarklet to bookmark bar and click anywhere to add a link
</div>
<div class="col-xs-4"></div>
{{template "pager" .}}
<div class="col-xs-12">&nbsp;</div>
</div>
<div class="news-posts">
{{range $news_post := .news}}
@ -18,6 +22,10 @@
{{end}}
</div>
<div class="row">
{{template "pager" .}}
</div>
{{end}}
<!-- print a news row -->
@ -57,5 +65,21 @@
</div>
{{end}}
{{define "pager"}}
<div class="col-xs-12">&nbsp;</div>
<div class="col-xs-2">
{{if ge .count .amount }}
<a href="?offset={{ add .offset 1}}">&lt; Prev</a>
{{end}}
</div>
<div class="col-xs-8">&nbsp;</div>
<div class="col-xs-2">
{{ if ne .offset 0 }}
<a href="?offset={{ minus .offset 1 }}">Next &gt</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}}