diff --git a/app/assets/javascripts/ror/institution-typeahead.js b/app/assets/javascripts/ror/institution-typeahead.js
index 6ddb6b17eb..b4f4209847 100644
--- a/app/assets/javascripts/ror/institution-typeahead.js
+++ b/app/assets/javascripts/ror/institution-typeahead.js
@@ -1,17 +1,12 @@
var ROR_API_URL = "https://api.ror.org/organizations";
function extractRorId(rorUrl) {
- // Define the regular expression to match the ROR ID
const regex = /https:\/\/ror\.org\/([^\/]+)/;
-
- // Try to match the URL with the regex
const match = rorUrl.match(regex);
-
- // If a match is found, return the extracted ROR ID
if (match) {
- return match[1]; // Return the captured ID
+ return match[1];
} else {
- return null; // Return null if no match is found
+ return null;
}
}
@@ -68,7 +63,7 @@ $j(document).ready(function() {
templates: {
pending: [
'
',
- 'Fetching organizations list',
+ 'Fetching list ...',
'
'
].join('\n'),
suggestion: function (data) {
diff --git a/app/views/institutions/_form.html.erb b/app/views/institutions/_form.html.erb
index fb1524fe47..b982b0fd74 100644
--- a/app/views/institutions/_form.html.erb
+++ b/app/views/institutions/_form.html.erb
@@ -1,36 +1,13 @@
<%= f.error_messages -%>
-
-
- <%= f.label :title, 'Name', class: 'required' -%>
- <%= f.text_field :title, :class=>"form-control" -%>
+
+
+ <%= render partial: 'institution_fields', locals: {f:f, institution:institution} %>
+
-
- <%= f.label :ror_id, 'ROR ID' -%>
- <%= f.text_field :ror_id, :class=>"form-control" -%>
-
- The ROR ID (Research Organization Registry Identifier) is a unique 9-character alphanumeric code (e.g., 01f7bcy98).
- Please do not include the prefix (e.g., https://ror.org/).
-
-
+<%= render :partial=> "assets/discussion_links_form", :locals=>{:resource => @institution} -%>
-
- <%= f.label :web_page -%>
- <%= f.text_field :web_page, :class=>"form-control" -%>
-
-
-
- <%= f.label :address -%>
- <%= f.text_area :address, :rows => 5, :class=>"form-control" -%>
-
-
-
- <%= f.label :city -%>
- <%= f.text_field :city, :class=>"form-control" -%>
-
-
-
- <%= f.label :country -%>
- <%= f.country_select :country, { include_blank: 'Please select...' }, class: 'form-control' -%>
-
+<%= f.submit(institution ? "Update" : "Create",data: { disable_with: (institution ? "Updating..." : "Creating...") },
+ :class => 'btn btn-primary') -%> or
+<%= cancel_button(institution ? institution_path(institution.id) : institutions_path) -%>
diff --git a/app/views/institutions/_tab_query_name.html.erb b/app/views/institutions/_institution_fields.html.erb
similarity index 100%
rename from app/views/institutions/_tab_query_name.html.erb
rename to app/views/institutions/_institution_fields.html.erb
diff --git a/app/views/institutions/_multi_tabs.erb b/app/views/institutions/_multi_tabs.erb
deleted file mode 100644
index 08acf2d49d..0000000000
--- a/app/views/institutions/_multi_tabs.erb
+++ /dev/null
@@ -1,40 +0,0 @@
-<%= f.error_messages -%>
-
-
-
-
-
- <%= render partial: 'tab_query_name', locals: {f:f, institution:nil} %>
-
-
-
-
-
-
-
-
- <%#= render partial: "form", locals: {f:f, institution:nil } %>
-
-
-
-
-<%= render :partial=> "assets/discussion_links_form", :locals=>{:resource => @institution} -%>
-
-<%= f.submit("Create", data: { disable_with: ("Creating...") }, class: 'btn btn-primary') %> or
-<%= cancel_button(institutions_path) %>
\ No newline at end of file
diff --git a/app/views/institutions/edit.html.erb b/app/views/institutions/edit.html.erb
index 55d9dd88c6..f094fd17e2 100644
--- a/app/views/institutions/edit.html.erb
+++ b/app/views/institutions/edit.html.erb
@@ -2,9 +2,6 @@
<%= form_for(@institution) do |f| %>
- <%= render :partial => "form", :locals => { :f => f, :institution => @institution } -%>
- <%= render :partial=> "assets/discussion_links_form", :locals=>{:resource => @institution} -%>
- <%= f.submit("Update", data: { disable_with: ("Updating...") }, class: 'btn btn-primary') %> or
- <%= cancel_button(institutions_path) %>
+ <%= render partial: "form", locals: { f:f, institution:@institution } -%>
<% end %>
diff --git a/app/views/institutions/new.html.erb b/app/views/institutions/new.html.erb
index 0d4d8dd2ac..b459990bce 100644
--- a/app/views/institutions/new.html.erb
+++ b/app/views/institutions/new.html.erb
@@ -4,6 +4,6 @@
<%= form_for(@institution) do |f| %>
- <%= render partial: 'multi_tabs', locals: {f:f, institution:nil } %>
+ <%= render partial: 'form', locals: { f:f, institution:nil } %>
<% end %>