Skip to content

Commit

Permalink
feat(badge): refresh own badge click
Browse files Browse the repository at this point in the history
Add click event to refresh badge and instantly refresh data on click

#258
  • Loading branch information
mpfeil committed Feb 15, 2018
1 parent f742412 commit 4742a4f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/components/badge.directive.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<div class="badge-container pull-right" style="display: inline;"><span><kbd><kbd>{{'BADGE_PLACEHOLDER_PREFIX'|translate}} {{badge.secs}} {{'BADGE_PLACEHOLDER_SUFFIX'|translate}}</kbd></kbd></span></div>
<div class="badge-container pull-right" style="display: inline;"><span ng-click="badge.refresh()"><kbd><kbd>{{'BADGE_PLACEHOLDER_PREFIX'|translate}} {{badge.secs}} {{'BADGE_PLACEHOLDER_SUFFIX'|translate}}</kbd></kbd></span></div>
11 changes: 10 additions & 1 deletion app/components/badge.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
vm.$onInit = onInit;
vm.$onDestroy = onDestroy;

vm.refresh = refresh;

////

function onInit () {
Expand Down Expand Up @@ -75,11 +77,18 @@
vm.timerStarted = false;
}

function refresh () {
$timeout.cancel(vm.prom);
resetTimer();
var eventName = 'osemBadgeRefreshFinished';
$scope.$emit(eventName, {});
}

////

$scope.$on('osemBadgeRefreshStartTimer', function () {
vm.timerStarted = true;
tick();
});
}
})();
})();

0 comments on commit 4742a4f

Please sign in to comment.