gitlab-ce/app/views/projects/_new_project_fields.html.haml

122 lines
8.1 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

- visibility_level = selected_visibility_level(@project, params.dig(:project, :visibility_level))
- ci_cd_only = local_assigns.fetch(:ci_cd_only, false)
- hide_init_with_readme = local_assigns.fetch(:hide_init_with_readme, false)
- include_description = local_assigns.fetch(:include_description, true)
- track_label = local_assigns.fetch(:track_label, 'blank_project')
- display_sha256_repository = Feature.enabled?(:support_sha256_repositories, current_user)
.row{ id: project_name_id }
= f.hidden_field :ci_cd_only, value: ci_cd_only
.form-group.gl-form-group.project-name.col-sm-12
= f.label :name, class: 'label-bold' do
%span= _("Project name")
= f.text_field :name, placeholder: s_('ProjectsNew|My project'), class: "form-control gl-form-input input-lg", data: { testid: 'project-name', track_label: "#{track_label}", track_action: "activate_form_input", track_property: "project_name", track_value: "" }, required: true, aria: { required: true, describedby: 'js-project-name-description' }
%small#js-project-name-description.form-text.gl-text-subtle
= s_("ProjectsNew|Must start with a lowercase or uppercase letter, digit, emoji, or underscore. Can also contain dots, pluses, dashes, or spaces.")
#js-project-name-error.gl-field-error.gl-mt-2.gl-hidden
.form-group.gl-form-group.gl-w-full.gl-flex.gl-flex-wrap
.form-group.project-path.col-sm-6.gl-pr-0
= f.label :namespace_id, class: 'label-bold' do
%span= _('Project URL')
.input-group.gl-flex-nowrap
- if current_user.can_select_namespace?
- namespace_id = namespace_id_from(params)
.js-vue-new-project-url-select{ data: { namespace_full_path: GroupFinder.new(current_user).execute(id: namespace_id)&.full_path || @current_user_group&.full_path,
namespace_id: namespace_id || @current_user_group&.id,
input_id: 'project_namespace_id',
input_name: 'project[namespace_id]',
root_url: root_url,
track_label: track_label,
user_namespace_id: current_user.namespace_id } }
- else
.input-group-prepend.static-namespace.flex-shrink-0.has-tooltip{ title: user_url(current_user.username) + '/' }
.input-group-text.border-0
#{user_url(current_user.username)}/
= f.hidden_field :namespace_id, value: current_user.namespace_id
.gl-self-center.gl-pl-5 /
.form-group.project-path.col-sm-6
= f.label :path, class: 'label-bold' do
%span= _("Project slug")
= f.text_field :path, placeholder: "my-awesome-project", class: "form-control gl-form-input", required: true, aria: { required: true }, data: { testid: 'project-path', username: current_user.username }
.js-group-namespace-error.gl-my-3.gl-text-danger.gl-hidden.col-12
= s_('ProjectsNew|Pick a group or namespace where you want to create this project.')
.js-user-readme-repo.gl-my-3.gl-hidden.col-12
= render Pajamas::AlertComponent.new(dismissible: false,
variant: :success) do |c|
- c.with_body do
- help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('user/profile/_index.md', anchor: 'add-details-to-your-profile-with-a-readme') }
= html_escape(_('%{project_path} is a project that you can use to add a README to your GitLab profile. Create a public project and initialize the repository with a README to get started. %{help_link_start}Learn more%{help_link_end}.')) % { project_path: "<strong>#{current_user.username} / #{current_user.username}</strong>".html_safe, help_link_start: help_link_start, help_link_end: '</a>'.html_safe }
- if include_description
.form-group
= f.label :description, class: 'label-bold' do
= s_('ProjectsNew|Project description %{tag_start}(optional)%{tag_end}').html_safe % { tag_start: '<span>'.html_safe, tag_end: '</span>'.html_safe }
= f.text_area :description,
placeholder: s_('ProjectsNew|Description format'),
class: "form-control gl-form-input",
rows: 3,
maxlength: 250,
data: { testid: 'project-description',
track_label: track_label,
track_action: "activate_form_input",
track_property: "project_description" }
- unless Gitlab::CurrentSettings.current_application_settings.hide_third_party_offers? || !Gitlab.com?
.js-deployment-target-select
.form-group.gl-form-group
= f.label :visibility_level, class: 'label-bold' do
= s_('ProjectsNew|Visibility Level')
= link_to sprite_icon('question-o'), help_page_path('user/public_access.md'), aria: { label: 'Documentation for Visibility Level' }, target: '_blank', rel: 'noopener noreferrer'
= render 'shared/visibility_level', f: f, visibility_level: visibility_level.to_i, can_change_visibility_level: true, form_model: @project, with_label: false, data: { testid: 'visibility-radios'}
- if !hide_init_with_readme
= f.label :project_configuration, class: 'label-bold' do
= s_('ProjectsNew|Project Configuration')
.form-group
= render Pajamas::CheckboxTagComponent.new(name: 'project[initialize_with_readme]',
checked: true,
checkbox_options: { data: { testid: 'initialize-with-readme-checkbox', track_label: track_label, track_action: 'activate_form_input', track_property: 'init_with_readme' } }) do |c|
- c.with_label do
= s_('ProjectsNew|Initialize repository with a README')
- c.with_help_text do
= s_('ProjectsNew|Allows you to immediately clone this projects repository. Skip this if you plan to push up an existing repository.')
.form-group
= render Pajamas::CheckboxTagComponent.new(name: 'project[initialize_with_sast]',
checkbox_options: { data: { testid: 'initialize-with-sast-checkbox', track_label: track_label, track_action: 'activate_form_input', track_property: 'init_with_sast' } }) do |c|
- c.with_label do
= s_('ProjectsNew|Enable Static Application Security Testing (SAST)')
- c.with_help_text do
= s_('ProjectsNew|Analyze your source code for known security vulnerabilities.')
= link_to _('Learn more.'), help_page_path('user/application_security/sast/_index.md'), target: '_blank', rel: 'noopener noreferrer', data: { track_action: 'followed' }
.form-group
= render Pajamas::CheckboxTagComponent.new(name: 'project[initialize_with_secret_detection]',
checkbox_options: { data: { testid: 'initialize-with-secret-detection-checkbox' } }) do |c|
- c.with_label do
= s_('ProjectsNew|Enable Secret Detection')
- c.with_help_text do
= s_('ProjectsNew|Scan your code for secrets and credentials to prevent unauthorized access.')
= link_to _('Learn more.'), help_page_path('user/application_security/secret_detection/_index.md'), target: '_blank', rel: 'noopener noreferrer'
- if display_sha256_repository
#js-experimental-setting-accordion.form-group.gl-mb-6
= render Pajamas::AccordionItemComponent.new(title: s_("ProjectsNew|Experimental settings"), state: :closed) do
= render Pajamas::CheckboxTagComponent.new(name: 'project[use_sha256_repository]') do |c|
- c.with_label do
= s_('ProjectsNew|Use SHA-256 for repository hashing algorithm')
= render_if_exists 'shared/experimental_badge_tag'
- c.with_help_text do
= s_("ProjectsNew|Might break existing functionality with other repositories or APIs. It's not possible to change SHA-256 repositories back to the default SHA-1 hashing algorithm.")
-# this partial is from JiHu, see details in https://jihulab.com/gitlab-cn/gitlab/-/merge_requests/675
= render_if_exists 'shared/other_project_options', f: f, visibility_level: visibility_level, track_label: track_label
.gl-flex.gl-gap-3
= f.submit _('Create project'), class: "js-create-project-button", data: { testid: 'project-create-button', track_label: "#{track_label}", track_action: "click_button", track_property: "create_project", track_value: "" }, pajamas_button: true
= link_button_to _('Cancel'), @parent_group || dashboard_groups_path, data: { track_label: "#{track_label}", track_action: "click_button", track_property: "cancel", track_value: "" }