Skip to content

Commit

Permalink
Merge pull request #17 from toalina/pagination
Browse files Browse the repository at this point in the history
Pagination
  • Loading branch information
toalina committed Oct 15, 2015
2 parents 4122a82 + afc7476 commit 8c6ed1a
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 158 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
build
build
38 changes: 0 additions & 38 deletions build/html/blog.html

This file was deleted.

78 changes: 0 additions & 78 deletions build/html/blogpost.html

This file was deleted.

31 changes: 0 additions & 31 deletions build/html/form.html

This file was deleted.

3 changes: 2 additions & 1 deletion build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ <h1 class="logo">intelly</h1>
</header>

<!-- SOME KIND OF NG-VIEW THING -->
<main ng-view ng-controller="GistsCtrl">
<main ng-view ng-controller="GistsCtrl">
<div ng-include="'./html/blogpost.html'"></div>
</main>
<!-- CONTACT SECTION -->
<section>
Expand Down
10 changes: 4 additions & 6 deletions src/html/blogpost.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ <h1>Blog</h1>
<article ng-repeat="gist in gists|pager:pagination" class="blog-summary">
<!-- filter:search -->
<h1>{{ gist.description }}</h1>

<a href="{{gist.html_url}}">{{gist.id}}</a>
<!-- <p> {{ Gist Files Here}}</p> -->
<a href="{{gist.html_url}}">View Original</a>
<img src="{{gist.owner.avatar_url}}" alt="Alina's big face" height="20%" width="20%">

<ul class="blog-metadata">
Expand All @@ -57,7 +57,6 @@ <h1>{{ gist.description }}</h1>
{{file.language}}
</li>
</ul>

</ul>

<a class="btn-primary" href="#/blogposts/:blog {{ gist.id }}">Read More</a>
Expand All @@ -67,10 +66,9 @@ <h1>{{ gist.description }}</h1>

<a class="btn-primary-alt" href="#/blogposts/new">Add New</a>

<a class="btn-small" ng-click="pagination.prevPage()">Prev</a>
<a class="btn-small" ng-click="pagination.nextPage()">Next</a>

</div>
<button class="btn-small" type="button" ng-click="pagination.prevPage()">Prev</button>
<button class="btn-small" type="button" ng-click="pagination.nextPage()">Next</button>
</section>


Expand Down
3 changes: 2 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ <h1 class="logo">intelly</h1>
</header>

<!-- SOME KIND OF NG-VIEW THING -->
<main ng-view ng-controller="GistsCtrl">
<main ng-view ng-controller="GistsCtrl">
<div ng-include="'./html/blogpost.html'"></div>
</main>
<!-- CONTACT SECTION -->
<section>
Expand Down
2 changes: 1 addition & 1 deletion src/js/gists-ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require('./gists-app.js');
angular.module('gisty').controller('GistsCtrl', function($scope, $http, $log, token) {

$scope.pagination = {
currentPage: 1,
currentPage: 0,
perPage: 4,
getOffset: function () {
return $scope.pagination.currentPage * $scope.pagination.perPage;
Expand Down
1 change: 0 additions & 1 deletion src/js/gists-filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ angular.module('gisty').filter('offset', function ($filter) {
angular.module('gisty').filter('pager', function ($filter) {
return function(results, pagerObj) {
var filteredResults;
console.log(pagerObj);
filteredResults = $filter('offset')(results, pagerObj.getOffset());
filteredResults = $filter('limitTo')(filteredResults, pagerObj.perPage);
return filteredResults;
Expand Down

0 comments on commit 8c6ed1a

Please sign in to comment.