More features

This commit is contained in:
Dobie Wollert
2015-02-02 00:31:11 -08:00
parent 6f2cc70181
commit 0ca77dd9b6
6 changed files with 144 additions and 498 deletions

View File

@ -12,8 +12,6 @@
<a href="http://atlanticbiomedical.com:8001/unsafe/{{image}}"><img ng-src="http://atlanticbiomedical.com:8001/unsafe/200x200/smart/{{image}}"></a>
</li>
</ul>
<div class="fb-comments" data-href="http://atlanticbiomedical.com/posts/{{post._id}}" data-numposts="5" data-colorscheme="light"></div>
</div>
<script>
$(document).foundation();
</script>
</div>

View File

@ -29,6 +29,7 @@ angular.module('biomed-frontend', [
var deferred = false;
var more = true;
var filter = undefined;
var loadNextPage = function() {
if (more && (!deferred || deferred.$resolved)) {
@ -39,6 +40,10 @@ angular.module('biomed-frontend', [
'skip': $scope.posts.length
};
if ($scope.filter) {
query['tags'] = $scope.filter;
}
deferred = Posts.query(query, function(posts) {
more = posts.length > 0;
@ -60,6 +65,18 @@ angular.module('biomed-frontend', [
$scope.addMoreItems = function() {
loadNextPage();
}
$scope.filterByTag = function(tag) {
$scope.filter = tag;
$scope.posts = [];
loadNextPage();
}
$scope.resetFilter = function() {
$scope.filter = undefined;
$scope.posts = [];
loadNextPage();
}
}
})
.state('site.details', {

View File

@ -1,15 +1,25 @@
<div class="filter-header" ng-show="filter" ng-click="resetFilter()">
<span class="fa fa-arrow-left"></span>
#{{filter}}
</div>
<div class="masonry-container" masonry preserve-order masonry-options="{isFitWidth: true}" infinite-scroll="addMoreItems()" infinite-scroll-distance="2">
<div ng-repeat="post in posts" class="masonry-brick">
<div class="box col3">
<div class="thumbnail">
<img class="img-rounded" ng-show="post.image" ng-src="http://atlanticbiomedical.com:8001/unsafe/280x0/{{post.image}}">
<div class="caption text-center">
<div class="col3">
<div class="post">
<div class="tags">
<div ng-repeat="tag in post.tags" class="tag">
<span class="border">&nbsp;</span>
<a ng-click="filterByTag(tag)">#{{tag}}</a>
</div>
</div>
<img ng-show="post.image" ng-src="http://atlanticbiomedical.com:8001/unsafe/280x0/{{post.image}}">
<div class="post-content">
<h3>{{post.title}}</h3>
<p ng-if="!post.previewHtml" ng-bind="post.preview"></p>
<div ng-if="post.previewHtml" ng-bind-html="post.previewHtml"></div>
<p>
<div class="caption">
<p ng-if="!post.previewHtml" ng-bind="post.preview"></p>
<div ng-if="post.previewHtml" ng-bind-html="post.previewHtml"></div>
<a ui-sref="site.details(post)" ng-show="showMore(post)" class="btn btn-default" role="button">Read More</a>
</p>
</div>
</div>
</div>
</div>