diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index a90645f..922c179 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -36,7 +36,7 @@
<%= stylesheet_link_tag fingerprinted_asset('application') %>
<%= javascript_include_tag fingerprinted_asset('vendor') %>
<%= javascript_include_tag fingerprinted_asset('application') %>
- <%= render "layouts/es5_scripts" %>
+ <%#= render "layouts/es5_scripts" %>
<%= csrf_meta_tags %>
diff --git a/lib/assets/javascripts/application.js b/lib/assets/javascripts/application.js
index 89cf27c..24a51bb 100644
--- a/lib/assets/javascripts/application.js
+++ b/lib/assets/javascripts/application.js
@@ -8,8 +8,8 @@
import './views/devise/passwords/new';
import './views/devise/registrations/edit';
import './views/notes/index';
+import './views/orgs/admin_edit';
import './views/orgs/shibboleth_ds';
-
import './views/phases/edit';
import './views/phases/show';
import './views/plans/download';
@@ -17,14 +17,15 @@
import './views/plans/index';
import './views/plans/new';
import './views/plans/share';
-import './views/orgs/admin_edit';
-
+import './views/questions/index';
import './views/questions/new';
import './views/sections/index';
import './views/sections/new';
-import './views/questions/index';
-import './views/templates/show';
+import './views/shared/create_account_form';
+import './views/shared/sign_in_form';
import './views/templates/edit';
+import './views/templates/show';
+import './views/users/notification_preferences';
// Not sure if this file is the best place for this.
// All tables share the same class/id selectors so having it on one page makes it work everywhere
diff --git a/lib/assets/javascripts/views/home/index.js b/lib/assets/javascripts/views/home/index.js
deleted file mode 100644
index 7743d7c..0000000
--- a/lib/assets/javascripts/views/home/index.js
+++ /dev/null
@@ -1,32 +0,0 @@
-$(document).ready(function(){
- $(".tab-panels div.tab-panel:not(.active)").hide();
-
- $(".tabs li a").click(function(e){
- e.preventDefault();
-
- // Make the clicked tab the active tab
- $(this).parent().addClass('active');
- $(this).attr('aria-selected', 'true');
- $.each($(this).parent().siblings(), function(i, sib){
- $(sib).removeClass('active');
- $(sib).find('> a').attr('aria-selected', 'false');
- });
-
- // Make the corresponding panel visible and the others hidden
- var panel = $($(this).attr("href"));
- panel.show().attr("aria-hidden", 'false');
- $.each($(panel).siblings(), function(i, p){
- $(p).hide().attr("aria-hidden", 'true');
- });
- });
-
- // If the hidden valid-form field is set to true then enable the submit button
- $("#valid-form").change(function(){
- $(this).siblings(".form-submit").attr('aria-disabled', $(this).val() != "true");
- });
-
- $("#shibboleth-login").click(function(e){
- e.preventDefault();
- window.location.href = $(this).attr('href');
- });
-});
\ No newline at end of file
diff --git a/lib/assets/javascripts/views/plans/available_templates.js b/lib/assets/javascripts/views/plans/available_templates.js
deleted file mode 100644
index ccf719b..0000000
--- a/lib/assets/javascripts/views/plans/available_templates.js
+++ /dev/null
@@ -1,5 +0,0 @@
-$(document).ready(function(){
- $("#plan_template_selector").change(function(){
- $("#plan_template_id").val($(this).val()).change();
- });
-});
diff --git a/lib/assets/javascripts/views/plans/show.js b/lib/assets/javascripts/views/plans/show.js
deleted file mode 100644
index 9e6dcea..0000000
--- a/lib/assets/javascripts/views/plans/show.js
+++ /dev/null
@@ -1,73 +0,0 @@
-$(document).ready(function(){
- // Run the input validations when the focus changes
- $("input[type='email']").on('blur', function(){
- toggleFormElementError(this, validateEmail($(this).val().trim()));
- }).on('change keyup', function(){
- toggleProjectDetailsSubmit();
- });
-
- $("#plan_title").on('blur', function(){
- toggleFormElementError(this, ($(this).val().trim().length <= 0 ? __('The title cannot be blank') : ''), true);
- });
-
- $("#show-data-contact").click(function(){
- toggleDataContact();
- })
-
- $("#is_test").click(function(){
- $("#plan_visibility").val($(this).is(":checked") ? 'is_test' : 'privately_visible');
- });
-
- $("#show-other-guidance-orgs").click(function(){
- if($("#other-guidance-orgs").css('display') === 'block'){
- $("#other-guidance-orgs").hide();
- $(this).html($(this).html().replace('Hide', __('See')));
- }else{
- $("#other-guidance-orgs").show();
- $(this).html($(this).html().replace('See', __('Hide')));
- }
- });
-
- $(".guidance-choice").click(function(){
- toggleGuidanceChoices();
- });
-
- toggleProjectDetailsSubmit();
- toggleDataContact();
- toggleGuidanceChoices();
-
- function toggleDataContact(){
- if($("#show-data-contact").is(':checked')){
- $(".data-contact-info").hide();
- $(".data-contact-info input").val('');
- }else{
- $(".data-contact-info").show();
- }
- }
-
- function toggleProjectDetailsSubmit(){
- var piEmail = $("#plan_principal_investigator_email").val();
- var dcEmail = $("#plan_data_contact_email").val();
- var disabled = $("#plan_title").val() == undefined;
-
- if(piEmail && piEmail.trim() != '' && !disabled){
- disabled = validateEmail(piEmail) != '';
- }
- if(dcEmail && dcEmail.trim() != '' && !disabled){
- disabled = validateEmail(dcEmail) != '';
- }
-
- $("#save-details-button").attr('aria-disabled', disabled);
- }
-
- // Only allow up to 3 guidance groups to be selected
- function toggleGuidanceChoices(){
- if($(".guidance-choice:checked").length <= 6){
- $(".guidance-choice").removeAttr('disabled');
- $(".guidance-group-label").removeClass('disabled');
- }else{
- $(".guidance-choice:not(:checked)").attr('disabled', 'disabled')
- .siblings(".guidance-group-label").addClass('disabled');
- }
- }
-});
diff --git a/lib/assets/javascripts/views/registrations/sign_in_sign_up.js b/lib/assets/javascripts/views/registrations/sign_in_sign_up.js
deleted file mode 100644
index e69de29..0000000
--- a/lib/assets/javascripts/views/registrations/sign_in_sign_up.js
+++ /dev/null
diff --git a/lib/assets/javascripts/views/shared/accessible_combobox.js b/lib/assets/javascripts/views/shared/accessible_combobox.js
deleted file mode 100644
index 2a17e73..0000000
--- a/lib/assets/javascripts/views/shared/accessible_combobox.js
+++ /dev/null
@@ -1,47 +0,0 @@
- var <%= id %>_crosswalk = <%= raw JSON.generate(json) %>;
-
- // When the user selects a value from the combobox, place the corresponding id in the hidden field
- $(document).ready(function(){
- var combo = $("#<%= id %>");
- var clear = $(combo).siblings(".combobox-clear-button");
-
- // Pull the id out of the json hash based on the text the user selected
- $(combo).keyup(function(){
- var selection = <%= id %>_crosswalk[$(this).val()];
- $("#<%= id.gsub("_#{attribute}", "_id") %>").val(selection === 'undefined' ? '' : selection).change();
- }).focus(function(){
- var selection = <%= id %>_crosswalk[$(this).val()];
- $("#<%= id.gsub("_#{attribute}", "_id") %>").val(selection === 'undefined' ? '' : selection).change();
- });
-
- // Initialize the clear buttons on load
- // Replace the default js-combobox clear button [X] with a fontawesome icon
- $(clear).html('');
- $(clear).css("display", $(combo).val().trim().length <= 0 ? 'none' : 'inline');
-
- // Function to hide/show the clear button when text changed in the dropdown
- // -------------------------------------------------------------
- $(combo).keyup(function(){
- $(clear).css("display", $(combo).val().trim().length <= 0 ? 'none' : 'inline');
- }).change(function(){
- $(clear).css("display", $(combo).val().trim().length <= 0 ? 'none' : 'inline');
- });
-
- // Hide the clear button if it gets clicked
- // -------------------------------------------------------------
- $(clear).click(function(){
- $(this).css("display", 'none');
- $(combo).val("").focus();//.keyup();
- });
-
- // Display the error message if the value in the auto complete is not an item from the list
- $("#<%= id.gsub("_#{attribute}", "_id") %>").on('change', function(){
- if($(this).val().trim().length > 1 || $(combo).val().trim().length < 1){
- $("#<%= id %>_error").html("").attr('role', '');
- $("#<%= id %>").removeClass('red-border');
- }else{
- $("#<%= id %>_error").html("<%= err_msg %>").attr('role', 'alert');
- $("#<%= id %>").addClass('red-border');
- }
- });
- });
\ No newline at end of file
diff --git a/lib/assets/javascripts/views/shared/accessible_submit_button.js b/lib/assets/javascripts/views/shared/accessible_submit_button.js
deleted file mode 100644
index 6cdd88f..0000000
--- a/lib/assets/javascripts/views/shared/accessible_submit_button.js
+++ /dev/null
@@ -1,13 +0,0 @@
-$(document).ready(function(){
- // Allow the 'button disabled' tooltip to appear if the button is NOT clickable
- $("#<%= id %>").on('click focus', function(e){
- if($(this).attr('aria-disabled') == 'true'){
- e.preventDefault();
- toggleFormElementError(this, "<%= tooltip %>");
- }else{
- toggleFormElementError(this, '');
- }
- }).on('blur', function(){
- toggleFormElementError(this, '');
- });
-});
\ No newline at end of file
diff --git a/lib/assets/javascripts/views/shared/create_account_form.js b/lib/assets/javascripts/views/shared/create_account_form.js
index da63fd1..6f909a1 100644
--- a/lib/assets/javascripts/views/shared/create_account_form.js
+++ b/lib/assets/javascripts/views/shared/create_account_form.js
@@ -1,8 +1,10 @@
+import initAutoComplete from '../../utils/autoComplete';
import ariatiseForm from '../../utils/ariatiseForm';
import togglisePasswords from '../../utils/passwordHelper';
import { SHOW_SELECT_ORG_MESSAGE, SHOW_OTHER_ORG_MESSAGE } from '../../constants';
$(() => {
+ initAutoComplete();
ariatiseForm({ selector: '#create_account_form' });
togglisePasswords({ selector: '#create_account_form' });