dashboard: slightly better admin notes edit handling

This commit is contained in:
Johannes Zellner
2024-06-13 15:48:35 +02:00
parent c3f9d688f1
commit d688f5e080
3 changed files with 10 additions and 9 deletions
+4 -4
View File
@@ -795,15 +795,15 @@
<br/>
<p><label class="control-label">{{ 'app.info.notes.title' | tr }}</label></p>
<p><label class="control-label">{{ 'app.info.notes.title' | tr }}</label><i ng-show="!info.notes.editing" class="info-edit-indicator fa fa-pencil-alt" ng-click="info.notes.edit()"></i></p>
<div class="row">
<div class="col-md-12">
<div ng-show="!info.notes.editing">
<div ng-bind-html="info.notes.content | markdown2html"></div>
<i class="info-edit-indicator fa fa-pencil-alt" ng-click="info.notes.edit()"></i>
<div ng-show="info.notes.content" ng-bind-html="info.notes.content | markdown2html"></div>
<div ng-hide="info.notes.content && !info.notes.busy" class="text-muted hand" ng-click="info.notes.edit()">{{ info.notes.placeholder }}</div>
</div>
<div ng-show="info.notes.editing" class="text-right">
<textarea ng-trim="false" style="white-space: pre-wrap; margin-bottom: 5px" ng-model="info.notes.content" class="form-control" rows="10"></textarea>
<textarea id="adminNotesTextarea" ng-trim="false" style="white-space: pre-wrap; margin-bottom: 5px" ng-model="info.notes.content" class="form-control" rows="10"></textarea>
<button class="btn btn-default" ng-click="info.notes.dismiss()" ng-disabled="info.notes.busy">{{ 'main.dialog.cancel' | tr }}</button>
<button class="btn btn-success" ng-click="info.notes.submit()" ng-disabled="info.notes.busy"><i class="fa fa-circle-notch fa-spin" ng-show="info.notes.busy"></i> {{ 'app.display.saveAction' | tr }}</button>
</div>
+5 -2
View File
@@ -141,14 +141,17 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
hasOldChecklist: false,
notes: {
busy: false,
busy: true,
editing: false,
content: '',
placeholder: 'Add admin notes here...',
edit: function () {
$scope.info.notes.busy = false;
$scope.info.notes.content = $scope.app.notes;
$scope.info.notes.editing = true;
setTimeout(function () { document.getElementById('adminNotesTextarea').focus(); }, 1);
},
dismiss: function () {
@@ -166,8 +169,8 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
refreshApp($scope.app.id, function (error) {
if (error) return Client.error(error);
$scope.info.notes.busy = false;
$scope.info.notes.editing = false;
$scope.info.notes.busy = false;
});
});
}