Skip to content

Commit

Permalink
disable the input fields when insitution is selected from locally sav…
Browse files Browse the repository at this point in the history
…ed ones or remotely ROR
  • Loading branch information
whomingbird committed Jan 23, 2025
1 parent ba5f0ed commit 60bbdb5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/assets/javascripts/ror/institution-typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,12 @@ $j(document).ready(function () {
$j('#combined_typeahead .typeahead').typeahead('close');

if (data.hasOwnProperty("text")) {
$j('#new_institution_reminder').hide();
$j('#institution_title').val(data.text);
$j('#institution_id').val(data.id);
$j('#institution_ror_id').val(data.ror_id);
$j('#institution_city').val(data.city);
$j('#institution_country').val(data.country_name);
$j('#institution_web_page').val(data.web_page);
toggleUserInput(true);
}
else
{
Expand All @@ -230,9 +228,10 @@ $j(document).ready(function () {
$j('#institution_country').val(data.country.country_name);
$j('#institution_ror_id').val(extractRorId(data.id));
$j('#institution_web_page').val(data.links[0]);
toggleUserInput(false);
}
toggleUserInput(true);
checkSubmitButtonEnabled()
$j('.tt-input').addClass('tt-input-disable');
});

$j('#ror_query_name .typeahead').bind('typeahead:select', function (ev, suggestion) {
Expand All @@ -247,6 +246,8 @@ $j(document).ready(function () {
event.preventDefault();
clearInstitutionFields();
toggleUserInput(false);
$j('#new_institution_reminder').hide();
$j('.tt-input').removeClass('tt-input-disable');
});

$j('#basic #name-01').bind('change', function() {
Expand Down
4 changes: 4 additions & 0 deletions app/assets/stylesheets/ror/ror-widget.css
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ h3 {
color: #999
}

.tt-input-disable {
background-color: #EEEEEE !important;
}

.tt-dataset{
padding-left: 5px;
}
Expand Down

0 comments on commit 60bbdb5

Please sign in to comment.