summaryrefslogtreecommitdiff
path: root/app/views/projects/edit.html.haml
blob: d237384cee6796b0a09985699f36fb5053e668b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
.project-edit-container.prepend-top-default
  .project-edit-errors
  .project-edit-content
    .panel.panel-default
      .panel-heading
        Project settings
      .panel-body
        = form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, class: "edit_project form-horizontal fieldset-form" }, authenticity_token: true do |f|

          %fieldset
            .form-group.project_name_holder
              = f.label :name, class: 'control-label' do
                Project name
              .col-sm-10
                = f.text_field :name, class: "form-control", id: "project_name_edit"


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

            - unless @project.empty_repo?
              .form-group
                = f.label :default_branch, "Default Branch", class: 'control-label'
                .col-sm-10= f.select(:default_branch, @project.repository.branch_names, {}, {class: 'select2 select-wide'})


          = render 'shared/visibility_level', f: f, visibility_level: @project.visibility_level, can_change_visibility_level: can_change_visibility_level?(@project, current_user), form_model: @project

          .form-group
            = f.label :tag_list, "Tags", class: 'control-label'
            .col-sm-10
              = f.text_field :tag_list, value: @project.tag_list.to_s, maxlength: 2000, class: "form-control"
              %p.help-block Separate tags with commas.

          %fieldset.features
            %legend
              Features:
            .form-group
              .col-sm-offset-2.col-sm-10
                .checkbox
                  = f.label :issues_enabled do
                    = f.check_box :issues_enabled
                    %strong Issues
                    %br
                    %span.descr Lightweight issue tracking system for this project

            .form-group
              .col-sm-offset-2.col-sm-10
                .checkbox
                  = f.label :merge_requests_enabled do
                    = f.check_box :merge_requests_enabled
                    %strong Merge Requests
                    %br
                    %span.descr Submit changes to be merged upstream

            .form-group
              .col-sm-offset-2.col-sm-10
                .checkbox
                  = f.label :builds_enabled do
                    = f.check_box :builds_enabled
                    %strong Builds
                    %br
                    %span.descr Test and deploy your changes before merge

            .form-group
              .col-sm-offset-2.col-sm-10
                .checkbox
                  = f.label :wiki_enabled do
                    = f.check_box :wiki_enabled
                    %strong Wiki
                    %br
                    %span.descr Pages for project documentation

            .form-group
              .col-sm-offset-2.col-sm-10
                .checkbox
                  = f.label :snippets_enabled do
                    = f.check_box :snippets_enabled
                    %strong Snippets
                    %br
                    %span.descr Share code pastes with others out of git repository

          = render 'builds_settings', f: f

          %fieldset.features
            %legend
              Project avatar:
            .form-group
              .col-sm-offset-2.col-sm-10
                - if @project.avatar?
                  = project_icon("#{@project.namespace.to_param}/#{@project.to_param}", alt: '', class: 'avatar project-avatar s160')
                %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 a project avatar here
                %a.choose-btn.btn.btn-sm.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"
                .light The maximum file size allowed is 200KB.
                - if @project.avatar?
                  %hr
                  = 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-sm remove-avatar"


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



    .danger-settings
      .panel.panel-default
        .panel-heading Housekeeping
        .errors-holder
        .panel-body
          %p
            Runs a number of housekeeping tasks within the current repository,
            such as compressing file revisions and removing unreachable objects.
            %br

          .form-actions
            = link_to 'Housekeeping', housekeeping_namespace_project_path(@project.namespace, @project),
                method: :post, class: "btn btn-default"

      - if can? current_user, :archive_project, @project
        - if @project.archived?
          .panel.panel-success
            .panel-heading
              Unarchive project
            .panel-body
              %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.

              .form-actions
                = link_to 'Unarchive project', unarchive_namespace_project_path(@project.namespace, @project),
                    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." },
                    method: :post, class: "btn btn-success"
        - else
          .panel.panel-warning
            .panel-heading
              Archive project
            .panel-body
              %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!

              .form-actions
                = link_to 'Archive project', archive_namespace_project_path(@project.namespace, @project),
                    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
          = form_for([@project.namespace.becomes(Namespace), @project], html: { class: 'form-horizontal' }) do |f|
            .form-group.project_name_holder
              = f.label :name, class: 'control-label' do
                Project name
              .col-sm-9
                .form-group
                  = f.text_field :name, class: "form-control"
            .form-group
              = f.label :path, class: 'control-label' do
                %span Path
              .col-sm-9
                .form-group
                  .input-group
                    .input-group-addon
                      #{URI.join(root_url, @project.namespace.path)}/
                    = f.text_field :path, class: 'form-control'
                %ul
                  %li 请小心。重命名项目仓库可能有意想不到的副作用。
                  %li 需要更新本地版本仓库指向新位置。
            .form-actions
              = f.submit '重命名项目', class: "btn btn-warning"

      - if can?(current_user, :change_namespace, @project)
        .panel.panel-default.panel.panel-danger
          .panel-heading 转移项目
          .errors-holder
          .panel-body
            = 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|
              .form-group
                = label_tag :new_namespace_id, nil, class: 'control-label' do
                  %span 命名空间
                .col-sm-9
                  .form-group
                    = select_tag :new_namespace_id, namespaces_options(@project.namespace_id), { prompt: '选择项目命名空间', class: 'select2' }
                  %ul
                    %li 请注意:更改项目的命名空间可能有意想不到的副作用。
                    %li 只能将项目转移到能管理到的命名空间。
                    %li 需要更新本地版本仓库指向新位置。
              .form-actions
                = f.submit '转移项目', class: "btn btn-remove js-confirm-danger", data: { "confirm-danger-message" => transfer_project_message(@project) }
      - else
        .nothing-here-block 只有项目所有者才能转移项目。

      - if @project.forked?
        - if can?(current_user, :remove_fork_project, @project)
          = form_for([@project.namespace.becomes(Namespace), @project], url: remove_fork_namespace_project_path(@project.namespace, @project), method: :delete, remote: true, html: { class: 'transfer-project form-horizontal' }) do |f|
            .panel.panel-default.panel.panel-danger
              .panel-heading 删除派生关系
              .panel-body
                %p
                  将删除从源项目
                  #{link_to @project.forked_from_project.name_with_namespace, project_path(@project.forked_from_project)} 的派生关系。
                  %br
                  %strong 一旦删除,派生关系无法恢复;也将无法在提交合并请求到源项目。
                .form-actions
                  = button_to '删除派生关系', '#', class: "btn btn-remove js-confirm-danger", data: { "confirm-danger-message" => remove_fork_project_message(@project) }
        - else
          .nothing-here-block 只有项目所有者才能删除派生关系。

      - if can?(current_user, :remove_project, @project)
        .panel.panel-default.panel.panel-danger
          .panel-heading 删除项目
          .panel-body
            = form_tag(namespace_project_path(@project.namespace, @project), method: :delete, class: 'form-horizontal') do
              %p
                删除项目将删除其版本仓库及所有相关资源,包括问题,合并请求等。
                %br
                %strong 删除项目无法恢复!
              .form-actions
                = button_to '删除项目', '#', class: "btn btn-remove js-confirm-danger", data: { "confirm-danger-message" => remove_project_message(@project) }
      - else
        .nothing-here-block 只有项目所有者才能删除项目。


.save-project-loader.hide
  .center
    %h2
      %i.fa.fa-spinner.fa-spin
      正在保存项目。
    %p 请稍等片刻,页面会在准备好后自动刷新。


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