diff --git a/css/template.css b/css/template.css index 9fc9ff3..0bc74ce 100644 --- a/css/template.css +++ b/css/template.css @@ -40,8 +40,7 @@ body { .post-content { font-size: 12px; - min-height: 5em; - height: 5em; + max-height: 5em; overflow: hidden; padding-bottom: 10px; } diff --git a/js/funcs.js b/js/funcs.js index 930acc0..71444ef 100644 --- a/js/funcs.js +++ b/js/funcs.js @@ -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'}); diff --git a/route_handlers.go b/route_handlers.go index 6ee8026..9ea0cbf 100644 --- a/route_handlers.go +++ b/route_handlers.go @@ -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) { diff --git a/templates/pages/news.html b/templates/pages/news.html index 6d863ae..a9e2d41 100644 --- a/templates/pages/news.html +++ b/templates/pages/news.html @@ -9,14 +9,22 @@
Drag this bookmarklet to bookmark bar and click anywhere to add a link
-
+
+ + {{template "pager" .}} +
 
+
{{range $news_post := .news}} {{template "row-news" dict "post" $news_post "categories" $.categories "csrfField" $.csrfField}} {{end}}
+ +
+ {{template "pager" .}} +
{{end}} @@ -57,5 +65,21 @@ {{end}} +{{define "pager"}} +
 
+ +
+ {{if ge .count .amount }} + < Prev + {{end}} +
+
 
+
+ {{ if ne .offset 0 }} + Next > + {{end}} +
+{{end}} + {{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}} \ No newline at end of file