Added pages support

This commit is contained in:
Dobie Wollert
2015-03-19 08:13:10 -07:00
parent 0ca77dd9b6
commit a7d28727ed
3 changed files with 15 additions and 5 deletions

View File

@ -22,11 +22,19 @@ angular.module('biomed-frontend', [
templateUrl: 'app/layout.html'
})
.state('site.list', {
url: '/',
url: '/?page',
templateUrl: 'app/list.html',
controller: function($scope, $timeout, $sce, $location, $anchorScroll, Posts) {
controller: function($scope, $timeout, $sce, $location, $anchorScroll, $stateParams, Posts) {
$scope.posts = [];
var page = $stateParams.page;
if (!page) {
page = 'front';
}
console.log($stateParams);
var deferred = false;
var more = true;
var filter = undefined;
@ -34,6 +42,7 @@ angular.module('biomed-frontend', [
var loadNextPage = function() {
if (more && (!deferred || deferred.$resolved)) {
var query = {
'pages': page,
'status': 'posted',
'sort': '-postedOn',
'limit': 10,

View File

@ -4,7 +4,7 @@
<ul class="title-area">
<!-- Title Area -->
<li class="name">
<a href="/"><h1 class="logo"></h1></a>
<a ui-sref="site.list({page:'front'})"><h1 class="logo"></h1></a>
</li>
<li class="toggle-topbar menu-icon">
<a href="#">
@ -25,7 +25,7 @@
</li>
<li class="divider"></li>
<li>
<a href="http://v1.atlanticbiomedical.com/sales.php">Sales</a>
<a ui-sref="site.list({page: 'sales'})">Sales</a>
</li>
<li class="divider"></li>
<li>

View File

@ -25,7 +25,8 @@ var Post = new Schema({
{ type: String }
],
status: { type: String },
tags: [{ type: String }]
tags: [{ type: String }],
pages: [{ type: String }]
});
var PostModel = mongoose.model('Post', Post);