diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-07-21 09:52:06 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-07-21 09:52:06 +0000 |
commit | 479814b29289ab5598117ff22b63e386a3d2d9f3 (patch) | |
tree | 006924c7dc7e33c29a532197b4df9d9f63b7b5a4 | |
parent | cb9f418bf846b5bc32902ed70ddc7d7be3d5c071 (diff) | |
parent | 96572bd006fd257eb037c0fbf9c6094f35d8cd60 (diff) | |
download | gitlab-ce-479814b29289ab5598117ff22b63e386a3d2d9f3.tar.gz |
Merge branch 'fix/new-project-import-tooltip' into 'master'
Show tooltip on GitLab export link in new project page
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/19993
When the project path/name is not filled, we should show a tooltip in the `GitLab export` link, plus a flash message if the user still tries to click on it.
- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- Tests
- [x] Added for this feature/bug
- [ ] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
See merge request !5363
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/views/projects/new.html.haml | 24 | ||||
-rw-r--r-- | spec/features/projects/import_export/import_file_spec.rb | 15 |
3 files changed, 28 insertions, 12 deletions
diff --git a/CHANGELOG b/CHANGELOG index d0344c4a66f..0b9940c81a9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -158,6 +158,7 @@ v 8.10.0 (unreleased) - Add builds badge to Pipelines settings page - Export and import avatar as part of project import/export - Fix migration corrupting import data for old version upgrades + - Show tooltip on GitLab export link in new project page v 8.9.6 - Fix importing of events under notes for GitLab projects. !5154 diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml index c72d0140bb9..facdfcc9447 100644 --- a/app/views/projects/new.html.haml +++ b/app/views/projects/new.html.haml @@ -89,9 +89,9 @@ = link_to "#", class: 'btn js-toggle-button import_git' do %i.fa.fa-git %span Repo by URL - %div + %div{ class: 'import_gitlab_project' } - if gitlab_project_import_enabled? - = link_to new_import_gitlab_project_path, class: 'btn import_gitlab_project project-submit' do + = link_to new_import_gitlab_project_path, class: 'btn btn_import_gitlab_project project-submit' do %i.fa.fa-gitlab %span GitLab export @@ -130,29 +130,29 @@ $(".modal").hide(); }); - $('.import_gitlab_project').bind('click', function() { - var _href = $("a.import_gitlab_project").attr("href"); - $(".import_gitlab_project").attr("href", _href + '?namespace_id=' + $("#project_namespace_id").val() + '&path=' + $("#project_path").val()); + $('.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()); }); - $('.import_gitlab_project').attr('disabled',true) - $('.import_gitlab_project').attr('title', 'Project path required.'); + $('.btn_import_gitlab_project').attr('disabled',true) + $('.import_gitlab_project').attr('title', 'Project path and name required.'); $('.import_gitlab_project').click(function( event ) { - if($('.import_gitlab_project').attr('disabled')) { + if($('.btn_import_gitlab_project').attr('disabled')) { event.preventDefault(); - new Flash("Please enter a path for the project to be imported to."); + new Flash("Please enter path and name for the project to be imported to."); } }); $('#project_path').keyup(function(){ if($(this).val().length !=0) { - $('.import_gitlab_project').attr('disabled', false); + $('.btn_import_gitlab_project').attr('disabled', false); $('.import_gitlab_project').attr('title',''); $(".flash-container").html("") } else { - $('.import_gitlab_project').attr('disabled',true); - $('.import_gitlab_project').attr('title', 'Project path required.'); + $('.btn_import_gitlab_project').attr('disabled',true); + $('.import_gitlab_project').attr('title', 'Project path and name required.'); } }); diff --git a/spec/features/projects/import_export/import_file_spec.rb b/spec/features/projects/import_export/import_file_spec.rb index bc3bf53fe9d..2d1e3bbebe5 100644 --- a/spec/features/projects/import_export/import_file_spec.rb +++ b/spec/features/projects/import_export/import_file_spec.rb @@ -59,6 +59,21 @@ feature 'project import', feature: true, js: true do end end + scenario 'project with no name' do + create(:project, namespace_id: 2) + + visit new_project_path + + select2('2', from: '#project_namespace_id') + + # click on disabled element + find(:link, 'GitLab export').trigger('click') + + page.within('.flash-container') do + expect(page).to have_content('Please enter path and name') + end + end + def wiki_exists? wiki = ProjectWiki.new(project) File.exist?(wiki.repository.path_to_repo) && !wiki.repository.empty? |