<ul class="pull-right" uib-dropdown-menu>
<li>
<a href
- ng-click="toggle_opt('sticky_date')">
- <span ng-if="date_options.sticky_date"
+ ng-click="toggle_opt('has_sticky_date')">
+ <span ng-if="date_options.has_sticky_date"
class="label label-success">✓</span>
- <span ng-if="!date_options.sticky_date"
+ <span ng-if="!date_options.has_sticky_date"
class="label label-warning">✗</span>
<span>[% l('Specific Due Date') %]</span>
</a>
</li>
<li>
<a href
- ng-click="toggle_opt('until_logout')">
- <span ng-if="date_options.until_logout"
+ ng-click="toggle_opt('is_until_logout')">
+ <span ng-if="date_options.is_until_logout"
class="label label-success">✓</span>
- <span ng-if="!date_options.until_logout"
+ <span ng-if="!date_options.is_until_logout"
class="label label-warning">✗</span>
<span>[% l('Use Specific Due Date Until Logout') %]</span>
</a>
$scope.date_options = {
due_date : egCore.hatch.getSessionItem('eg.circ.checkout.due_date'),
- sticky_date : egCore.hatch.getSessionItem('eg.circ.checkout.until_logout'),
- until_logout : egCore.hatch.getSessionItem('eg.circ.checkout.until_logout')
- }
+ has_sticky_date : egCore.hatch.getSessionItem('eg.circ.checkout.is_until_logout'),
+ is_until_logout : egCore.hatch.getSessionItem('eg.circ.checkout.is_until_logout')
+ };
- if ($scope.date_options.until_logout) { // If until_logout is set there should also be a date set.
+ if ($scope.date_options.is_until_logout) { // If until_logout is set there should also be a date set.
$scope.checkoutArgs.due_date = new Date($scope.date_options.due_date);
$scope.checkoutArgs.sticky_date = true;
}
} else {
$scope.date_options[opt] = true;
}
- }
+ };
// The interactions between these options are complicated enough that $watch'ing them all is the only safe way to keep things sane.
- $scope.$watch('date_options.sticky_date', function(newval) {
+ $scope.$watch('date_options.has_sticky_date', function(newval) {
if ( newval ) { // was false, is true
// $scope.date_options.due_date = checkoutArgs.due_date;
} else {
- $scope.date_options.until_logout = false;
+ $scope.date_options.is_until_logout = false;
}
$scope.checkoutArgs.sticky_date = newval;
});
- $scope.$watch('date_options.until_logout', function(newval) {
+ $scope.$watch('date_options.is_until_logout', function(newval) {
if ( newval ) { // was false, is true
- $scope.date_options.sticky_date = true;
+ $scope.date_options.has_sticky_date = true;
$scope.date_options.due_date = $scope.checkoutArgs.due_date;
- egCore.hatch.setSessionItem('eg.circ.checkout.until_logout', true);
+ egCore.hatch.setSessionItem('eg.circ.checkout.is_until_logout', true);
egCore.hatch.setSessionItem('eg.circ.checkout.due_date', $scope.checkoutArgs.due_date);
} else {
- egCore.hatch.removeSessionItem('eg.circ.checkout.until_logout');
+ egCore.hatch.removeSessionItem('eg.circ.checkout.is_until_logout');
egCore.hatch.removeSessionItem('eg.circ.checkout.due_date');
}
});
$scope.$watch('checkoutArgs.due_date', function(newval) {
- if ( $scope.date_options.until_logout ) {
+ if ( $scope.date_options.is_until_logout ) {
egCore.hatch.setSessionItem('eg.circ.checkout.due_date', newval);
}
});