Commit e605d8c9 authored by Clement Ho's avatar Clement Ho

Merge branch 'proj-settings-ok-leftovers' into 'master'

CE Improve project settings page (leftovers)

See merge request gitlab-org/gitlab-ce!27078
parents dc884879 e690fccb
import _ from 'underscore'; import _ from 'underscore';
import $ from 'jquery';
class DirtySubmitForm { class DirtySubmitForm {
constructor(form) { constructor(form) {
...@@ -26,6 +27,7 @@ class DirtySubmitForm { ...@@ -26,6 +27,7 @@ class DirtySubmitForm {
); );
this.form.addEventListener('input', throttledUpdateDirtyInput); this.form.addEventListener('input', throttledUpdateDirtyInput);
this.form.addEventListener('change', throttledUpdateDirtyInput); this.form.addEventListener('change', throttledUpdateDirtyInput);
$(this.form).on('change.select2', throttledUpdateDirtyInput);
this.form.addEventListener('submit', event => this.formSubmit(event)); this.form.addEventListener('submit', event => this.formSubmit(event));
} }
......
...@@ -3,17 +3,24 @@ import initSettingsPanels from '~/settings_panels'; ...@@ -3,17 +3,24 @@ import initSettingsPanels from '~/settings_panels';
import setupProjectEdit from '~/project_edit'; import setupProjectEdit from '~/project_edit';
import initConfirmDangerModal from '~/confirm_danger_modal'; import initConfirmDangerModal from '~/confirm_danger_modal';
import mountBadgeSettings from '~/pages/shared/mount_badge_settings'; import mountBadgeSettings from '~/pages/shared/mount_badge_settings';
import dirtySubmitFactory from '~/dirty_submit/dirty_submit_factory';
import initAvatarPicker from '~/avatar_picker'; import initAvatarPicker from '~/avatar_picker';
import initProjectLoadingSpinner from '../shared/save_project_loader'; import initProjectLoadingSpinner from '../shared/save_project_loader';
import initProjectPermissionsSettings from '../shared/permissions'; import initProjectPermissionsSettings from '../shared/permissions';
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
initProjectLoadingSpinner();
setupProjectEdit();
// Initialize expandable settings panels
initSettingsPanels();
initAvatarPicker(); initAvatarPicker();
initProjectPermissionsSettings();
initConfirmDangerModal(); initConfirmDangerModal();
initSettingsPanels();
mountBadgeSettings(PROJECT_BADGE); mountBadgeSettings(PROJECT_BADGE);
initProjectLoadingSpinner();
initProjectPermissionsSettings();
setupProjectEdit();
dirtySubmitFactory(
document.querySelectorAll(
'.js-general-settings-form, .js-mr-settings-form, .js-mr-approvals-form',
),
);
}); });
...@@ -157,6 +157,10 @@ label { ...@@ -157,6 +157,10 @@ label {
padding-left: 10px; padding-left: 10px;
padding-right: 10px; padding-right: 10px;
appearance: none; appearance: none;
/* stylelint-disable property-no-vendor-prefix */
-webkit-appearance: none;
-moz-appearance: none;
/* stylelint-enable property-no-vendor-prefix */
&::-ms-expand { &::-ms-expand {
display: none; display: none;
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
.settings-header { .settings-header {
position: relative; position: relative;
padding: 20px 110px 10px 0; padding: 20px 110px 0 0;
h4 { h4 {
margin-top: 0; margin-top: 0;
......
- if ::Gitlab::ExternalAuthorization.enabled? - if ::Gitlab::ExternalAuthorization.enabled?
.form-group .form-group.col-md-9
= f.label :external_authorization_classification_label, class: 'label-bold' do = f.label :external_authorization_classification_label, _('Classification Label (optional)'), class: 'label-bold'
= s_('ExternalAuthorizationService|Classification Label')
%span.light (optional)
= f.text_field :external_authorization_classification_label, class: "form-control" = f.text_field :external_authorization_classification_label, class: "form-control"
%span.form-text.text-muted %span.form-text.text-muted
= external_classification_label_help_message = external_classification_label_help_message
- return unless Gitlab::CurrentSettings.project_export_enabled? - return unless Gitlab::CurrentSettings.project_export_enabled?
- project = local_assigns.fetch(:project) - project = local_assigns.fetch(:project)
- expanded = Rails.env.test?
%section.settings.no-animate#js-export-project{ class: ('expanded' if expanded) } .sub-section
.settings-header %h4= _('Export project')
%h4 %p= _('Export this project with all its related data in order to move your project to a new GitLab instance. Once the export is finished, you can import the file from the "New Project" page.')
Export project
%button.btn.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand'
%p
Export this project with all its related data in order to move your project to a new GitLab instance. Once the export is finished, you can import the file from the "New Project" page.
.settings-content
.bs-callout.bs-callout-info .bs-callout.bs-callout-info
%p.append-bottom-0 %p.append-bottom-0
%p %p= _('The following items will be exported:')
The following items will be exported:
%ul %ul
%li Project and wiki repositories %li= _('Project and wiki repositories')
%li Project uploads %li= _('Project uploads')
%li Project configuration, including services %li= _('Project configuration, including services')
%li Issues with comments, merge requests with diffs and comments, labels, milestones, snippets, and other project entities %li= _('Issues with comments, merge requests with diffs and comments, labels, milestones, snippets, and other project entities')
%li LFS objects %li= _('LFS objects')
%p %p= _('The following items will NOT be exported:')
The following items will NOT be exported:
%ul %ul
%li Job traces and artifacts %li= _('Job traces and artifacts')
%li Container registry images %li= _('Container registry images')
%li CI variables %li= _('CI variables')
%li Webhooks %li= _('Webhooks')
%li Any encrypted tokens %li= _('Any encrypted tokens')
%p %p= _('Once the exported file is ready, you will receive a notification email with a download link, or you can download it from this page.')
Once the exported file is ready, you will receive a notification email with a download link, or you can download it from this page.
- if project.export_status == :finished - if project.export_status == :finished
= link_to 'Download export', download_export_project_path(project), = link_to _('Download export'), download_export_project_path(project),
rel: 'nofollow', download: '', method: :get, class: "btn btn-default" rel: 'nofollow', download: '', method: :get, class: "btn btn-default"
= link_to 'Generate new export', generate_new_export_project_path(project), = link_to _('Generate new export'), generate_new_export_project_path(project),
method: :post, class: "btn btn-default" method: :post, class: "btn btn-default"
- else - else
= link_to 'Export project', export_project_path(project), = link_to _('Export project'), export_project_path(project),
method: :post, class: "btn btn-default" method: :post, class: "btn btn-default"
...@@ -3,185 +3,131 @@ ...@@ -3,185 +3,131 @@
- @content_class = "limit-container-width" unless fluid_layout - @content_class = "limit-container-width" unless fluid_layout
- expanded = Rails.env.test? - expanded = Rails.env.test?
.project-edit-container %section.settings.general-settings.no-animate.expanded#js-general-settings
%section.settings.general-settings.no-animate#js-general-project-settings{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only= _('Naming, tags, avatar') %h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only= _('Naming, topics, avatar')
%button.btn.js-settings-toggle{ type: 'button' }= expanded ? _('Collapse') : _('Expand') %button.btn.btn-default.js-settings-toggle{ type: 'button' }= _('Collapse')
%p= _('Update your project name, tags, description and avatar.') %p= _('Update your project name, topics, description and avatar.')
.settings-content= render 'projects/settings/general'
.settings-content %section.settings.sharing-permissions.no-animate#js-shared-permissions{ class: ('expanded' if expanded) }
.project-edit-errors
= form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, class: "edit-project" }, authenticity_token: true do |f|
%input{ name: 'update_section', type: 'hidden', value: 'js-general-project-settings' }
%fieldset
.row
.form-group.col-md-9
= f.label :name, class: 'label-bold', for: 'project_name_edit' do
Project name
= f.text_field :name, class: "form-control", id: "project_name_edit"
.form-group.col-md-3
= f.label :id, class: 'label-bold' do
Project ID
= f.text_field :id, class: 'form-control', readonly: true
.form-group
= f.label :description, class: 'label-bold' do
Project description
%span.light (optional)
= f.text_area :description, class: "form-control", rows: 3, maxlength: 250
= render 'projects/classification_policy_settings', f: f
= render_if_exists 'shared/repository_size_limit_setting', form: f, type: :project
.form-group
= f.label :tag_list, "Topics", class: 'label-bold'
= f.text_field :tag_list, value: @project.tag_list.join(', '), maxlength: 2000, class: "form-control"
%p.form-text.text-muted Separate topics with commas.
.form-group.prepend-top-default.append-bottom-20
.avatar-container.s90
= project_icon(@project, alt: _('Project avatar'), class: 'avatar project-avatar s90')
= f.label :avatar, _('Project avatar'), class: 'label-bold d-block'
= render 'shared/choose_avatar_button', f: f
- if @project.avatar?
%hr
= link_to _('Remove avatar'), project_avatar_path(@project), data: { confirm: _('Avatar will be removed. Are you sure?')}, method: :delete, class: 'btn btn-link'
= f.submit 'Save changes', class: "btn btn-success js-btn-success-general-project-settings"
%section.settings.sharing-permissions.no-animate#js-shared-permissions{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only= _('Visibility, project features, permissions') %h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only= _('Visibility, project features, permissions')
%button.btn.js-settings-toggle{ type: 'button' }= expanded ? _('Collapse') : _('Expand') %button.btn.btn-default.js-settings-toggle{ type: 'button' }= expanded ? _('Collapse') : _('Expand')
%p= _('Choose visibility level, enable/disable project features (issues, repository, wiki, snippets) and set permissions.') %p= _('Choose visibility level, enable/disable project features (issues, repository, wiki, snippets) and set permissions.')
.settings-content .settings-content
= form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, class: "sharing-permissions-form" }, authenticity_token: true do |f| = form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, class: "sharing-permissions-form" }, authenticity_token: true do |f|
%input{ name: 'update_section', type: 'hidden', value: 'js-shared-permissions' } %input{ name: 'update_section', type: 'hidden', value: 'js-shared-permissions' }
-# haml-lint:disable InlineJavaScript %template.js-project-permissions-form-data{ type: "application/json" }= project_permissions_panel_data_json(@project)
%script.js-project-permissions-form-data{ type: "application/json" }= project_permissions_panel_data_json(@project)
.js-project-permissions-form .js-project-permissions-form
= f.submit 'Save changes', class: "btn btn-success" = f.submit _('Save changes'), class: "btn btn-success"
= render_if_exists 'projects/issues_settings'
%section.qa-merge-request-settings.settings.merge-requests-feature.no-animate#js-merge-request-settings{ class: [('expanded' if expanded), ('hidden' if @project.project_feature.send(:merge_requests_access_level) == 0)] } %section.qa-merge-request-settings.settings.merge-requests-feature.no-animate#js-merge-request-settings{ class: [('expanded' if expanded), ('hidden' if @project.project_feature.send(:merge_requests_access_level) == 0)] }
.settings-header .settings-header
%h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only= _('Merge requests') %h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only= _('Merge requests')
%button.btn.js-settings-toggle{ type: 'button' }= expanded ? _('Collapse') : _('Expand') %button.btn.btn-default.js-settings-toggle{ type: 'button' }= expanded ? _('Collapse') : _('Expand')
%p= _('Choose your merge method, set up a default merge request description template.') %p= _('Choose your merge method, set up a default merge request description template.')
.settings-content .settings-content
= render_if_exists 'shared/promotions/promote_mr_features' = render_if_exists 'shared/promotions/promote_mr_features'
= form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, class: "merge-request-settings-form" }, authenticity_token: true do |f| = form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, class: "merge-request-settings-form js-mr-settings-form" }, authenticity_token: true do |f|
%input{ name: 'update_section', type: 'hidden', value: 'js-merge-request-settings' } %input{ name: 'update_section', type: 'hidden', value: 'js-merge-request-settings' }
= render 'projects/merge_request_settings', form: f = render 'projects/merge_request_settings', form: f
= f.submit 'Save changes', class: "btn btn-success qa-save-merge-request-changes" = f.submit _('Save changes'), class: "btn btn-success qa-save-merge-request-changes"
= render_if_exists 'projects/merge_request_approvals_settings', expanded: expanded = render_if_exists 'projects/merge_request_approvals_settings', expanded: expanded
%section.settings.no-animate{ class: ('expanded' if expanded) } %section.settings.no-animate{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only %h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only
= s_('ProjectSettings|Badges') = s_('ProjectSettings|Badges')
%button.btn.js-settings-toggle{ type: 'button' } %button.btn.btn-default.js-settings-toggle{ type: 'button' }
= expanded ? 'Collapse' : 'Expand' = expanded ? _('Collapse') : _('Expand')
%p %p
= s_('ProjectSettings|Customize your project badges.') = s_('ProjectSettings|Customize your project badges.')
= link_to s_('ProjectSettings|Learn more about badges.'), help_page_path('user/project/badges') = link_to s_('ProjectSettings|Learn more about badges.'), help_page_path('user/project/badges')
.settings-content .settings-content
= render 'shared/badges/badge_settings' = render 'shared/badges/badge_settings'
= render_if_exists 'projects/service_desk_settings' = render_if_exists 'projects/settings/default_issue_template'
= render 'export', project: @project
%section.qa-advanced-settings.settings.advanced-settings.no-animate#js-project-advanced-settings{ class: ('expanded' if expanded) } = render_if_exists 'projects/service_desk_settings'
%section.qa-advanced-settings.settings.advanced-settings.no-animate#js-project-advanced-settings{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only= _('Advanced') %h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only= _('Advanced')
%button.btn.js-settings-toggle{ type: 'button' }= expanded ? _('Collapse') : _('Expand') %button.btn.btn-default.js-settings-toggle{ type: 'button' }= expanded ? _('Collapse') : _('Expand')
%p= _('Housekeeping, export, path, transfer, remove, archive.') %p= _('Housekeeping, export, path, transfer, remove, archive.')
.settings-content .settings-content
.sub-section .sub-section
%h4 Housekeeping %h4= _('Housekeeping')
%p %p= _('Runs a number of housekeeping tasks within the current repository, such as compressing file revisions and removing unreachable objects.')
Runs a number of housekeeping tasks within the current repository, such as compressing file revisions and removing unreachable objects. = link_to _('Run housekeeping'), housekeeping_project_path(@project),
= link_to 'Run housekeeping', housekeeping_project_path(@project),
method: :post, class: "btn btn-default" method: :post, class: "btn btn-default"
= render 'export', project: @project
- if can? current_user, :archive_project, @project - if can? current_user, :archive_project, @project
.sub-section .sub-section
%h4.warning-title %h4.warning-title
- if @project.archived? - if @project.archived?
Unarchive project = _('Unarchive project')
- else - else
Archive project = _('Archive project')
- if @project.archived? - if @project.archived?
%p %p= _("Unarchiving the project will restore people's ability to make changes to it. The repository can be committed to, and issues, comments and other entities can be created. <strong>Once active this project shows up in the search and on the dashboard.</strong>").html_safe
Unarchiving the project will restore people's ability to make changes to it. = link_to _('Unarchive project'), unarchive_project_path(@project),
The repository can be committed to, and issues, comments and other entities can be created. data: { confirm: _("Are you sure that you want to unarchive this project?") },
%strong Once active this project shows up in the search and on the dashboard.
= link_to 'Unarchive project', unarchive_project_path(@project),
data: { confirm: "Are you sure that you want to unarchive this project?" },
method: :post, class: "btn btn-success" method: :post, class: "btn btn-success"
- else - else
%p %p= _("Archiving the project will make it entirely read-only. It is hidden from the dashboard and doesn't show up in searches. <strong>The repository cannot be committed to, and no issues, comments or other entities can be created.</strong>").html_safe
Archiving the project will make it entirely read-only. It is hidden from the dashboard and doesn't show up in searches. = link_to _('Archive project'), archive_project_path(@project),
%strong The repository cannot be committed to, and no issues, comments or other entities can be created. data: { confirm: _("Are you sure that you want to archive this project?") },
= link_to 'Archive project', archive_project_path(@project),
data: { confirm: "Are you sure that you want to archive this project?" },
method: :post, class: "btn btn-warning" method: :post, class: "btn btn-warning"
.sub-section.rename-repository .sub-section.rename-repository
%h4.warning-title %h4.warning-title= _('Change path')
Rename repository
= render 'projects/errors' = render 'projects/errors'
= form_for([@project.namespace.becomes(Namespace), @project]) do |f| = form_for([@project.namespace.becomes(Namespace), @project]) do |f|
.form-group.project_name_holder
= f.label :name, class: 'label-bold' do
Project name
.form-group .form-group
= f.text_field :name, class: "form-control" = f.label :path, _('Path'), class: 'label-bold'
.form-group
= f.label :path, class: 'label-bold' do
%span Path
.form-group .form-group
.input-group .input-group
.input-group-prepend .input-group-prepend
.input-group-text .input-group-text
#{Gitlab::Utils.append_path(root_url, @project.namespace.full_path)}/ #{Gitlab::Utils.append_path(root_url, @project.namespace.full_path)}/
= f.text_field :path, class: 'form-control' = f.text_field :path, class: 'form-control qa-project-path-field h-auto'
%ul %ul
%li Be careful. Renaming a project's repository can have unintended side effects. %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. %li= _('You will need to update your local repositories to point to the new location.')
- if @project.deployment_platform.present? - if @project.deployment_platform.present?
%li Your deployment services will be broken, you will need to manually fix the services after renaming. %li= _('Your deployment services will be broken, you will need to manually fix the services after renaming.')
= f.submit 'Rename project', class: "btn btn-warning" = f.submit _('Change path'), class: "btn btn-warning qa-change-path-button"
- if can?(current_user, :change_namespace, @project) - if can?(current_user, :change_namespace, @project)
.sub-section .sub-section
%h4.danger-title %h4.danger-title= _('Transfer project')
Transfer project
= form_for([@project.namespace.becomes(Namespace), @project], url: transfer_project_path(@project), method: :put, remote: true, html: { class: 'js-project-transfer-form' } ) do |f| = form_for([@project.namespace.becomes(Namespace), @project], url: transfer_project_path(@project), method: :put, remote: true, html: { class: 'js-project-transfer-form' } ) do |f|
.form-group .form-group
= label_tag :new_namespace_id, nil, class: 'label-bold' do = label_tag :new_namespace_id, nil, class: 'label-bold' do
%span Select a new namespace %span= _('Select a new namespace')
.form-group .form-group
= select_tag :new_namespace_id, namespaces_options(nil), include_blank: true, class: 'select2' = select_tag :new_namespace_id, namespaces_options(nil), include_blank: true, class: 'select2'
%ul %ul
%li Be careful. Changing the project's namespace can have unintended side effects. %li= _("Be careful. Changing the project's namespace can have unintended side effects.")
%li You can only transfer the project to namespaces you manage. %li= _('You can only transfer the project to namespaces you manage.')
%li You will need to update your local repositories to point to the new location. %li= _('You will need to update your local repositories to point to the new location.')
%li Project visibility level will be changed to match namespace rules when transferring to a group. %li= _('Project visibility level will be changed to match namespace rules when transferring to a group.')
= f.submit 'Transfer project', class: "btn btn-remove js-confirm-danger", data: { "confirm-danger-message" => transfer_project_message(@project) } = f.submit 'Transfer project', class: "btn btn-remove js-confirm-danger", data: { "confirm-danger-message" => transfer_project_message(@project) }
- if @project.forked? && can?(current_user, :remove_fork_project, @project) - if @project.forked? && can?(current_user, :remove_fork_project, @project)
.sub-section .sub-section
%h4.danger-title %h4.danger-title= _('Remove fork relationship')
Remove fork relationship
%p %p
This will remove the fork relationship to source project = _('This will remove the fork relationship to source project')
= succeed "." do = succeed "." do
- if @project.fork_source - if @project.fork_source
= link_to(fork_source_name(@project), project_path(@project.fork_source)) = link_to(fork_source_name(@project), project_path(@project.fork_source))
...@@ -189,24 +135,23 @@ ...@@ -189,24 +135,23 @@
= fork_source_name(@project) = fork_source_name(@project)
= form_for([@project.namespace.becomes(Namespace), @project], url: remove_fork_project_path(@project), method: :delete, remote: true, html: { class: 'transfer-project' }) do |f| = form_for([@project.namespace.becomes(Namespace), @project], url: remove_fork_project_path(@project), method: :delete, remote: true, html: { class: 'transfer-project' }) do |f|
%p %p
%strong Once removed, the fork relationship cannot be restored and you will no longer be able to send merge requests to the source. %strong= _('Once removed, the fork relationship cannot be restored and you will no longer be able to send merge requests to the source.')
= button_to 'Remove fork relationship', '#', class: "btn btn-remove js-confirm-danger", data: { "confirm-danger-message" => remove_fork_project_message(@project) } = button_to _('Remove fork relationship'), '#', class: "btn btn-remove js-confirm-danger", data: { "confirm-danger-message" => remove_fork_project_message(@project) }
- if can?(current_user, :remove_project, @project) - if can?(current_user, :remove_project, @project)
.sub-section .sub-section
%h4.danger-title %h4.danger-title= _('Remove project')
Remove project %p= _('Removing the project will delete its repository and all related resources including issues, merge requests etc.')
%p
Removing the project will delete its repository and all related resources including issues, merge requests etc.
= form_tag(project_path(@project), method: :delete) do = form_tag(project_path(@project), method: :delete) do
%p %p
%strong Removed projects cannot be restored! %strong= _('Removed projects cannot be restored!')
= button_to 'Remove project', '#', class: "btn btn-remove js-confirm-danger", data: { "confirm-danger-message" => remove_project_message(@project) } = button_to _('Remove project'), '#', class: "btn btn-remove js-confirm-danger", data: { "confirm-danger-message" => remove_project_message(@project) }
.save-project-loader.hide .save-project-loader.hide
.center .center
%h2 %h2
%i.fa.fa-spinner.fa-spin %i.fa.fa-spinner.fa-spin
Saving project. = _('Saving project.')
%p Please wait a moment, this page will automatically refresh when ready. %p= _('Please wait a moment, this page will automatically refresh when ready.')
= render 'shared/confirm_modal', phrase: @project.path = render 'shared/confirm_modal', phrase: @project.path
= form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, class: "edit-project js-general-settings-form" }, authenticity_token: true do |f|
%input{ name: 'update_section', type: 'hidden', value: 'js-general-settings' }
= form_errors(@project)
%fieldset
.row
.form-group.col-md-5
= f.label :name, class: 'label-bold', for: 'project_name_edit' do
= _('Project name')
= f.text_field :name, class: 'form-control qa-project-name-field', id: "project_name_edit"
.form-group.col-md-7
= f.label :id, class: 'label-bold' do
= _('Project ID')
= f.text_field :id, class: 'form-control w-auto', readonly: true
.row
.form-group.col-md-9
= f.label :tag_list, _('Topics'), class: 'label-bold'
= f.text_field :tag_list, value: @project.tag_list.join(', '), maxlength: 2000, class: "form-control"
%p.form-text.text-muted= _('Separate topics with commas.')
.row
.form-group.col-md-9
= f.label :description, _('Project description (optional)'), class: 'label-bold'
= f.text_area :description, class: 'form-control', rows: 3, maxlength: 250
.row= render_if_exists 'projects/classification_policy_settings', f: f
.row= render_if_exists 'shared/repository_size_limit_setting', form: f, type: :project
.form-group.prepend-top-default.append-bottom-20
.avatar-container.s90
= project_icon(@project, alt: _('Project avatar'), class: 'avatar project-avatar s90')
= f.label :avatar, _('Project avatar'), class: 'label-bold d-block'
= render 'shared/choose_avatar_button', f: f
- if @project.avatar?
%hr
= link_to _('Remove avatar'), project_avatar_path(@project), data: { confirm: _('Avatar will be removed. Are you sure?')}, method: :delete, class: 'btn btn-link'
= f.submit _('Save changes'), class: "btn btn-success mt-4 qa-save-naming-topics-avatar-button"
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
.modal-dialog .modal-dialog
.modal-content .modal-content
.modal-header .modal-header
%h3.page-title %h3.page-title= _('Confirmation required')
Confirmation required
%button.close{ type: "button", "data-dismiss": "modal", "aria-label" => _('Close') } %button.close{ type: "button", "data-dismiss": "modal", "aria-label" => _('Close') }
%span{ "aria-hidden": true } &times; %span{ "aria-hidden": true } &times;
...@@ -11,8 +10,7 @@ ...@@ -11,8 +10,7 @@
%p.text-danger.js-confirm-text %p.text-danger.js-confirm-text
%p %p
This action can lead to data loss. %span.js-warning-text= _('This action can lead to data loss. To prevent accidental actions we ask you to confirm your intention.')
To prevent accidental actions we ask you to confirm your intention.
%br %br
Please type Please type
%code.js-confirm-danger-match= phrase %code.js-confirm-danger-match= phrase
...@@ -21,4 +19,4 @@ ...@@ -21,4 +19,4 @@
.form-group .form-group
= text_field_tag 'confirm_name_input', '', class: 'form-control js-confirm-danger-input' = text_field_tag 'confirm_name_input', '', class: 'form-control js-confirm-danger-input'
.form-actions .form-actions
= submit_tag 'Confirm', class: "btn btn-danger js-confirm-danger-submit" = submit_tag _('Confirm'), class: "btn btn-danger js-confirm-danger-submit"
...@@ -867,6 +867,9 @@ msgstr "" ...@@ -867,6 +867,9 @@ msgstr ""
msgid "Any" msgid "Any"
msgstr "" msgstr ""
msgid "Any encrypted tokens"
msgstr ""
msgid "Appearance" msgid "Appearance"
msgstr "" msgstr ""
...@@ -912,15 +915,27 @@ msgstr "" ...@@ -912,15 +915,27 @@ msgstr ""
msgid "Archive jobs" msgid "Archive jobs"
msgstr "" msgstr ""
msgid "Archive project"
msgstr ""
msgid "Archived project! Repository and other project resources are read-only" msgid "Archived project! Repository and other project resources are read-only"
msgstr "" msgstr ""
msgid "Archived projects" msgid "Archived projects"
msgstr "" msgstr ""
msgid "Archiving the project will make it entirely read-only. It is hidden from the dashboard and doesn't show up in searches. <strong>The repository cannot be committed to, and no issues, comments or other entities can be created.</strong>"
msgstr ""
msgid "Are you sure" msgid "Are you sure"
msgstr "" msgstr ""
msgid "Are you sure that you want to archive this project?"
msgstr ""
msgid "Are you sure that you want to unarchive this project?"
msgstr ""
msgid "Are you sure you want to delete this pipeline schedule?" msgid "Are you sure you want to delete this pipeline schedule?"
msgstr "" msgstr ""
...@@ -1206,6 +1221,12 @@ msgstr "" ...@@ -1206,6 +1221,12 @@ msgstr ""
msgid "Badges|e.g. %{exampleUrl}" msgid "Badges|e.g. %{exampleUrl}"
msgstr "" msgstr ""
msgid "Be careful. Changing the project's namespace can have unintended side effects."
msgstr ""
msgid "Be careful. Renaming a project's repository can have unintended side effects."
msgstr ""
msgid "Begin with the selected commit" msgid "Begin with the selected commit"
msgstr "" msgstr ""
...@@ -1413,6 +1434,9 @@ msgstr "" ...@@ -1413,6 +1434,9 @@ msgstr ""
msgid "CI Lint" msgid "CI Lint"
msgstr "" msgstr ""
msgid "CI variables"
msgstr ""
msgid "CI/CD" msgid "CI/CD"
msgstr "" msgstr ""
...@@ -1503,6 +1527,9 @@ msgstr "" ...@@ -1503,6 +1527,9 @@ msgstr ""
msgid "Certificate (PEM)" msgid "Certificate (PEM)"
msgstr "" msgstr ""
msgid "Change path"
msgstr ""
msgid "Change permissions" msgid "Change permissions"
msgstr "" msgstr ""
...@@ -1707,6 +1734,9 @@ msgstr "" ...@@ -1707,6 +1734,9 @@ msgstr ""
msgid "CiVariable|Validation failed" msgid "CiVariable|Validation failed"
msgstr "" msgstr ""
msgid "Classification Label (optional)"
msgstr ""
msgid "ClassificationLabelUnavailable|is unavailable: %{reason}" msgid "ClassificationLabelUnavailable|is unavailable: %{reason}"
msgstr "" msgstr ""
...@@ -2408,6 +2438,12 @@ msgstr "" ...@@ -2408,6 +2438,12 @@ msgstr ""
msgid "Configure the way a user creates a new account." msgid "Configure the way a user creates a new account."
msgstr "" msgstr ""
msgid "Confirm"
msgstr ""
msgid "Confirmation required"
msgstr ""
msgid "Connect" msgid "Connect"
msgstr "" msgstr ""
...@@ -2417,6 +2453,9 @@ msgstr "" ...@@ -2417,6 +2453,9 @@ msgstr ""
msgid "Container Registry" msgid "Container Registry"
msgstr "" msgstr ""
msgid "Container registry images"
msgstr ""
msgid "ContainerRegistry|Created" msgid "ContainerRegistry|Created"
msgstr "" msgstr ""
...@@ -3109,6 +3148,9 @@ msgstr "" ...@@ -3109,6 +3148,9 @@ msgstr ""
msgid "Download asset" msgid "Download asset"
msgstr "" msgstr ""
msgid "Download export"
msgstr ""
msgid "Download tar" msgid "Download tar"
msgstr "" msgstr ""
...@@ -3679,6 +3721,12 @@ msgstr "" ...@@ -3679,6 +3721,12 @@ msgstr ""
msgid "Explore public groups" msgid "Explore public groups"
msgstr "" msgstr ""
msgid "Export project"
msgstr ""
msgid "Export this project with all its related data in order to move your project to a new GitLab instance. Once the export is finished, you can import the file from the \"New Project\" page."
msgstr ""
msgid "External Classification Policy Authorization" msgid "External Classification Policy Authorization"
msgstr "" msgstr ""
...@@ -3697,9 +3745,6 @@ msgstr "" ...@@ -3697,9 +3745,6 @@ msgstr ""
msgid "External authorization request timeout" msgid "External authorization request timeout"
msgstr "" msgstr ""
msgid "ExternalAuthorizationService|Classification Label"
msgstr ""
msgid "ExternalAuthorizationService|Classification label" msgid "ExternalAuthorizationService|Classification label"
msgstr "" msgstr ""
...@@ -3981,6 +4026,9 @@ msgstr "" ...@@ -3981,6 +4026,9 @@ msgstr ""
msgid "Generate a default set of labels" msgid "Generate a default set of labels"
msgstr "" msgstr ""
msgid "Generate new export"
msgstr ""
msgid "Geo" msgid "Geo"
msgstr "" msgstr ""
...@@ -4346,6 +4394,9 @@ msgstr "" ...@@ -4346,6 +4394,9 @@ msgstr ""
msgid "Hook was successfully updated." msgid "Hook was successfully updated."
msgstr "" msgstr ""
msgid "Housekeeping"
msgstr ""
msgid "Housekeeping successfully started" msgid "Housekeeping successfully started"
msgstr "" msgstr ""
...@@ -4682,6 +4733,9 @@ msgstr "" ...@@ -4682,6 +4733,9 @@ msgstr ""
msgid "Issues can be bugs, tasks or ideas to be discussed. Also, issues are searchable and filterable." msgid "Issues can be bugs, tasks or ideas to be discussed. Also, issues are searchable and filterable."
msgstr "" msgstr ""
msgid "Issues with comments, merge requests with diffs and comments, labels, milestones, snippets, and other project entities"
msgstr ""
msgid "Issues, merge requests, pushes, and comments." msgid "Issues, merge requests, pushes, and comments."
msgstr "" msgstr ""
...@@ -4721,6 +4775,9 @@ msgstr "" ...@@ -4721,6 +4775,9 @@ msgstr ""
msgid "Job is stuck. Check runners." msgid "Job is stuck. Check runners."
msgstr "" msgstr ""
msgid "Job traces and artifacts"
msgstr ""
msgid "Job was retried" msgid "Job was retried"
msgstr "" msgstr ""
...@@ -4829,6 +4886,9 @@ msgstr "" ...@@ -4829,6 +4886,9 @@ msgstr ""
msgid "LFS" msgid "LFS"
msgstr "" msgstr ""
msgid "LFS objects"
msgstr ""
msgid "LFSStatus|Disabled" msgid "LFSStatus|Disabled"
msgstr "" msgstr ""
...@@ -5427,7 +5487,7 @@ msgstr "" ...@@ -5427,7 +5487,7 @@ msgstr ""
msgid "Name:" msgid "Name:"
msgstr "" msgstr ""
msgid "Naming, tags, avatar" msgid "Naming, topics, avatar"
msgstr "" msgstr ""
msgid "Naming, visibility" msgid "Naming, visibility"
...@@ -5795,6 +5855,12 @@ msgstr "" ...@@ -5795,6 +5855,12 @@ msgstr ""
msgid "OfSearchInADropdown|Filter" msgid "OfSearchInADropdown|Filter"
msgstr "" msgstr ""
msgid "Once removed, the fork relationship cannot be restored and you will no longer be able to send merge requests to the source."
msgstr ""
msgid "Once the exported file is ready, you will receive a notification email with a download link, or you can download it from this page."
msgstr ""
msgid "One more item" msgid "One more item"
msgid_plural "%d more items" msgid_plural "%d more items"
msgstr[0] "" msgstr[0] ""
...@@ -5947,6 +6013,9 @@ msgstr "" ...@@ -5947,6 +6013,9 @@ msgstr ""
msgid "Paste your public SSH key, which is usually contained in the file '~/.ssh/id_rsa.pub' and begins with 'ssh-rsa'. Don't use your private SSH key." msgid "Paste your public SSH key, which is usually contained in the file '~/.ssh/id_rsa.pub' and begins with 'ssh-rsa'. Don't use your private SSH key."
msgstr "" msgstr ""
msgid "Path"
msgstr ""
msgid "Path, transfer, remove" msgid "Path, transfer, remove"
msgstr "" msgstr ""
...@@ -6244,6 +6313,9 @@ msgstr "" ...@@ -6244,6 +6313,9 @@ msgstr ""
msgid "Please use this form to report users to GitLab who create spam issues, comments or behave inappropriately." msgid "Please use this form to report users to GitLab who create spam issues, comments or behave inappropriately."
msgstr "" msgstr ""
msgid "Please wait a moment, this page will automatically refresh when ready."
msgstr ""
msgid "Please wait while we import the repository for you. Refresh at will." msgid "Please wait while we import the repository for you. Refresh at will."
msgstr "" msgstr ""
...@@ -6580,15 +6652,27 @@ msgstr "" ...@@ -6580,15 +6652,27 @@ msgstr ""
msgid "Project Badges" msgid "Project Badges"
msgstr "" msgstr ""
msgid "Project ID"
msgstr ""
msgid "Project URL" msgid "Project URL"
msgstr "" msgstr ""
msgid "Project access must be granted explicitly to each user." msgid "Project access must be granted explicitly to each user."
msgstr "" msgstr ""
msgid "Project and wiki repositories"
msgstr ""
msgid "Project avatar" msgid "Project avatar"
msgstr "" msgstr ""
msgid "Project configuration, including services"
msgstr ""
msgid "Project description (optional)"
msgstr ""
msgid "Project details" msgid "Project details"
msgstr "" msgstr ""
...@@ -6619,6 +6703,12 @@ msgstr "" ...@@ -6619,6 +6703,12 @@ msgstr ""
msgid "Project slug" msgid "Project slug"
msgstr "" msgstr ""
msgid "Project uploads"
msgstr ""
msgid "Project visibility level will be changed to match namespace rules when transferring to a group."
msgstr ""
msgid "Project:" msgid "Project:"
msgstr "" msgstr ""
...@@ -6933,6 +7023,9 @@ msgstr "" ...@@ -6933,6 +7023,9 @@ msgstr ""
msgid "Remove avatar" msgid "Remove avatar"
msgstr "" msgstr ""
msgid "Remove fork relationship"
msgstr ""
msgid "Remove group" msgid "Remove group"
msgstr "" msgstr ""
...@@ -6951,9 +7044,15 @@ msgstr "" ...@@ -6951,9 +7044,15 @@ msgstr ""
msgid "Removed group can not be restored!" msgid "Removed group can not be restored!"
msgstr "" msgstr ""
msgid "Removed projects cannot be restored!"
msgstr ""
msgid "Removing group will cause all child projects and resources to be removed." msgid "Removing group will cause all child projects and resources to be removed."
msgstr "" msgstr ""
msgid "Removing the project will delete its repository and all related resources including issues, merge requests etc."
msgstr ""
msgid "Rename" msgid "Rename"
msgstr "" msgstr ""
...@@ -7142,6 +7241,9 @@ msgstr "" ...@@ -7142,6 +7241,9 @@ msgstr ""
msgid "Revoked personal access token %{personal_access_token_name}!" msgid "Revoked personal access token %{personal_access_token_name}!"
msgstr "" msgstr ""
msgid "Run housekeeping"
msgstr ""
msgid "Run untagged jobs" msgid "Run untagged jobs"
msgstr "" msgstr ""
...@@ -7196,6 +7298,9 @@ msgstr "" ...@@ -7196,6 +7298,9 @@ msgstr ""
msgid "Running…" msgid "Running…"
msgstr "" msgstr ""
msgid "Runs a number of housekeeping tasks within the current repository, such as compressing file revisions and removing unreachable objects."
msgstr ""
msgid "SSH Keys" msgid "SSH Keys"
msgstr "" msgstr ""
...@@ -7235,6 +7340,9 @@ msgstr "" ...@@ -7235,6 +7340,9 @@ msgstr ""
msgid "Save variables" msgid "Save variables"
msgstr "" msgstr ""
msgid "Saving project."
msgstr ""
msgid "Schedule a new pipeline" msgid "Schedule a new pipeline"
msgstr "" msgstr ""
...@@ -7358,6 +7466,9 @@ msgstr "" ...@@ -7358,6 +7466,9 @@ msgstr ""
msgid "Select a namespace to fork the project" msgid "Select a namespace to fork the project"
msgstr "" msgstr ""
msgid "Select a new namespace"
msgstr ""
msgid "Select a timezone" msgid "Select a timezone"
msgstr "" msgstr ""
...@@ -7412,6 +7523,9 @@ msgstr "" ...@@ -7412,6 +7523,9 @@ msgstr ""
msgid "Sep" msgid "Sep"
msgstr "" msgstr ""
msgid "Separate topics with commas."
msgstr ""
msgid "September" msgid "September"
msgstr "" msgstr ""
...@@ -8253,6 +8367,12 @@ msgstr "" ...@@ -8253,6 +8367,12 @@ msgstr ""
msgid "The file has been successfully deleted." msgid "The file has been successfully deleted."
msgstr "" msgstr ""
msgid "The following items will NOT be exported:"
msgstr ""
msgid "The following items will be exported:"
msgstr ""
msgid "The fork relationship has been removed." msgid "The fork relationship has been removed."
msgstr "" msgstr ""
...@@ -8484,6 +8604,9 @@ msgstr "" ...@@ -8484,6 +8604,9 @@ msgstr ""
msgid "This GitLab instance does not provide any shared Runners yet. Instance administrators can register shared Runners in the admin area." msgid "This GitLab instance does not provide any shared Runners yet. Instance administrators can register shared Runners in the admin area."
msgstr "" msgstr ""
msgid "This action can lead to data loss. To prevent accidental actions we ask you to confirm your intention."
msgstr ""
msgid "This application was created by %{link_to_owner}." msgid "This application was created by %{link_to_owner}."
msgstr "" msgstr ""
...@@ -8676,6 +8799,9 @@ msgstr "" ...@@ -8676,6 +8799,9 @@ msgstr ""
msgid "This user will be the author of all events in the activity feed that are the result of an update, like new branches being created or new commits being pushed to existing branches." msgid "This user will be the author of all events in the activity feed that are the result of an update, like new branches being created or new commits being pushed to existing branches."
msgstr "" msgstr ""
msgid "This will remove the fork relationship to source project"
msgstr ""
msgid "Time before an issue gets scheduled" msgid "Time before an issue gets scheduled"
msgstr "" msgstr ""
...@@ -8977,6 +9103,9 @@ msgstr "" ...@@ -8977,6 +9103,9 @@ msgstr ""
msgid "Too many changes to show." msgid "Too many changes to show."
msgstr "" msgstr ""
msgid "Topics"
msgstr ""
msgid "Total Time" msgid "Total Time"
msgstr "" msgstr ""
...@@ -8989,6 +9118,9 @@ msgstr "" ...@@ -8989,6 +9118,9 @@ msgstr ""
msgid "Track time with quick actions" msgid "Track time with quick actions"
msgstr "" msgstr ""
msgid "Transfer project"
msgstr ""
msgid "Tree view" msgid "Tree view"
msgstr "" msgstr ""
...@@ -9049,6 +9181,12 @@ msgstr "" ...@@ -9049,6 +9181,12 @@ msgstr ""
msgid "Unable to schedule a pipeline to run immediately" msgid "Unable to schedule a pipeline to run immediately"
msgstr "" msgstr ""
msgid "Unarchive project"
msgstr ""
msgid "Unarchiving the project will restore people's ability to make changes to it. The repository can be committed to, and issues, comments and other entities can be created. <strong>Once active this project shows up in the search and on the dashboard.</strong>"
msgstr ""
msgid "Unblock" msgid "Unblock"
msgstr "" msgstr ""
...@@ -9130,7 +9268,7 @@ msgstr "" ...@@ -9130,7 +9268,7 @@ msgstr ""
msgid "Update your group name, description, avatar, and visibility." msgid "Update your group name, description, avatar, and visibility."
msgstr "" msgstr ""
msgid "Update your project name, tags, description and avatar." msgid "Update your project name, topics, description and avatar."
msgstr "" msgstr ""
msgid "Updating" msgid "Updating"
...@@ -9454,6 +9592,9 @@ msgstr "" ...@@ -9454,6 +9592,9 @@ msgstr ""
msgid "Web terminal" msgid "Web terminal"
msgstr "" msgstr ""
msgid "Webhooks"
msgstr ""
msgid "Webhooks Help" msgid "Webhooks Help"
msgstr "" msgstr ""
...@@ -9735,6 +9876,9 @@ msgstr "" ...@@ -9735,6 +9876,9 @@ msgstr ""
msgid "You can only merge once the items above are resolved" msgid "You can only merge once the items above are resolved"
msgstr "" msgstr ""
msgid "You can only transfer the project to namespaces you manage."
msgstr ""
msgid "You can resolve the merge conflict using either the Interactive mode, by choosing %{use_ours} or %{use_theirs} buttons, or by editing the files directly. Commit these changes into %{branch_name}" msgid "You can resolve the merge conflict using either the Interactive mode, by choosing %{use_ours} or %{use_theirs} buttons, or by editing the files directly. Commit these changes into %{branch_name}"
msgstr "" msgstr ""
...@@ -9825,6 +9969,9 @@ msgstr "" ...@@ -9825,6 +9969,9 @@ msgstr ""
msgid "You will lose all the unstaged changes you've made in this project. This action cannot be undone." msgid "You will lose all the unstaged changes you've made in this project. This action cannot be undone."
msgstr "" msgstr ""
msgid "You will need to update your local repositories to point to the new location."
msgstr ""
msgid "You will not get any notifications via email" msgid "You will not get any notifications via email"
msgstr "" msgstr ""
...@@ -9927,6 +10074,9 @@ msgstr "" ...@@ -9927,6 +10074,9 @@ msgstr ""
msgid "Your comment will not be visible to the public." msgid "Your comment will not be visible to the public."
msgstr "" msgstr ""
msgid "Your deployment services will be broken, you will need to manually fix the services after renaming."
msgstr ""
msgid "Your device was successfully set up! Give it a name and register it with the GitLab server." msgid "Your device was successfully set up! Give it a name and register it with the GitLab server."
msgstr "" msgstr ""
......
...@@ -4,27 +4,21 @@ module QA ...@@ -4,27 +4,21 @@ module QA
module Settings module Settings
class Advanced < Page::Base class Advanced < Page::Base
view 'app/views/projects/edit.html.haml' do view 'app/views/projects/edit.html.haml' do
element :project_path_field, 'text_field :path' # rubocop:disable QA/ElementWithPattern element :project_path_field
element :project_name_field, 'text_field :name' # rubocop:disable QA/ElementWithPattern element :change_path_button
element :rename_project_button, "submit 'Rename project'" # rubocop:disable QA/ElementWithPattern
end end
def rename_to(path) def update_project_path_to(path)
fill_project_name(path)
fill_project_path(path) fill_project_path(path)
rename_project! click_change_path_button
end end
def fill_project_path(path) def fill_project_path(path)
fill_in :project_path, with: path fill_element :project_path_field, path
end end
def fill_project_name(name) def click_change_path_button
fill_in :project_name, with: name click_element :change_path_button
end
def rename_project!
click_on 'Rename project'
end end
end end
end end
......
...@@ -4,14 +4,6 @@ module QA ...@@ -4,14 +4,6 @@ module QA
module Settings module Settings
module Common module Common
include QA::Page::Settings::Common include QA::Page::Settings::Common
def self.included(base)
base.class_eval do
view 'app/views/projects/edit.html.haml' do
element :advanced_settings_expand, "= expanded ? 'Collapse' : 'Expand'" # rubocop:disable QA/ElementWithPattern
end
end
end
end end
end end
end end
......
...@@ -9,6 +9,24 @@ module QA ...@@ -9,6 +9,24 @@ module QA
element :advanced_settings element :advanced_settings
end end
view 'app/views/projects/settings/_general.html.haml' do
element :project_name_field
element :save_naming_topics_avatar_button
end
def rename_project_to(name)
fill_project_name(name)
click_save_changes
end
def fill_project_name(name)
fill_element :project_name_field, name
end
def click_save_changes
click_element :save_naming_topics_avatar_button
end
def expand_advanced_settings(&block) def expand_advanced_settings(&block)
expand_section(:advanced_settings) do expand_section(:advanced_settings) do
Advanced.perform(&block) Advanced.perform(&block)
......
...@@ -9,24 +9,33 @@ describe 'Projects > Settings > User renames a project' do ...@@ -9,24 +9,33 @@ describe 'Projects > Settings > User renames a project' do
visit edit_project_path(project) visit edit_project_path(project)
end end
def rename_project(project, name: nil, path: nil) def change_path(project, path)
fill_in('project_name', with: name) if name within('.advanced-settings') do
fill_in('Path', with: path) if path fill_in('Path', with: path)
click_button('Rename project') click_button('Change path')
end
project.reload
wait_for_edit_project_page_reload wait_for_edit_project_page_reload
end
def change_name(project, name)
within('.general-settings') do
fill_in('Project name', with: name)
click_button('Save changes')
end
project.reload project.reload
wait_for_edit_project_page_reload
end end
def wait_for_edit_project_page_reload def wait_for_edit_project_page_reload
expect(find('.project-edit-container')).to have_content('Rename repository') expect(find('.advanced-settings')).to have_content('Change path')
end end
context 'with invalid characters' do context 'with invalid characters' do
it 'shows errors for invalid project path/name' do it 'shows errors for invalid project path' do
rename_project(project, name: 'foo&bar', path: 'foo&bar') change_path(project, 'foo&bar')
expect(page).to have_field 'Project name', with: 'foo&bar'
expect(page).to have_field 'Path', with: 'foo&bar' expect(page).to have_field 'Path', with: 'foo&bar'
expect(page).to have_content "Name can contain only letters, digits, emojis, '_', '.', dash, space. It must start with letter, digit, emoji or '_'."
expect(page).to have_content "Path can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'" expect(page).to have_content "Path can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'"
end end
end end
...@@ -42,13 +51,13 @@ describe 'Projects > Settings > User renames a project' do ...@@ -42,13 +51,13 @@ describe 'Projects > Settings > User renames a project' do
context 'when changing project name' do context 'when changing project name' do
it 'renames the repository' do it 'renames the repository' do
rename_project(project, name: 'bar') change_name(project, 'bar')
expect(find('.breadcrumbs')).to have_content(project.name) expect(find('.breadcrumbs')).to have_content(project.name)
end end
context 'with emojis' do context 'with emojis' do
it 'shows error for invalid project name' do it 'shows error for invalid project name' do
rename_project(project, name: '🚀 foo bar ☁️') change_name(project, '🚀 foo bar ☁️')
expect(page).to have_field 'Project name', with: '🚀 foo bar ☁️' expect(page).to have_field 'Project name', with: '🚀 foo bar ☁️'
expect(page).not_to have_content "Name can contain only letters, digits, emojis '_', '.', dash and space. It must start with letter, digit, emoji or '_'." expect(page).not_to have_content "Name can contain only letters, digits, emojis '_', '.', dash and space. It must start with letter, digit, emoji or '_'."
end end
...@@ -67,7 +76,7 @@ describe 'Projects > Settings > User renames a project' do ...@@ -67,7 +76,7 @@ describe 'Projects > Settings > User renames a project' do
end end
it 'the project is accessible via the new path' do it 'the project is accessible via the new path' do
rename_project(project, path: 'bar') change_path(project, 'bar')
new_path = namespace_project_path(project.namespace, 'bar') new_path = namespace_project_path(project.namespace, 'bar')
visit new_path visit new_path
...@@ -77,7 +86,7 @@ describe 'Projects > Settings > User renames a project' do ...@@ -77,7 +86,7 @@ describe 'Projects > Settings > User renames a project' do
it 'the project is accessible via a redirect from the old path' do it 'the project is accessible via a redirect from the old path' do
old_path = project_path(project) old_path = project_path(project)
rename_project(project, path: 'bar') change_path(project, 'bar')
new_path = namespace_project_path(project.namespace, 'bar') new_path = namespace_project_path(project.namespace, 'bar')
visit old_path visit old_path
...@@ -88,7 +97,7 @@ describe 'Projects > Settings > User renames a project' do ...@@ -88,7 +97,7 @@ describe 'Projects > Settings > User renames a project' do
context 'and a new project is added with the same path' do context 'and a new project is added with the same path' do
it 'overrides the redirect' do it 'overrides the redirect' do
old_path = project_path(project) old_path = project_path(project)
rename_project(project, path: 'bar') change_path(project, 'bar')
new_project = create(:project, namespace: user.namespace, path: 'gitlabhq', name: 'quz') new_project = create(:project, namespace: user.namespace, path: 'gitlabhq', name: 'quz')
visit old_path visit old_path
......
...@@ -373,6 +373,21 @@ describe 'Project' do ...@@ -373,6 +373,21 @@ describe 'Project' do
end end
end end
describe 'edit' do
let(:user) { create(:user) }
let(:project) { create(:project, :public) }
let(:path) { edit_project_path(project) }
before do
project.add_maintainer(user)
sign_in(user)
visit path
end
it_behaves_like 'dirty submit form', [{ form: '.js-general-settings-form', input: 'input[name="project[name]"]' },
{ form: '.qa-merge-request-settings', input: '#project_printing_merge_request_link_enabled' }]
end
def remove_with_confirm(button_text, confirm_with) def remove_with_confirm(button_text, confirm_with)
click_button button_text click_button button_text
fill_in 'confirm_name_input', with: confirm_with fill_in 'confirm_name_input', with: confirm_with
......
shared_examples 'dirty submit form' do |selector_args| shared_examples 'dirty submit form' do |selector_args|
selectors = selector_args.is_a?(Array) ? selector_args : [selector_args] selectors = selector_args.is_a?(Array) ? selector_args : [selector_args]
def expect_disabled_state(form, submit, is_disabled = true) def expect_disabled_state(form, submit_selector, is_disabled = true)
disabled_selector = is_disabled == true ? '[disabled]' : ':not([disabled])' disabled_selector = is_disabled == true ? '[disabled]' : ':not([disabled])'
form.find(".js-dirty-submit#{disabled_selector}", match: :first) form.find("#{submit_selector}#{disabled_selector}")
expect(submit.disabled?).to be is_disabled
end end
selectors.each do |selector| selectors.each do |selector|
it "disables #{selector[:form]} submit until there are changes on #{selector[:input]}", :js do it "disables #{selector[:form]} submit until there are changes on #{selector[:input]}", :js do
form = find(selector[:form]) form = find(selector[:form])
submit = form.first('.js-dirty-submit') submit_selector = selector[:submit] || 'input[type="submit"]'
submit = form.first(submit_selector)
input = form.first(selector[:input]) input = form.first(selector[:input])
is_radio = input[:type] == 'radio' is_radio = input[:type] == 'radio'
is_checkbox = input[:type] == 'checkbox' is_checkbox = input[:type] == 'checkbox'
...@@ -22,15 +21,14 @@ shared_examples 'dirty submit form' do |selector_args| ...@@ -22,15 +21,14 @@ shared_examples 'dirty submit form' do |selector_args|
original_checkable = input if is_checkbox original_checkable = input if is_checkbox
expect(submit.disabled?).to be true expect(submit.disabled?).to be true
expect(input.checked?).to be false
is_checkable ? input.click : input.set("#{original_value} changes") is_checkable ? input.click : input.set("#{original_value} changes")
expect_disabled_state(form, submit, false) expect_disabled_state(form, submit_selector, false)
is_checkable ? original_checkable.click : input.set(original_value) is_checkable ? original_checkable.click : input.set(original_value)
expect_disabled_state(form, submit) expect_disabled_state(form, submit_selector)
end end
end end
end end
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