Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions app/assets/javascripts/newflow/newflow_ui.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@ NewflowUi = do () ->
disableButton: (selector) ->
$(selector).attr('disabled', 'disabled')
$(selector).addClass('ui-state-disabled ui-button-disabled')
$(selector).css({
'background': '#ccc',
'box-shadow': 'none',
'color': '#666'
})

enableButton: (selector) ->
$(selector).removeAttr('disabled')
$(selector).removeClass('ui-state-disabled ui-button-disabled')
$(selector).button()
$(selector).css({ 'background': '', 'box-shadow': '', 'color': '' })

renderAndOpenDialog: (html_id, content, modal_options = {}) ->
if $('#' + html_id).exists() then $('#' + html_id).remove()
Expand Down
8 changes: 5 additions & 3 deletions app/assets/stylesheets/newflow.scss
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ label.required::after {
top: 3.7rem;
right: 1.8rem;

color: #027EB5;
color: #0070af;
font-weight: bold;
cursor: pointer;

Expand Down Expand Up @@ -674,7 +674,7 @@ $very-narrow: 37rem * $scale-factor;
padding-right: 0;

background-color: #f1f1f1;
color: #c1c1c1;
color: #666666;

@include title-font(2.4rem);
text-align: center;
Expand Down Expand Up @@ -774,10 +774,12 @@ $very-narrow: 37rem * $scale-factor;

input[type=submit] {
&:disabled {
background-color: #ccc;
box-shadow: none;
color: #666;
opacity: 0.85;
}

-webkit-appearance: none;
border-radius: 0;
}
}
Expand Down
16 changes: 15 additions & 1 deletion app/views/newflow/login/login_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@
<%= f.submit I18n.t(:"login_signup_form.continue_button"),
disable_with: I18n.t(:"login_signup_form.continue_button"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need both the disable_with and the newly added disabled in the data?

Copy link
Contributor Author

@RoyEJohnson RoyEJohnson Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually not sure what disable_with does, but it looks like it provides a message to display when the item is disabled, whereas the disabled setting makes it disabled.
Looks like it's specifically for during form submission; the disabled attribute is prior to submitting.

class: 'primary',
data: { ga_category: 'Login', ga_action: 'Click', ga_label: 'Email' }
data: { ga_category: 'Login', ga_action: 'Click', ga_label: 'Email' },
disabled: 'disabled'
%>
</div>

Expand All @@ -118,5 +119,18 @@

<script type="text/javascript">
NewflowUi.focusOnFirstErrorItem();
const $requiredInputs = $('form input[aria-required="true"]');
const handleDisable = () => {
const disableSubmit = $requiredInputs.toArray().some((i) => i.value.length == 0);

if (disableSubmit) {
NewflowUi.disableButton('form [type="submit"]');
} else {
NewflowUi.enableButton('form [type="submit"]');
}
}

$requiredInputs.on('input', handleDisable);
handleDisable();
</script>

6 changes: 1 addition & 5 deletions spec/features/newflow/user_cant_sign_in_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
screenshot!
end

scenario "email blank" do
newflow_log_in_user('', 'password')
expect(page).to have_content(error_msg Newflow::LogInUser, :email, :blank)
screenshot!
end
# Removed test for blank email; blank email is not allowed

scenario "multiple accounts match email but no usernames" do
# For a brief window in 2017 users could sign up with [email protected] and [email protected]
Expand Down
Loading