Skip to content

Commit

Permalink
Fix code for removing modification residues
Browse files Browse the repository at this point in the history
When the gene is changed in the annotation edit dialog

Refs #2803
  • Loading branch information
kimrutherford committed Mar 14, 2024
1 parent 494c7f1 commit 7103165
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions root/static/js/canto-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"use strict";

/*global history,curs_root_uri,angular,$,make_ontology_complete_url,
ferret_choose,application_root,window,curs_key,
ferret_choose,application_root,window,curs_key,removeIf,
app_static_path,loadingStart,loadingEnd,alert,trim,read_only_curs */

var canto = angular.module('cantoApp', ['ui.bootstrap', 'angular-confirm', 'toaster',
Expand Down Expand Up @@ -8618,9 +8618,8 @@ var annotationEditDialogCtrl =
prevFeatureId !== featureId) {
$.map($scope.annotation.extension,
(orPart) => {
orPart.removeIf((ext) => {
if ($.grep(annotationType.clear_extensions_on_feature_change,
(rel) => rel == ext.relation)) {
removeIf(orPart, (ext) => {
if (annotationType.clear_extensions_on_feature_change.includes(ext.relation)) {
toaster.pop({
type: 'warning',
title: 'The ' + ext.relation + '(' + ext.rangeValue +
Expand Down
10 changes: 5 additions & 5 deletions root/static/js/canto.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ function trim(a) {
a=a.replace(/^\s+/,''); return a.replace(/\s+$/,'');
}

Array.prototype.removeIf = function(callback) {
var i = this.length;
function removeIf(arr, callback) {
var i = arr.length;
while (i--) {
if (callback(this[i], i)) {
this.splice(i, 1);
if (callback(arr[i], i)) {
arr.splice(i, 1);
}
}
};
}

var loadingDiv = $('<div id="loading" style="z-index: 2000;"><img src="' + application_root +
'/static/images/spinner.gif"/></div>');
Expand Down

0 comments on commit 7103165

Please sign in to comment.