Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Commit

Permalink
Merge pull request #537 from thevoiceofzeke/benefits-type
Browse files Browse the repository at this point in the history
fix: Fix typo and prevent partial content from showing
  • Loading branch information
thevoiceofzeke committed Sep 22, 2017
2 parents 5345a62 + ccb9810 commit 853af81
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 9 additions & 2 deletions components/portal/widgets/controllers.js
Expand Up @@ -459,14 +459,21 @@ define(['angular'], function(angular) {
// the active period hasn't started yet
} else if ($filter('filterDifferenceFromDate')(
$scope.activePeriodStartDate) > 0) {
$scope.templateStature = 'upcoming';
$scope.templateStatus = 'upcoming';
// If filter returns -1, the period has ended
} else if ($filter('filterDifferenceFromDate')(
$scope.activePeriodEndDate) === -1) {
$scope.templateStatus = 'ended';
}

$scope.showTimeSensitiveContent = true;
// If we somehow ended up with an unset template status,
// don't show time sensitive content
if ($scope.templateStatus === '') {
$log.log('Date range didn\'t meet any of the criteria for '
+ 'showing time-sensitive content');
} else {
$scope.showTimeSensitiveContent = true;
}
};

var evaluateCallsToAction = function(callsToAction) {
Expand Down
4 changes: 4 additions & 0 deletions components/portal/widgets/partials/type__time-sensitive.html
Expand Up @@ -22,14 +22,17 @@
<div class="widget-body" ng-if="showTimeSensitiveContent" layout="column" layout-align="center center">
<span class="tsc__title">{{ callToAction.actionName }}</span>
<div ng-switch="templateStatus" class="tsc__status">
<!-- Take action period upcoming -->
<p ng-switch-when="upcoming">Begins {{ activePeriodStartDate | date:mediumDate }}</p>
<!-- Take action period ongoing -->
<div ng-switch-when="ongoing" layout="column" layout-align="center center">
<p>
<span class="tsc__days-left">{{ daysLeft }}</span> day<span ng-if="daysLeft > 1">s</span> left
<span ng-if="callToAction.daysLeftMessage"> {{ callToAction.daysLeftMessage }}</span>
</p>
<p><md-button class="md-raised md-accent" ng-href="{{ callToAction.actionButton.url }}">{{ callToAction.actionButton.label }}</md-button></p>
</div>
<!-- Last day to take action -->
<div ng-switch-when="lastDay" layout="column" layout-align="center center">
<p ng-if="callToAction.lastDayMessage"><span class="tsc__last-day"><md-icon class="md-warn" aria-label="warning:">warning</md-icon> {{ callToAction.lastDayMessage }}</span></p>
<p ng-if="!callToAction.lastDayMessage">
Expand All @@ -38,6 +41,7 @@
</p>
<p><md-button class="md-raised md-accent" ng-href="{{ callToAction.actionButton.url }}">{{ callToAction.actionButton.label }}</md-button></p>
</div>
<!-- Take action period ended -->
<p ng-switch-when="ended">Ended {{ activePeriodEndDate | date:mediumDate }}</p>
</div>
<!-- Learn more link -->
Expand Down

0 comments on commit 853af81

Please sign in to comment.