diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8785987..80eb17a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -24,11 +24,6 @@ "".html_safe end - # --------------------------------------------------------------------------- - def uuid - SecureRandom.hex - end - # Determines whether or not the URL path passed matches with the full path (including params) of the last URL requested. # see http://api.rubyonrails.org/classes/ActionDispatch/Request.html#method-i-fullpath for details # --------------------------------------------------------------------------- diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index c3097f4..109a108 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -13,20 +13,20 @@
- - - + + +
- <%= render partial: 'shared/accessible_submit_button', - locals: {id: 'password-reset-button', - val: _('Send'), - disabled_initially: true, - classes: 'small-input-button', - tooltip: _('Enter a valid email.')} %> -
+ <%= render partial: 'shared/accessible_submit_button', + locals: {id: 'password-reset-button', + val: _('Send'), + disabled_initially: true, + classes: 'small-input-button', + tooltip: _('Enter a valid email.')} %> +
<% end %> diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 0f8d854..79d06b7 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -15,39 +15,39 @@ <%= hidden_field_tag :unlink_flag, "false", id: "unlink_flag" %>
- - - + + +
- +
- - + +
- - + +
- - - + + +
- + <%= render partial: "shared/accessible_combobox", locals: {name: "#{resource_name}[org_name]", id: "#{resource_name}_org_name", @@ -60,7 +60,7 @@ <% if MANY_LANGUAGES %>
<% lang = current_user.language.nil? ? FastGettext.default_locale : current_user.language.abbreviation %> - + - + + +
- - - + + +
- - - -
- -
-
- - -
+ + + +
+ +
+
+ + +
- <%= render partial: 'shared/accessible_submit_button', - locals: {id: 'update', - val: 'Save', - disabled_initially: true, - classes: 'small-input-button', - tooltip: _('Enter all of the required information above')} %> + <%= render partial: 'shared/accessible_submit_button', + locals: {id: 'update', + val: 'Save', + disabled_initially: true, + classes: 'small-input-button', + tooltip: _('Enter all of the required information above')} %>
diff --git a/app/views/layouts/_signin_signout.html.erb b/app/views/layouts/_signin_signout.html.erb index 8533b06..02690f2 100644 --- a/app/views/layouts/_signin_signout.html.erb +++ b/app/views/layouts/_signin_signout.html.erb @@ -23,11 +23,7 @@ <% end %> <% end %>
  • - <% if Rails.application.config.shibboleth_enabled %> - <%= link_to _('Sign out'), destroy_user_session_path, method: :delete, class: "signIn_dropdown_link" %> - <% else %> - <%= link_to _('Sign out'), destroy_user_session_path, method: :delete, class: "signIn_dropdown_link" %> - <% end %> + <%= link_to _('Sign out'), destroy_user_session_path, method: :delete, class: "signIn_dropdown_link" %>
  • diff --git a/app/views/shared/_accessible_input.html.erb b/app/views/shared/_accessible_input.html.erb deleted file mode 100644 index 2aaef69..0000000 --- a/app/views/shared/_accessible_input.html.erb +++ /dev/null @@ -1,129 +0,0 @@ -<% -# This partial expects the following locals to be passed in: -# type - The HTML input type (e.g. 'text', 'checkbox', etc.) -# id - The input id. Use the Rails style model_attr (e.g. 'user_email') -# name - The input name. Use the Rails style model[attr] (e.g. 'user[email]') -# label - The input's label. If its a checkbox the label will appear after the input -# classes - The list of classes to apply to the input (e.g. 'required abcd a123') -# -# The following locals are also permitted but NOT required -# val - The input value -# tooltip - The input title attribute -# error_handler - Any custom error handler that you want to be fired on blur. -# The email and password types have a default handler located in -# roadmap-form.js - -tip = "#{id}_tip" -error = "#{id}_error" - -# Used to prevent JS bindings from affecting existing page elements -js_id = '' - -# Allow the tooltip, and error_handler to be missing form locals -tooltip = tooltip ||= '' -error_handler = error_handler ||= '' -%> - -
    - <% if type != 'checkbox' %> - - <% end %> - - - - <% if type == 'checkbox' %> - - <% end %> - <% - # If the field is a password then provide a 'show password' checkbox - if type == 'password' - %> -
    - - -
    - - <% end %> - - <% - # If the field has a tooltip add it and wire it up for on focus/blur - if !tooltip.blank? - %> -
    - <%= tooltip %> -
    - - <% end %> - - <% - # If an error handler was passed in or the input type has a generic handler - if !error_handler.blank? || ['email', 'password'].include?(type) - %> - - - - <% end %> -
    \ No newline at end of file diff --git a/lib/assets/javascripts/devise/passwords/new.js b/lib/assets/javascripts/devise/passwords/new.js index 55987fb..18816c3 100644 --- a/lib/assets/javascripts/devise/passwords/new.js +++ b/lib/assets/javascripts/devise/passwords/new.js @@ -2,9 +2,9 @@ $("#user_email").blur(function(){ $("#password-reset-button").attr('aria-disabled', validateEmail($(this).val()) != ''); }); - - // Run the input validations when the focus changes - $("#user_email").blur(function(){ + + // Run the input validations when the focus changes + $("#user_email").blur(function(){ toggleInputError(this, validateEmail($(this).val().trim())); - }); + }); }); \ No newline at end of file diff --git a/lib/assets/javascripts/devise/registrations/edit.js b/lib/assets/javascripts/devise/registrations/edit.js index 85f93a7..1f5c57e 100644 --- a/lib/assets/javascripts/devise/registrations/edit.js +++ b/lib/assets/javascripts/devise/registrations/edit.js @@ -30,8 +30,8 @@ // Make sure the show password checkbox is unchecked on load $("#passwords_show").attr("checked", false); - toggleSubmit(); - + toggleSubmit(); + function validateEmailsDoNotMatch(){ let email = $("form.register-form #user_email").val().trim(); let recovery = $("form.register-form #user_recovery_email").val().trim(); diff --git a/lib/assets/javascripts/roadmap-form.js b/lib/assets/javascripts/roadmap-form.js index ce8bc00..19557b3 100644 --- a/lib/assets/javascripts/roadmap-form.js +++ b/lib/assets/javascripts/roadmap-form.js @@ -1,17 +1,17 @@ // --------------------------------------------------------------------------- function toggleInputError(input, errorMessage){ - let err = $(input).siblings("span.error-tooltip"); - if(err.length <= 0){ - err = $(input).siblings("span.error-tooltip-right"); - } - - if(err.length > 0 && (errorMessage === '' || $(input).val().trim().length <= 0)){ - err.html('').attr('role', ''); - $(input).removeClass('red-border'); - }else{ - err.html(__('Error: ') + errorMessage).attr('role', 'tooltip'); - $(input).addClass('red-border'); - } + let err = $(input).siblings("span.error-tooltip"); + if(err.length <= 0){ + err = $(input).siblings("span.error-tooltip-right"); + } + + if(err.length > 0 && (errorMessage === '' || $(input).val().trim().length <= 0)){ + err.html('').attr('role', ''); + $(input).removeClass('red-border'); + }else{ + err.html(__('Error: ') + errorMessage).attr('role', 'tooltip'); + $(input).addClass('red-border'); + } } // --------------------------------------------------------------------------- @@ -33,13 +33,4 @@ else { return __('Invalid Email'); } -} - -// --------------------------------------------------------------------------- -function validateValuesDoNotMatch(inputA, inputB, message){ - return ($(inputA).val().trim() === $(inputB).val().trim() ? message : ''); -} - -function processValidations(a, b){ - return ''; } \ No newline at end of file diff --git a/lib/assets/javascripts/shared/register_form.js b/lib/assets/javascripts/shared/register_form.js index aaaa84b..edf6851 100644 --- a/lib/assets/javascripts/shared/register_form.js +++ b/lib/assets/javascripts/shared/register_form.js @@ -4,49 +4,49 @@ $(this).siblings(".form-submit").attr('aria-disabled', $(this).val() != "true"); }); - // See if we should enable the submit button when a required input changes + // See if we should enable the submit button when a required input changes $("form.register-form input[class*='required']").change(function(){ toggleRegisterSubmit(); }); - - // Run the input validations when the focus changes - $("form.register-form #user_email, form.register-form #user_recovery_email").blur(function(){ - let msg = validateEmail($(this).val().trim()); - // If the standard email validation was successful validate that they do not match + + // Run the input validations when the focus changes + $("form.register-form #user_email, form.register-form #user_recovery_email").blur(function(){ + let msg = validateEmail($(this).val().trim()); + // If the standard email validation was successful validate that they do not match toggleInputError(this, (msg != '' ? msg : validateEmailsDoNotMatch())); - }); - $("form.register-form #user_password").blur(function(){ - toggleInputError(this, validatePassword($(this).val().trim())); - }); - - // Toggle the password field so that its visible/masked - $("form.register-form #password_show").click(function(){ + }); + $("form.register-form #user_password").blur(function(){ + toggleInputError(this, validatePassword($(this).val().trim())); + }); + + // Toggle the password field so that its visible/masked + $("form.register-form #password_show").click(function(){ let typ = $("form.register-form #user_password").attr('type'); $("form.register-form #user_password").attr('type', (typ === 'password' ? 'text' : 'password')); - }); - - // Run the validations in case the page was refreshed - toggleInputError($("form.register-form #user_email"), - validateEmail($("form.register-form #user_email").val().trim())); - toggleInputError($("form.register-form #user_recovery_email"), - validateEmail($("form.register-form #user_recovery_email").val().trim())); - toggleInputError($("form.register-form #user_password"), - validatePassword($("form.register-form #user_password").val().trim())); - - // Make sure the show password checkbox is unchecked on load - $("form.register-form #password_show").attr("checked", false); + }); + + // Run the validations in case the page was refreshed + toggleInputError($("form.register-form #user_email"), + validateEmail($("form.register-form #user_email").val().trim())); + toggleInputError($("form.register-form #user_recovery_email"), + validateEmail($("form.register-form #user_recovery_email").val().trim())); + toggleInputError($("form.register-form #user_password"), + validatePassword($("form.register-form #user_password").val().trim())); + + // Make sure the show password checkbox is unchecked on load + $("form.register-form #password_show").attr("checked", false); - function validateEmailsDoNotMatch(){ - let email = $("form.register-form #user_email").val().trim(); - let recovery = $("form.register-form #user_recovery_email").val().trim(); - return (email === recovery ? (email != '' ? __('Emails must be different') : '') : ''); - } + function validateEmailsDoNotMatch(){ + let email = $("form.register-form #user_email").val().trim(); + let recovery = $("form.register-form #user_recovery_email").val().trim(); + return (email === recovery ? (email != '' ? __('Emails must be different') : '') : ''); + } function toggleRegisterSubmit(){ let disabled = ($("form.register-form #user_firstname").val().trim().length <= 0 || $("form.register-form #user_surname").val().trim().length <= 0 || - validateEmail($("form.register-form #user_email").val()) != '' || - validateEmail($("form.register-form #user_recovery_email").val()) != '' || + validateEmail($("form.register-form #user_email").val()) != '' || + validateEmail($("form.register-form #user_recovery_email").val()) != '' || !$("form.register-form #user_accept_terms").prop('checked') || $("form.register-form #user_email").val() === $("form.register-form #user_recovery_email").val()); $("form.register-form #register-button").attr('aria-disabled', disabled); diff --git a/lib/assets/stylesheets/roadmap-form.scss b/lib/assets/stylesheets/roadmap-form.scss index 5b5423e..8292e40 100644 --- a/lib/assets/stylesheets/roadmap-form.scss +++ b/lib/assets/stylesheets/roadmap-form.scss @@ -172,7 +172,7 @@ border-bottom: 6px solid transparent; border-right: 6px solid $dark-grey; } - /* + /* .submit-tooltip { display: none; margin-left: 5px; @@ -229,12 +229,12 @@ border-bottom: 5px solid $error-background; } - .error-tooltip-right[role="tooltip"] { + .error-tooltip-right[role="tooltip"] { top: 0; left: 500px; display: inline; - } - .error-tooltip-right[role='tooltip']:before { + } + .error-tooltip-right[role='tooltip']:before { display: inline; position: absolute; left: -5px; @@ -243,7 +243,7 @@ border-top: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 5px solid $error-background; - } + } } /* Accessible JQuery combobox */