Skip to content

Commit

Permalink
Merge pull request #287 from lewisl9029/feature-header-notifications-…
Browse files Browse the repository at this point in the history
…badge

Feature header notifications badge. Closes #242
  • Loading branch information
lewisl9029 committed Sep 5, 2015
2 parents f3e13fe + f7df6ab commit 169b094
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
15 changes: 14 additions & 1 deletion app/app-controller.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
export let controllerName = 'AppController';
export default /*@ngInject*/ function AppController(
$ionicPopover
$scope,
$ionicPopover,
state,
R
) {
let notificationsCursor = state.cloud.notifications;
let updateNotificationCount = () => {
this.notificationCount = R.pipe(
R.values,
R.reject(R.prop('dismissed'))
)(notificationsCursor.get()).length;
};

state.addListener(notificationsCursor, updateNotificationCount, $scope);

this.optionsMenuPopover = $ionicPopover.fromTemplate(
`
<ion-popover-view>
Expand Down
6 changes: 5 additions & 1 deletion app/app-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
</ion-nav-back-button>
<ion-nav-buttons side="left">
<button menu-toggle="left"
class="button button-icon button-clear ion-ios-chatboxes-outline">
class="button button-icon button-clear ion-ios-chatbubble-outline">
<span class="toc-notification-badge"
ng-if="appView.notificationCount !== 0">
{{appView.notificationCount}}
</span>
</button>
</ion-nav-buttons>
<ion-nav-buttons side="right">
Expand Down
11 changes: 11 additions & 0 deletions app/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ $bar-subheader-height: 75px !default;
@import 'views/views';
@import 'components/components';

.toc-notification-badge {
margin-right: 0 !important;
position: absolute;
bottom: 0px;
left: 0px;
width: 100%;
text-align: center;
color: $light;
font-size: 12px;
};

form.ng-pristine button[type='submit'] {
opacity: 1;
}
Expand Down

0 comments on commit 169b094

Please sign in to comment.