Skip to content

Commit

Permalink
collapsible feeds
Browse files Browse the repository at this point in the history
  • Loading branch information
siddii committed Feb 19, 2014
1 parent 083e4c6 commit 772e7ff
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
5 changes: 3 additions & 2 deletions app/my-feeds.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ <h3><i ng-show="isOrigin()" class="fa fa-rss"></i> My Feeds</h3>
</div>

<div id="my-feeds" class="row">
<div ng-repeat="feed in feeds" class="col-sm-4">
<div ng-controller="FeedWidgetController" ng-repeat="feed in feeds" class="col-sm-4">
<div class="panel panel-default">
<div class="panel-heading">
<div ng-include src="'templates/feed-widget-control.html'"></div>
<h3 class="panel-title">{{feed.title}}</h3>
</div>
<div class="panel-body feed-body">
<div ng-if="!collapsed" class="panel-body feed-body">
<div class="feed-block" feed-widget>
</div>
</div>
Expand Down
8 changes: 7 additions & 1 deletion app/scripts/my-feeds.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
angular.module('angular-my-feeds', [
'feeds'
]).controller('MyFeedsController', ['$scope', '$compile', '$http', '$rootScope', function ($scope, $compile, $http, $rootScope) {
])
.controller('MyFeedsController', ['$scope', '$compile', '$http', '$rootScope', function ($scope, $compile, $http, $rootScope) {
$scope.isOrigin = function () {
var url = window.location.href.substring(window.location.href.lastIndexOf('/') + 1);
return window.parent.location.href.indexOf(url) !== -1;
Expand All @@ -19,6 +20,11 @@ angular.module('angular-my-feeds', [
$element.append($compile(feedHTML)($scope));
}]
};
}])
.controller('FeedWidgetController', ['$scope', function ($scope) {
$scope.toggleFeed = function () {
$scope.collapsed = !$scope.collapsed;
};
}]);

function feedPostRender(element) {
Expand Down
8 changes: 8 additions & 0 deletions app/styles/my-feeds.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@ body {
hr {
margin-bottom: 10px;
margin-top: 10px;
}

.fa-chevron-circle-down {
cursor: pointer;
}

.fa-chevron-circle-up {
cursor: pointer;
}
File renamed without changes.
3 changes: 3 additions & 0 deletions app/templates/feed-widget-control.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="pull-right feed-control">
<i ng-click="toggleFeed();" class="fa {{!collapsed ? 'fa-chevron-circle-down' : 'fa-chevron-circle-up'}}"></i>
</div>
6 changes: 3 additions & 3 deletions app/templates/main-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h3>Examples</h3>
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
<div ng-include src="'templates/feed-control.html'"></div>
<div ng-include src="'templates/feed-code-toggle.html'"></div>
<h3 class="panel-title">Stack Overflow <i>AngularJS</i> Questions</h3>
</div>
<div class="panel-body">
Expand All @@ -42,7 +42,7 @@ <h3 class="panel-title">Stack Overflow <i>AngularJS</i> Questions</h3>
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
<div ng-include src="'templates/feed-control.html'"></div>
<div ng-include src="'templates/feed-code-toggle.html'"></div>
<h3 class="panel-title">Wikipedia Featured Articles</h3>
</div>
<div class="panel-body">
Expand Down Expand Up @@ -73,7 +73,7 @@ <h3 class="panel-title">Wikipedia Featured Articles</h3>
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
<div ng-include src="'templates/feed-control.html'"></div>
<div ng-include src="'templates/feed-code-toggle.html'"></div>
<h3 class="panel-title">Reddit (<i>/r/programming</i>)</h3>
</div>
<div class="panel-body">
Expand Down

0 comments on commit 772e7ff

Please sign in to comment.