Skip to content

Commit

Permalink
Add a "Clear" button in the allele edit dialog
Browse files Browse the repository at this point in the history
Refs #2758
  • Loading branch information
kimrutherford committed Feb 28, 2024
1 parent d34f141 commit a21cf4c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
9 changes: 9 additions & 0 deletions root/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,15 @@ input[readonly="1"] {
padding-bottom: 0.25em;
}

.curs-allele-edit .modal-footer {
text-align: unset;
display: flex;
}

.curs-allele-edit .modal-footer .curs-allele-edit-cancel {
margin-left: auto;
}

.curs-allele-evidence-select {
width: 22em;
}
Expand Down
11 changes: 11 additions & 0 deletions root/static/js/canto-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -4162,6 +4162,7 @@ var alleleEditDialogCtrl =
newSynonymsString: '',
};

$scope.databaseName = CantoGlobals.database_name;
$scope.userIsAdmin = CantoGlobals.current_user_is_admin;
$scope.pathogenHostMode = CantoGlobals.pathogen_host_mode;
$scope.allele_qc_api_url = CantoGlobals.allele_qc_api_url;
Expand Down Expand Up @@ -4258,6 +4259,16 @@ var alleleEditDialogCtrl =
processSynonyms();
};

$scope.clearExisting = function() {
$scope.alleleData.external_uniquename = undefined;
$scope.alleleData.existingSynonyms = [];
$scope.alleleData.newSynonyms = [];
$scope.alleleData.description = undefined;
$scope.alleleData.type = undefined;
$scope.alleleData.name = '';
$scope.alleleData.display_name = undefined;
};

$scope.descriptionChanged = function() {
$scope.descriptionNeedsChecking = false;
$scope.descriptionState = 'unset';
Expand Down
7 changes: 6 additions & 1 deletion root/static/ng_templates/allele_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,12 @@ <h4 class="modal-title">
</div>

<div class="modal-footer">
<button class="btn btn-warning" ng-click="cancel()"
<button class="btn btn-secondary curs-allele-edit-clear-name" ng-click="clearExisting()"
ng-if="!!alleleData.external_uniquename"
title="Clear dialog to enter new details or to find a different allele from the {{databaseName}} database">Clear</button>

<button class="btn btn-warning curs-allele-edit-cancel" ng-click="cancel()"
title="Discard changes and close this dialog"
ng-disabled="okInProgress">Cancel</button>
<button class="btn btn-primary" ng-click="ok()" ng-alt-enter="ok()"
title="{{okTitle()}}"
Expand Down

0 comments on commit a21cf4c

Please sign in to comment.