Commit 39367dc4 authored by Illya Klymov's avatar Illya Klymov

Improve toggleClass logic

parent 4b855508
......@@ -139,13 +139,7 @@ const bindEvents = () => {
const url = $projectImportUrl.val();
const URL_PATTERN = /(?:git|https?):\/\/.*\/.*\.git$/;
const isUrlValid = URL_PATTERN.test(url);
if (isUrlValid && !$projectImportUrlWarning.hasClass('hide')) {
$projectImportUrlWarning.addClass('hide');
}
if (!isUrlValid && $projectImportUrlWarning.hasClass('hide')) {
$projectImportUrlWarning.removeClass('hide');
}
$projectImportUrlWarning.toggleClass('hide', isUrlValid);
}
let isProjectImportUrlDirty = false;
......
......@@ -14,7 +14,7 @@
dismissible: false,
close_button_class: 'js-close-2fa-enabled-success-alert' do
.gl-alert-body
= s_('Import|A repository URL usually ends with a .git suffix, although this is not required. Double check to make sure your repository URL is correct.')
= s_('Import|A repository URL usually ends in a .git suffix, although this is not required. Double check to make sure your repository URL is correct.')
.gl-alert.gl-alert-not-dismissible.gl-alert-warning.gl-mt-3.hide#project_import_url_warning
.gl-alert-container
......
......@@ -16757,6 +16757,9 @@ msgstr[1] ""
msgid "Importing..."
msgstr ""
msgid "Import|A repository URL usually ends in a .git suffix, although this is not required. Double check to make sure your repository URL is correct."
msgstr ""
msgid "Improve customer support with Service Desk"
msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment