Skip to content

Commit

Permalink
Fixes #10140: allow sync plans start date to be editable, BZ 1177901.
Browse files Browse the repository at this point in the history
  • Loading branch information
Walden Raines committed Apr 14, 2015
1 parent 82177c6 commit 0745b1b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
Expand Up @@ -38,12 +38,24 @@ angular.module('Bastion.sync-plans').controller('SyncPlanDetailsInfoController',
$scope.menuExpander = MenuExpander;
$scope.panel = $scope.panel || {loading: false};

$scope.syncPlan = $scope.syncPlan || SyncPlan.get({id: $scope.$stateParams.syncPlanId}, function () {
SyncPlan.get({id: $scope.$stateParams.syncPlanId}, function (syncPlan) {
$scope.panel.loading = false;


syncPlan.syncDate = syncPlan.syncTime = syncPlan['sync_date'];
$scope.syncPlan = syncPlan;
});

$scope.save = function (syncPlan) {
var deferred = $q.defer();
var deferred = $q.defer(),
syncDate = new Date(syncPlan.syncDate),
syncTime = new Date(syncPlan.syncTime || new Date());

syncDate.setHours(syncTime.getHours());
syncDate.setMinutes(syncTime.getMinutes());
syncDate.setSeconds(0);
syncPlan['sync_date'] = syncDate.toString();

syncPlan.$update(function (response) {
deferred.resolve(response);
$scope.successMessages.push(translate('Sync Plan Saved'));
Expand Down
Expand Up @@ -26,7 +26,20 @@ <h4 translate>Basic Information</h4>

<div class="detail">
<span class="info-label" translate>Start Date</span>
<span class="info-value">{{ syncPlan.sync_date | date:'medium' }}</span>
<span class="info-value"
bst-edit-custom="syncPlan.sync_date"
formatter="date"
formatter-options="'medium'"
on-save="save(syncPlan)"
readonly="denied('edit_sync_plans', syncPlan)">

<input type="text" datepicker-popup id="syncDate" name="syncDate" ng-model="syncPlan.syncDate"
show-weeks="false" tabindex="4" required/>

<timepicker type="time" show-meridian="false" id="syncTime" name="syncTime" ng-model="syncPlan.syncTime"
tabindex="5">
</timepicker>
</span>
</div>

<div class="detail">
Expand Down

0 comments on commit 0745b1b

Please sign in to comment.