1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-06-26 03:06:25 +02:00

paginator fixes with a lot more ifs, needed to make it work on index and category pages

This commit is contained in:
Matthias Kretschmann 2013-12-03 21:11:38 +01:00
parent af5d8bb989
commit 03541f98db
4 changed files with 86 additions and 66 deletions

View File

@ -1,22 +1,51 @@
<nav class="row pager pagination">
{% if paginator.previous_page %}
<p class="previous col2 alignleft">
<i class="icon-arrow-left"></i>
{% if paginator.previous_page == 1 %}
<a href="/" rel="prev">Previous</a>
{% else %}
<a href="page/{{ paginator.previous_page }}/" rel="prev">Previous</a>
{% endif %}
{% if paginator.total_pages > 1 %}
<nav class="row paginator">
{% if paginator.previous_page %}
<p class="previous col2">
<i class="icon-arrow-left"></i>
{% if page.category %}
{% if paginator.previous_page == 1 %}
<a href="/{{ page.category }}/" rel="prev">Previous</a>
{% else %}
<a href="/{{ page.category }}/page/{{ paginator.previous_page }}/" rel="prev">Previous</a>
{% endif %}
{% else %}
{% if paginator.previous_page == 1 %}
<a href="/" rel="prev">Previous</a>
{% else %}
<a href="/page/{{ paginator.previous_page }}/" rel="prev">Previous</a>
{% endif %}
{% endif %}
</p>
{% endif %}
<p class="col2 pagenumber textcenter">
<span class="page_number ">Page {{ paginator.page }} of {{ paginator.total_pages }}</span>
</p>
{% endif %}
<p class="col2 pagenumber textcenter">
<span class="page_number ">Page {{ paginator.page }} of {{ paginator.total_pages }}</span>
</p>
{% if paginator.next_page %}
<p class="next col2 alignright">
<a href="page/{{ paginator.next_page }}/" rel="next">Next</a>
<i class="icon-arrow-right"></i>
</p>
{% endif %}
</nav>
{% if paginator.next_page %}
<p class="next col2">
{% if page.category %}
<a href="/{{ page.category }}/page/{{ paginator.next_page }}/" rel="next">Next</a>
{% else %}
<a href="/page/{{ paginator.next_page }}/" rel="next">Next</a>
{% endif %}
<i class="icon-arrow-right"></i>
</p>
{% else %}
<p class="next col2">
The End
</p>
{% endif %}
</nav>
{% endif %}

View File

@ -1,17 +1,3 @@
/*
MAIN JS FOR KREMALICIOUS.COM
-----------------------------------------------------------------
Copyright (c) 2013 Matthias Kretschmann | http://mkretschmann.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
$(ASAP = function(){
@ -164,7 +150,7 @@ var infiniteScroll = {
$scrollContent.infinitescroll({
itemSelector : items,
nextSelector : '.next a',
navSelector : '.pagination',
navSelector : '.paginator',
binder : $scrollContent,
behavior : 'krlc3',
}, function($scrollContent) {

View File

@ -151,10 +151,10 @@
//
// Pager
// Paginator
//
.pager {
.paginator {
.clearfix;
p { position: relative; }
@ -166,20 +166,25 @@
top: 0;
}
.alignright { text-align: right; }
.alignleft i { margin-right: .5em; }
.alignright i {
margin-left: .5em;
left: auto;
right: 0;
.next {
text-align: right;
float: right;
a { margin-right: 1.5em; }
i {
margin-left: .5em;
left: auto;
right: 0;
}
}
.previous {
float: left;
a { margin-left: 1.5em; }
i { margin-right: .5em; }
}
.alignleft a { margin-left: 1.5em; }
.alignright a { margin-right: 1.5em; }
}
@ -190,17 +195,17 @@
width: 100%;
float: none;
margin-left: 0;
a {
.btn;
.aligncenter;
padding-top: @line-height-computed/1.5;
padding-bottom: @line-height-computed/1.5;
}
}
.infiniteLoader .previous,
.infiniteLoader .pagenumber,
.infiniteLoader i {
.hide;
}
.infiniteLoader .next a {
.btn;
.aligncenter;
padding-top: @line-height-computed/1.5;
padding-bottom: @line-height-computed/1.5;
}

View File

@ -7,15 +7,15 @@
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-less": "~0.6.4",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-cssmin": "~0.6.2",
"grunt-contrib-imagemin": "~0.4.0",
"grunt-combine-media-queries": "~1.0.8",
"grunt-contrib-uglify": "~0.2.2",
"grunt-jekyll": "~0.4.0",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-cssmin": "~0.6.2",
"grunt-contrib-less": "~0.6.4",
"grunt-contrib-imagemin": "~0.4.0",
"grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-watch": "~0.5.3",
"grunt-combine-media-queries": "~1.0.8",
"grunt-jekyll": "~0.4.0",
"grunt-rsync": "~0.2.1"
},
"repository": {