Fix save indicator for description (fixes #354)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -733,7 +733,14 @@ input.input-inline {
|
||||
}
|
||||
}
|
||||
|
||||
#card-description {
|
||||
.card-description {
|
||||
&.section-header {
|
||||
.save-indicator {
|
||||
margin-bottom: 5px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
}
|
||||
&.section-content {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -755,6 +762,7 @@ input.input-inline {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#card-attachments {
|
||||
ul {
|
||||
|
||||
@@ -62,24 +62,25 @@ app.controller('CardController', function ($scope, $rootScope, $routeParams, $lo
|
||||
};
|
||||
$scope.cardEditDescriptionChanged = function ($event) {
|
||||
$scope.status.lastEdit = Date.now();
|
||||
$('#card-description').find('.save-indicator.unsaved').show();
|
||||
$('#card-description').find('.save-indicator.saved').hide();
|
||||
var header = $('.section-header.card-description');
|
||||
header.find('.save-indicator.unsaved').show();
|
||||
header.find('.save-indicator.saved').hide();
|
||||
};
|
||||
|
||||
$interval(function() {
|
||||
$scope.cardEditDescriptionAutosave = function() {
|
||||
var currentTime = Date.now();
|
||||
var timeSinceEdit = currentTime-$scope.status.lastEdit;
|
||||
if (timeSinceEdit > 1000 && $scope.status.lastEdit > $scope.status.lastSave) {
|
||||
$scope.status.lastSave = currentTime;
|
||||
$('#card-description').find('.save-indicator.unsaved').fadeIn(500);
|
||||
var header = $('.section-content.card-description');
|
||||
header.find('.save-indicator.unsaved').fadeIn(500);
|
||||
CardService.update(CardService.getCurrent()).then(function (data) {
|
||||
$('#card-description').find('.save-indicator.unsaved').hide();
|
||||
$('#card-description').find('.save-indicator.saved').fadeIn(250).fadeOut(1000);
|
||||
header.find('.save-indicator.unsaved').hide();
|
||||
header.find('.save-indicator.saved').fadeIn(250).fadeOut(1000);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$interval( function(){ $scope.cardEditDescriptionAutosave(); }, 500);
|
||||
}, 500);
|
||||
|
||||
// handle rename to update information on the board as well
|
||||
$scope.cardRename = function (card) {
|
||||
@@ -91,8 +92,9 @@ app.controller('CardController', function ($scope, $rootScope, $routeParams, $lo
|
||||
$scope.cardUpdate = function (card) {
|
||||
CardService.update(CardService.getCurrent()).then(function (data) {
|
||||
$scope.status.cardEditDescription = false;
|
||||
$('#card-description').find('.save-indicator.unsaved').hide();
|
||||
$('#card-description').find('.save-indicator.saved').fadeIn(500).fadeOut(1000);
|
||||
var header = $('.section-content.card-description');
|
||||
header.find('.save-indicator.unsaved').hide();
|
||||
header.find('.save-indicator.saved').fadeIn(500).fadeOut(1000);
|
||||
});
|
||||
StackService.updateCard(card);
|
||||
};
|
||||
|
||||
@@ -84,17 +84,17 @@
|
||||
<button class="icon icon-delete button-inline" title="<?php p($l->t('Remove due date')); ?>" ng-if="cardservice.getCurrent().duedate" ng-click="resetDuedate()"><span class="hidden-visually"><?php p($l->t('Remove due date')); ?></span></button>
|
||||
</div>
|
||||
|
||||
<div class="section-header">
|
||||
<div class="section-header card-description">
|
||||
<h4>
|
||||
<div>
|
||||
<?php p($l->t('Description')); ?>
|
||||
<a href="https://github.com/nextcloud/deck/wiki/Markdown-Help" target="_blank" class="icon icon-help" title="<?php p($l->t('Formatting help')); ?>"><span class="hidden-visually"><?php p($l->t('Formatting help')); ?></span></a>
|
||||
</div>
|
||||
</h4>
|
||||
<span class="save-indicator saved"><?php p($l->t('Saved')); ?></span>
|
||||
<span class="save-indicator unsaved"><?php p($l->t('Unsaved changes')); ?></span>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="card-description">
|
||||
<div class="section-content card-description">
|
||||
<textarea elastic ng-if="status.cardEditDescription"
|
||||
placeholder="<?php p($l->t('Add a card description…')); ?>"
|
||||
ng-blur="cardUpdate(cardservice.getCurrent())"
|
||||
|
||||
Reference in New Issue
Block a user