edit.html.haml 9.4 KB
Newer Older
1 2 3
.project-edit-container
  .project-edit-errors
  .project-edit-content
4 5
    %div
      %h3.page-title
6
        Project settings
7
      %hr
D
Dmitriy Zaporozhets 已提交
8
      .panel-body
V
Vinnie Okada 已提交
9
        = form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, class: "edit_project form-horizontal" }, authenticity_token: true do |f|
10

11
          %fieldset
D
Dmitriy Zaporozhets 已提交
12
            .form-group.project_name_holder
D
Dmitriy Zaporozhets 已提交
13
              = f.label :name, class: 'control-label' do
D
David Pursehouse 已提交
14
                Project name
D
Dmitriy Zaporozhets 已提交
15
              .col-sm-10
16
                = f.text_field :name, placeholder: "Example Project", class: "form-control", id: "project_name_edit"
17 18


D
Dmitriy Zaporozhets 已提交
19
            .form-group
D
Dmitriy Zaporozhets 已提交
20
              = f.label :description, class: 'control-label' do
21 22
                Project description
                %span.light (optional)
D
Dmitriy Zaporozhets 已提交
23
              .col-sm-10
D
Dmitriy Zaporozhets 已提交
24
                = f.text_area :description, placeholder: "Awesome project", class: "form-control", rows: 3, maxlength: 250
25

26
            - if @project.repository.exists? && @project.repository.branch_names.any?
D
Dmitriy Zaporozhets 已提交
27
              .form-group
D
Dmitriy Zaporozhets 已提交
28
                = f.label :default_branch, "Default Branch", class: 'control-label'
29
                .col-sm-10= f.select(:default_branch, @repository.branch_names, {}, {class: 'select2 select-wide'})
30 31


32
          = render "visibility_level", f: f, visibility_level: @project.visibility_level, can_change_visibility_level: can?(current_user, :change_visibility_level, @project)
33 34 35

          %fieldset.features
            %legend
36
              Tags:
D
Dmitriy Zaporozhets 已提交
37
            .form-group
38
              = f.label :tag_list, "Tags", class: 'control-label'
D
Dmitriy Zaporozhets 已提交
39
              .col-sm-10
40 41
                = f.text_field :tag_list, maxlength: 2000, class: "form-control"
                %p.hint Separate tags with commas.
42 43 44 45

          %fieldset.features
            %legend
              Features:
D
Dmitriy Zaporozhets 已提交
46
            .form-group
47
              = f.label :issues_enabled, "Issues", class: 'control-label'
D
Dmitriy Zaporozhets 已提交
48
              .col-sm-10
D
Dmitriy Zaporozhets 已提交
49 50 51
                .checkbox
                  = f.check_box :issues_enabled
                  %span.descr Lightweight issue tracking system for this project
52

D
Dmitriy Zaporozhets 已提交
53
            .form-group
54
              = f.label :merge_requests_enabled, "Merge Requests", class: 'control-label'
D
Dmitriy Zaporozhets 已提交
55
              .col-sm-10
D
Dmitriy Zaporozhets 已提交
56 57 58
                .checkbox
                  = f.check_box :merge_requests_enabled
                  %span.descr Submit changes to be merged upstream.
59

D
Dmitriy Zaporozhets 已提交
60
            .form-group
61
              = f.label :wiki_enabled, "Wiki", class: 'control-label'
D
Dmitriy Zaporozhets 已提交
62
              .col-sm-10
D
Dmitriy Zaporozhets 已提交
63 64 65
                .checkbox
                  = f.check_box :wiki_enabled
                  %span.descr Pages for project documentation
66

D
Dmitriy Zaporozhets 已提交
67
            .form-group
68
              = f.label :snippets_enabled, "Snippets", class: 'control-label'
D
Dmitriy Zaporozhets 已提交
69
              .col-sm-10
D
Dmitriy Zaporozhets 已提交
70 71 72
                .checkbox
                  = f.check_box :snippets_enabled
                  %span.descr Share code pastes with others out of git repository
73

74 75 76 77 78 79
          %fieldset.features
            %legend
              Project avatar:
            .form-group
              .col-sm-2
              .col-sm-10
80
                - if @project.avatar?
V
Vinnie Okada 已提交
81
                  = project_icon("#{@project.namespace.to_param}/#{@project.to_param}", alt: '', class: 'avatar project-avatar s160')
82 83 84 85 86 87 88 89 90 91 92 93 94 95
                %p.light
                  - if @project.avatar_in_git
                    Project avatar in repository: #{ @project.avatar_in_git }
                %p.light
                  - if @project.avatar?
                    You can change your project avatar here
                  - else
                    You can upload an project avatar here
                %a.choose-btn.btn.btn-small.js-choose-project-avatar-button
                  %i.icon-paper-clip
                  %span Choose File ...
                 
                %span.file_name.js-avatar-filename File name...
                = f.file_field :avatar, class: "js-project-avatar-input hidden"
96
                .light The maximum file size allowed is 200KB.
97 98
                - if @project.avatar?
                  %hr
V
Vinnie Okada 已提交
99
                  = link_to 'Remove avatar', namespace_project_avatar_path(@project.namespace, @project), data: { confirm: "Project avatar will be removed. Are you sure?"}, method: :delete, class: "btn btn-remove btn-small remove-avatar"
100 101

          .form-actions
102
            = f.submit 'Save changes', class: "btn btn-save"
103

104 105


106 107
    .danger-settings
      - if can? current_user, :archive_project, @project
D
Dmitriy Zaporozhets 已提交
108 109 110
        - if @project.archived?
          .panel.panel-success
            .panel-heading
111
              Unarchive project
D
Dmitriy Zaporozhets 已提交
112
            .panel-body
113 114 115 116 117 118
              %p
                Unarchiving the project will mark its repository as active.
                %br
                The project can be committed to.
                %br
                %strong Once active this project shows up in the search and on the dashboard.
V
Vinnie Okada 已提交
119
              = link_to 'Unarchive', unarchive_namespace_project_path(@project.namespace, @project),
120
                  data: { confirm: "Are you sure that you want to unarchive this project?\nWhen this project is unarchived it is active and can be committed to again." },
121
                  method: :post, class: "btn btn-success"
D
Dmitriy Zaporozhets 已提交
122 123 124 125 126
        - else
          .panel.panel-warning
            .panel-heading
              Archive project
            .panel-body
127 128 129 130 131 132
              %p
                Archiving the project will mark its repository as read-only.
                %br
                It is hidden from the dashboard and doesn't show up in searches.
                %br
                %strong Archived projects cannot be committed to!
V
Vinnie Okada 已提交
133
              = link_to 'Archive', archive_namespace_project_path(@project.namespace, @project),
134 135 136 137 138 139 140 141 142
                  data: { confirm: "Are you sure that you want to archive this project?\nAn archived project cannot be committed to." },
                  method: :post, class: "btn btn-warning"
      - else
        .nothing-here-block Only the project owner can archive a project

      .panel.panel-default.panel.panel-warning
        .panel-heading Rename repository
        .errors-holder
        .panel-body
V
Vinnie Okada 已提交
143
          = form_for([@project.namespace.becomes(Namespace), @project], html: { class: 'form-horizontal' }) do |f|
144 145 146 147 148 149
            .form-group.project_name_holder
              = f.label :name, class: 'control-label' do
                Project name
              .col-sm-9
                .form-group
                  = f.text_field :name, placeholder: "Example Project", class: "form-control"
150 151 152 153 154 155
            .form-group
              = f.label :path, class: 'control-label' do
                %span Path
              .col-sm-9
                .form-group
                  .input-group
156 157
                    .input-group-addon
                      #{URI.join(root_url, @project.namespace.path)}/
158 159 160 161 162 163 164 165 166 167 168
                    = f.text_field :path, class: 'form-control'
                    %span.input-group-addon .git
                %ul
                  %li Be careful. Renaming a project's repository can have unintended side effects.
                  %li You will need to update your local repositories to point to the new location.
            .form-actions
              = f.submit 'Rename', class: "btn btn-warning"

      - if can?(current_user, :change_namespace, @project)
        .panel.panel-default.panel.panel-danger
          .panel-heading Transfer project
169 170
          .errors-holder
          .panel-body
V
Vinnie Okada 已提交
171
            = form_for([@project.namespace.becomes(Namespace), @project], url: transfer_namespace_project_path(@project.namespace, @project), method: :put, remote: true, html: { class: 'transfer-project form-horizontal' }) do |f|
172
              .form-group
V
Vinnie Okada 已提交
173
                = label_tag :new_namespace_id, nil, class: 'control-label' do
174 175
                  %span Namespace
                .col-sm-10
176
                  .form-group
V
Vinnie Okada 已提交
177
                    = select_tag :new_namespace_id, namespaces_options(@project.namespace_id), { prompt: 'Choose a project namespace', class: 'select2' }
178
                  %ul
179 180
                    %li Be careful. Changing the project's namespace can have unintended side effects.
                    %li You can only transfer the project to namespaces you manage.
181 182
                    %li You will need to update your local repositories to point to the new location.
              .form-actions
183
                = f.submit 'Transfer', class: "btn btn-remove js-confirm-danger", data: { "confirm-danger-message" => transfer_project_message(@project) }
184 185
      - else
        .nothing-here-block Only the project owner can transfer a project
186

187 188 189 190
      - if can?(current_user, :remove_project, @project)
        .panel.panel-default.panel.panel-danger
          .panel-heading Remove project
          .panel-body
V
Vinnie Okada 已提交
191
            = form_tag(namespace_project_path(@project.namespace, @project), method: :delete, html: { class: 'form-horizontal'}) do
192 193 194 195
              %p
                Removing the project will delete its repository and all related resources including issues, merge requests etc.
                %br
                %strong Removed projects cannot be restored!
196

197
              = link_to 'Remove project', '#', class: "btn btn-remove js-confirm-danger", data: { "confirm-danger-message" => remove_project_message(@project) }
198 199
      - else
        .nothing-here-block Only project owner can remove a project
200

201
.save-project-loader.hide
202
  .center
203
    %h2
S
Sullivan SENECHAL 已提交
204
      %i.fa.fa-spinner.fa-spin
205
      Saving project.
D
Dmitriy Zaporozhets 已提交
206
    %p Please wait a moment, this page will automatically refresh when ready.
207 208 209


= render 'shared/confirm_modal', phrase: @project.path