From 769accaae62c68b69a7db035d4b67d2016e3209a Mon Sep 17 00:00:00 2001 From: Stuart Owen Date: Fri, 10 Nov 2023 14:41:49 +0000 Subject: [PATCH] allow new terms to be added after populating a CV from OLS #1653 --- .../javascripts/controlled_vocabs.js.erb | 19 ------------------- .../sample_controlled_vocabs/_form.html.erb | 6 +----- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/app/assets/javascripts/controlled_vocabs.js.erb b/app/assets/javascripts/controlled_vocabs.js.erb index b7602b8b0c..6c7022a232 100644 --- a/app/assets/javascripts/controlled_vocabs.js.erb +++ b/app/assets/javascripts/controlled_vocabs.js.erb @@ -135,23 +135,6 @@ CVTerms = { } }); }, - disableAddTermButton: function(reason) { - $j('a#add-term').attr('disabled', true); - if (!$j('a#add-term').parent().is('span')) { - let span = $j('a#add-term').wrap('').parent(); - $j(span).attr('data-tooltip', reason); - bindTooltips('div#controlled-vocab-terms'); - $j(span).click(function () { - alert(reason); - }); - } - }, - enableAddTermButton: function() { - let button = $j('a#add-term'); - button.attr('disabled',false); - button.removeClass('disabled'); - button.unwrap('span'); - }, // sets up and trigger the ajax call to fetch the terms list fetchTermsAJAX: function () { $j('div#controlled-vocab-terms').hide(); @@ -209,10 +192,8 @@ CVTerms = { if (selected.value == "") { $j('#sample_controlled_vocab_ols_root_term_uri').val(''); $j('#ontology-root-uri').hide(); - CVTerms.enableAddTermButton(); } else { $j('#ontology-root-uri').show(); - CVTerms.disableAddTermButton('<%= I18n.t('controlled_vocabs.add_new_term_disabled_reason') %>'); var link = $j('a#selected-ols-link'); link.text(selected.text); link.attr('href', '<%= Ebi::OlsClient::ROOT_URL %>/ontologies/' + selected.value); diff --git a/app/views/sample_controlled_vocabs/_form.html.erb b/app/views/sample_controlled_vocabs/_form.html.erb index 76f5f920af..b23ce0143e 100644 --- a/app/views/sample_controlled_vocabs/_form.html.erb +++ b/app/views/sample_controlled_vocabs/_form.html.erb @@ -103,11 +103,7 @@
- <% - options = {id: 'add-term'} - options.merge!({disabled:true, disabled_reason:t('controlled_vocabs.add_new_term_disabled_reason')}) if @sample_controlled_vocab.ontology_based? - %> - <%= button_link_to('Add new term', 'add', '#', options) %> + <%= button_link_to('Add new term', 'add', '#', id: 'add-term') %> <%= button_link_to('Remove all terms', 'destroy', '#', :id => 'clear-terms', class:'btn btn-danger') %>