diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2017-07-25 10:41:43 +0200 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2017-07-27 15:03:04 +0200 |
commit | 2cc1658489fe2d2de4052db36b21a788195cfc1b (patch) | |
tree | 72758de2da62ee52ed0d58a05a70105903cd7b7b | |
parent | 4eebd8e1957a3fc3a3479331fde9f34aa8afa9d5 (diff) | |
download | gitlab-ce-2cc1658489fe2d2de4052db36b21a788195cfc1b.tar.gz |
Project New moved to external File
-rw-r--r-- | app/assets/javascripts/projects/project_new.js | 43 | ||||
-rw-r--r-- | app/views/projects/new.html.haml | 45 | ||||
-rw-r--r-- | config/webpack.config.js | 1 |
3 files changed, 46 insertions, 43 deletions
diff --git a/app/assets/javascripts/projects/project_new.js b/app/assets/javascripts/projects/project_new.js new file mode 100644 index 00000000000..4f87df8e160 --- /dev/null +++ b/app/assets/javascripts/projects/project_new.js @@ -0,0 +1,43 @@ +document.addEventListener('DOMContentLoaded', () => { + const importBtnTooltip = 'Please enter a valid project name.'; + const $importBtnWrapper = $('.import_gitlab_project'); + + $('.how_to_import_link').bind('click', function (e) { + e.preventDefault(); + $(this).next('.modal').show(); + }); + + $('.modal-header .close').bind('click', () => { + $('.modal').hide(); + }); + + $('.btn_import_gitlab_project').bind('click', () => { + const importHref = $('a.btn_import_gitlab_project').attr('href'); + $('.btn_import_gitlab_project').attr('href', `${importHref}?namespace_id=${$('#project_namespace_id').val()}&path=${$('#project_path').val()}`); + }); + + $('.btn_import_gitlab_project').attr('disabled', $('#project_path').val().trim().length === 0); + $importBtnWrapper.attr('title', importBtnTooltip); + + $('#new_project').submit(() => { + const $path = $('#project_path'); + $path.val($path.val().trim()); + }); + + $('#project_path').keyup(() => { + if ($(this).val().trim().length !== 0) { + $('.btn_import_gitlab_project').attr('disabled', false); + $importBtnWrapper.attr('title', ''); + $importBtnWrapper.removeClass('has-tooltip'); + } else { + $('.btn_import_gitlab_project').attr('disabled', true); + $importBtnWrapper.addClass('has-tooltip'); + } + }); + + $('#project_import_url').disable(); + $('.import_git').click(() => { + const $projectImportUrl = $('#project_import_url'); + $projectImportUrl.attr('disabled', !$projectImportUrl.attr('disabled')); + }); +}); diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml index 87cc23fc649..25109f0f414 100644 --- a/app/views/projects/new.html.haml +++ b/app/views/projects/new.html.haml @@ -4,6 +4,8 @@ - page_title 'New Project' - header_title "Projects", dashboard_projects_path - visibility_level = params.dig(:project, :visibility_level) || default_project_visibility +- content_for :page_specific_javascripts do + = webpack_bundle_tag 'project_new' .project-edit-container .project-edit-errors @@ -111,46 +113,3 @@ %i.fa.fa-spinner.fa-spin Creating project & repository. %p Please wait a moment, this page will automatically refresh when ready. - -:javascript - var importBtnTooltip = "Please enter a valid project name."; - var $importBtnWrapper = $('.import_gitlab_project'); - - $('.how_to_import_link').bind('click', function (e) { - e.preventDefault(); - var import_modal = $(this).next(".modal").show(); - }); - - $('.modal-header .close').bind('click', function() { - $(".modal").hide(); - }); - - $('.btn_import_gitlab_project').bind('click', function() { - var _href = $("a.btn_import_gitlab_project").attr("href"); - $(".btn_import_gitlab_project").attr("href", _href + '?namespace_id=' + $("#project_namespace_id").val() + '&path=' + $("#project_path").val()); - }); - - $('.btn_import_gitlab_project').attr('disabled', $('#project_path').val().trim().length === 0); - $importBtnWrapper.attr('title', importBtnTooltip); - - $('#new_project').submit(function(){ - var $path = $('#project_path'); - $path.val($path.val().trim()); - }); - - $('#project_path').keyup(function(){ - if($(this).val().trim().length !== 0) { - $('.btn_import_gitlab_project').attr('disabled', false); - $importBtnWrapper.attr('title',''); - $importBtnWrapper.removeClass('has-tooltip'); - } else { - $('.btn_import_gitlab_project').attr('disabled',true); - $importBtnWrapper.addClass('has-tooltip'); - } - }); - - $('#project_import_url').disable(); - $('.import_git').click(function( event ) { - $projectImportUrl = $('#project_import_url'); - $projectImportUrl.attr('disabled', !$projectImportUrl.attr('disabled')); - }); diff --git a/config/webpack.config.js b/config/webpack.config.js index f08daa2fddb..902c60b84cb 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -56,6 +56,7 @@ var config = { pipelines: './pipelines/pipelines_bundle.js', pipelines_details: './pipelines/pipeline_details_bundle.js', profile: './profile/profile_bundle.js', + project_new: './projects/project_new.js', prometheus_metrics: './prometheus_metrics', protected_branches: './protected_branches', protected_tags: './protected_tags', |