new.html.haml 6.2 KB
Newer Older
1
- page_title    'New Project'
2
- header_title  "Projects", dashboard_projects_path
D
Douwe Maan 已提交
3

D
Dmitriy Zaporozhets 已提交
4
.project-edit-container
5
  .project-edit-errors
6
    = render 'projects/errors'
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
  .row.prepend-top-default
    .col-lg-3.profile-settings-sidebar
      %h4.prepend-top-0
        New project
      %p
        Create or Import your project from popular Git services
    .col-lg-9
      = form_for @project, html: { class: 'new_project' } do |f|
        %fieldset.append-bottom-0
          .form-group.col-xs-12.col-sm-6
            = f.label :namespace_id, class: 'label-light' do
              %span
                Project path
            .form-group
              .input-group
                - if current_user.can_select_namespace?
                  .input-group-addon
                    = root_url
                  = f.select :namespace_id, namespaces_options(params[:namespace_id] || :current_user, display_path: true), {}, {class: 'select2 js-select-namespace', tabindex: 1}
26

27
                - else
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
                  .input-group-addon.static-namespace
                    #{root_url}#{current_user.username}/
          .form-group.col-xs-12.col-sm-6.project-path
            = f.label :namespace_id, class: 'label-light' do
              %span
                Project name
            = f.text_field :path, placeholder: "my-awesome-project", class: "form-control", tabindex: 2, autofocus: true, required: true
        - if current_user.can_create_group?
          .help-block
            Want to house several dependent projects under the same namespace?
            = link_to "Create a group", new_group_path

        - if import_sources_enabled?
          .project-import.js-toggle-container
            .form-group.clearfix
              = f.label :visibility_level, class: 'label-light' do
                Import project from
              .col-sm-12.import-buttons
                %div
                  - if github_import_enabled?
48
                    = link_to new_import_github_path, class: 'btn import_github' do
49
                      = icon('github', text: 'GitHub')
50 51
                %div
                  - if bitbucket_import_enabled?
52 53 54
                    = link_to status_import_bitbucket_path, class: "btn import_bitbucket #{'how_to_import_link' unless bitbucket_import_configured?}", "data-no-turbolink" => "true" do
                      = icon('bitbucket', text: 'Bitbucket')
                    - unless bitbucket_import_configured?
55 56 57
                      = render 'bitbucket_import_modal'
                %div
                  - if gitlab_import_enabled?
58 59 60
                    = link_to status_import_gitlab_path, class: "btn import_gitlab #{'how_to_import_link' unless bitbucket_import_configured?}" do
                      = icon('gitlab', text: 'GitLab.com')
                    - unless gitlab_import_configured?
61 62 63 64
                      = render 'gitlab_import_modal'
                %div
                  - if google_code_import_enabled?
                    = link_to new_import_google_code_path, class: 'btn import_google_code' do
65
                      = icon('google', text: 'Google Code')
66 67 68
                %div
                  - if fogbugz_import_enabled?
                    = link_to new_import_fogbugz_path, class: 'btn import_fogbugz' do
69
                      = icon('bug', text: 'Fogbugz')
70 71 72
                %div
                  - if git_import_enabled?
                    = link_to "#", class: 'btn js-toggle-button import_git' do
73
                      = icon('git', text: 'Repo by URL')
74
                %div{ class: 'import_gitlab_project' }
75
                  - if gitlab_project_import_enabled? && current_user.is_admin?
76
                    = link_to new_import_gitlab_project_path, class: 'btn btn_import_gitlab_project project-submit' do
77
                      = icon('gitlab', text: 'GitLab export')
78 79 80 81 82 83 84 85 86 87 88 89 90

            .js-toggle-content.hide
              = render "shared/import_form", f: f

        .form-group
          = f.label :description, class: 'label-light' do
            Project description
            %span.light (optional)
          = f.text_area :description, placeholder: 'Description format',  class: "form-control", rows: 3, maxlength: 250

        .form-group.project-visibility-level-holder
          = f.label :visibility_level, class: 'label-light' do
            Visibility Level
91
            = link_to "(?)", help_page_path("public_access/public_access")
92
          = render('shared/visibility_radios', model_method: :visibility_level, form: f, selected_level: @project.visibility_level, form_model: @project)
93

D
Dmitriy Zaporozhets 已提交
94
        = f.submit 'Create project', class: "btn btn-create project-submit", tabindex: 4
95
        = link_to 'Cancel', dashboard_projects_path, class: 'btn btn-cancel'
96

97
.save-project-loader.hide
98
  .center
99
    %h2
S
Sullivan SENECHAL 已提交
100
      %i.fa.fa-spinner.fa-spin
101
      Creating project & repository.
D
Dmitriy Zaporozhets 已提交
102
    %p Please wait a moment, this page will automatically refresh when ready.
V
Valery Sizov 已提交
103

104 105 106 107 108
:javascript
  $('.how_to_import_link').bind('click', function (e) {
    e.preventDefault();
    var import_modal = $(this).next(".modal").show();
  });
109

110 111 112
  $('.modal-header .close').bind('click', function() {
    $(".modal").hide();
  });
113

114 115 116
  $('.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());
117
  });
118

119
  $('.btn_import_gitlab_project').attr('disabled',true)
J
James Lopez 已提交
120
  $('.import_gitlab_project').attr('title', 'Project path and name required.');
121 122

  $('.import_gitlab_project').click(function( event ) {
123
    if($('.btn_import_gitlab_project').attr('disabled')) {
124
      event.preventDefault();
J
James Lopez 已提交
125
      new Flash("Please enter path and name for the project to be imported to.");
126 127 128 129 130
    }
  });

  $('#project_path').keyup(function(){
    if($(this).val().length !=0) {
131
      $('.btn_import_gitlab_project').attr('disabled', false);
132 133 134
      $('.import_gitlab_project').attr('title','');
      $(".flash-container").html("")
    } else {
135
      $('.btn_import_gitlab_project').attr('disabled',true);
J
James Lopez 已提交
136
      $('.import_gitlab_project').attr('title', 'Project path and name required.');
137
    }
J
James Lopez 已提交
138 139 140
  });

  $('.import_git').click(function( event ) {
J
James Lopez 已提交
141 142
    $projectImportUrl = $('#project_import_url')
    $projectImportUrl.attr('disabled', !$projectImportUrl.attr('disabled'))
143
  });