Commit ba7c65a6 authored by Filipa Lacerda's avatar Filipa Lacerda

Adds export form and enables export button by default

parent 54e3361f
...@@ -534,7 +534,7 @@ a.deploy-project-label { ...@@ -534,7 +534,7 @@ a.deploy-project-label {
transform: translateX(-50%); transform: translateX(-50%);
@media (min-width: $screen-lg-min) { @media (min-width: $screen-lg-min) {
left: -35px; left: -30px;
top: 50%; top: 50%;
padding: 10px 0; padding: 10px 0;
width: 20px; width: 20px;
...@@ -554,7 +554,7 @@ a.deploy-project-label { ...@@ -554,7 +554,7 @@ a.deploy-project-label {
@media (min-width: $screen-lg-min) { @media (min-width: $screen-lg-min) {
bottom: 0; bottom: 0;
left: -25px; left: -20px;
right: auto; right: auto;
height: 100%; height: 100%;
width: 1px; width: 1px;
......
...@@ -5,21 +5,47 @@ ...@@ -5,21 +5,47 @@
Import an exported GitLab project Import an exported GitLab project
%hr %hr
= form_tag import_gitlab_project_path, class: 'form-horizontal', multipart: true do = form_for import_gitlab_project_path, class: 'form-horizontal', multipart: true do |f|
%p .row
Project will be imported as .form-group.col-xs-12.col-sm-6
%strong = f.label :namespace_id, class: 'label-light' do
#{@namespace.name}/#{@path} %span
Project path
.form-group
.input-group
- if current_user.can_select_namespace?
.input-group-addon
= root_url
= f.select :namespace_id, namespaces_options(namespace_id_from(params) || :current_user, display_path: true, extra_group: namespace_id_from(params)), {}, { class: 'select2 js-select-namespace', tabindex: 1}
- else
.input-group-addon.static-namespace
#{root_url}#{current_user.username}/
= f.hidden_field :namespace_id, value: current_user.namespace_id
.form-group.col-xs-12.col-sm-6.project-path
= f.label :path, class: 'label-light' do
%span
Project name
= f.text_field :path, placeholder: "my-awesome-project", class: "js-path-name form-control", tabindex: 2, autofocus: true, required: true
%p
.row
.form-group.col-md-12
To move or copy an entire GitLab project from another GitLab installation to this one, navigate to the original project's settings page, generate an export file, and upload it here. To move or copy an entire GitLab project from another GitLab installation to this one, navigate to the original project's settings page, generate an export file, and upload it here.
.form-group .row
.form-group.col-sm-12
= hidden_field_tag :namespace_id, @namespace.id = hidden_field_tag :namespace_id, @namespace.id
= hidden_field_tag :path, @path = hidden_field_tag :path, @path
= label_tag :file, class: 'control-label' do = f.label :file, class: 'label-light' do
%span GitLab project export %span
.col-sm-10 GitLab project export
.form-group
= file_field_tag :file, class: '' = file_field_tag :file, class: ''
.row
.form-actions .form-actions
= submit_tag 'Import project', class: 'btn btn-create' = f.submit 'Import project', class: 'btn btn-create'
= link_to 'Cancel', new_project_path, class: 'btn btn-cancel'
:javascript
// get the path url and append it in the inputS
$('.js-path-name').val(gl.utils.getParameterValues('path'));
...@@ -67,7 +67,6 @@ ...@@ -67,7 +67,6 @@
%button.btn.js-toggle-button.import_git{ type: "button" } %button.btn.js-toggle-button.import_git{ type: "button" }
= icon('git', text: 'Repo by URL') = icon('git', text: 'Repo by URL')
.import_gitlab_project.has-tooltip{ data: { container: 'body' } } .import_gitlab_project.has-tooltip{ data: { container: 'body' } }
- if gitlab_project_import_enabled?
= link_to new_import_gitlab_project_path, class: 'btn btn_import_gitlab_project project-submit' do = link_to new_import_gitlab_project_path, class: 'btn btn_import_gitlab_project project-submit' do
= icon('gitlab', text: 'GitLab export') = icon('gitlab', text: 'GitLab export')
...@@ -127,9 +126,6 @@ ...@@ -127,9 +126,6 @@
%p Please wait a moment, this page will automatically refresh when ready. %p Please wait a moment, this page will automatically refresh when ready.
:javascript :javascript
var importBtnTooltip = "Please enter a valid project name.";
var $importBtnWrapper = $('.import_gitlab_project');
$('.how_to_import_link').bind('click', function (e) { $('.how_to_import_link').bind('click', function (e) {
e.preventDefault(); e.preventDefault();
var import_modal = $(this).next(".modal").show(); var import_modal = $(this).next(".modal").show();
...@@ -144,25 +140,11 @@ ...@@ -144,25 +140,11 @@
$(".btn_import_gitlab_project").attr("href", _href + '?namespace_id=' + $("#project_namespace_id").val() + '&path=' + $("#project_path").val()); $(".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(){ $('#new_project').submit(function(){
var $path = $('#project_path'); var $path = $('#project_path');
$path.val($path.val().trim()); $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(); $('#project_import_url').disable();
$('.import_git').click(function( event ) { $('.import_git').click(function( event ) {
$projectImportUrl = $('#project_import_url'); $projectImportUrl = $('#project_import_url');
......
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