diff options
14 files changed, 24 insertions, 22 deletions
diff --git a/app/controllers/concerns/repository_settings_redirect.rb b/app/controllers/concerns/repository_settings_redirect.rb index 0576f0e6e70..f3db3cd563b 100644 --- a/app/controllers/concerns/repository_settings_redirect.rb +++ b/app/controllers/concerns/repository_settings_redirect.rb @@ -1,7 +1,7 @@ module RepositorySettingsRedirect extend ActiveSupport::Concern - def redirect_to_repository_settings(project) - redirect_to project_settings_repository_path(project) + def redirect_to_repository_settings(project, anchor: nil) + redirect_to project_settings_repository_path(project, anchor: anchor) end end diff --git a/app/controllers/projects/deploy_keys_controller.rb b/app/controllers/projects/deploy_keys_controller.rb index 06739d8fd4a..28fea322334 100644 --- a/app/controllers/projects/deploy_keys_controller.rb +++ b/app/controllers/projects/deploy_keys_controller.rb @@ -10,7 +10,7 @@ class Projects::DeployKeysController < Projects::ApplicationController def index respond_to do |format| - format.html { redirect_to_repository_settings(@project) } + format.html { redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') } format.json do render json: Projects::Settings::DeployKeysPresenter.new(@project, current_user: current_user).as_json end @@ -18,7 +18,7 @@ class Projects::DeployKeysController < Projects::ApplicationController end def new - redirect_to_repository_settings(@project) + redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') end def create @@ -28,7 +28,7 @@ class Projects::DeployKeysController < Projects::ApplicationController flash[:alert] = @key.errors.full_messages.join(', ').html_safe end - redirect_to_repository_settings(@project) + redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') end def edit @@ -37,7 +37,7 @@ class Projects::DeployKeysController < Projects::ApplicationController def update if deploy_key.update(update_params) flash[:notice] = 'Deploy key was successfully updated.' - redirect_to_repository_settings(@project) + redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') else render 'edit' end @@ -47,7 +47,7 @@ class Projects::DeployKeysController < Projects::ApplicationController Projects::EnableDeployKeyService.new(@project, current_user, params).execute respond_to do |format| - format.html { redirect_to_repository_settings(@project) } + format.html { redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') } format.json { head :ok } end end @@ -59,7 +59,7 @@ class Projects::DeployKeysController < Projects::ApplicationController deploy_key_project.destroy! respond_to do |format| - format.html { redirect_to_repository_settings(@project) } + format.html { redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') } format.json { head :ok } end end diff --git a/app/controllers/projects/deploy_tokens_controller.rb b/app/controllers/projects/deploy_tokens_controller.rb index 2f91b8f36de..83abda64fe0 100644 --- a/app/controllers/projects/deploy_tokens_controller.rb +++ b/app/controllers/projects/deploy_tokens_controller.rb @@ -5,6 +5,6 @@ class Projects::DeployTokensController < Projects::ApplicationController @token = @project.deploy_tokens.find(params[:id]) @token.revoke! - redirect_to project_settings_repository_path(project) + redirect_to project_settings_repository_path(project, anchor: 'js-deploy-tokens') end end diff --git a/app/controllers/projects/mirrors_controller.rb b/app/controllers/projects/mirrors_controller.rb index da209c3ba61..3739608e4c0 100644 --- a/app/controllers/projects/mirrors_controller.rb +++ b/app/controllers/projects/mirrors_controller.rb @@ -9,7 +9,7 @@ class Projects::MirrorsController < Projects::ApplicationController layout "project_settings" def show - redirect_to_repository_settings(project) + redirect_to_repository_settings(project, anchor: 'js-push-remote-settings') end def update @@ -22,7 +22,7 @@ class Projects::MirrorsController < Projects::ApplicationController end respond_to do |format| - format.html { redirect_to_repository_settings(project) } + format.html { redirect_to_repository_settings(project, anchor: 'js-push-remote-settings') } format.json do if project.errors.present? render json: project.errors, status: :unprocessable_entity @@ -39,7 +39,7 @@ class Projects::MirrorsController < Projects::ApplicationController flash[:notice] = "The remote repository is being updated..." end - redirect_to_repository_settings(project) + redirect_to_repository_settings(project, anchor: 'js-push-remote-settings') end private diff --git a/app/controllers/projects/protected_refs_controller.rb b/app/controllers/projects/protected_refs_controller.rb index 9e757a8d25f..cc62ce2f11b 100644 --- a/app/controllers/projects/protected_refs_controller.rb +++ b/app/controllers/projects/protected_refs_controller.rb @@ -19,7 +19,7 @@ class Projects::ProtectedRefsController < Projects::ApplicationController flash[:alert] = protected_ref.errors.full_messages.join(', ').html_safe end - redirect_to_repository_settings(@project) + redirect_to_repository_settings(@project, anchor: params[:update_section]) end def show @@ -40,7 +40,7 @@ class Projects::ProtectedRefsController < Projects::ApplicationController destroy_service_class.new(@project, current_user).execute(@protected_ref) respond_to do |format| - format.html { redirect_to_repository_settings(@project) } + format.html { redirect_to_repository_settings(@project, anchor: params[:update_section]) } format.js { head :ok } end end diff --git a/app/views/projects/deploy_keys/_index.html.haml b/app/views/projects/deploy_keys/_index.html.haml index fb1ea471dec..062aa423bde 100644 --- a/app/views/projects/deploy_keys/_index.html.haml +++ b/app/views/projects/deploy_keys/_index.html.haml @@ -1,5 +1,5 @@ - expanded = Rails.env.test? -%section.qa-deploy-keys-settings.settings.no-animate{ class: ('expanded' if expanded) } +%section.qa-deploy-keys-settings.settings.no-animate#js-deploy-keys-settings{ class: ('expanded' if expanded) } .settings-header %h4 Deploy Keys diff --git a/app/views/projects/deploy_tokens/_form.html.haml b/app/views/projects/deploy_tokens/_form.html.haml index 578a9e2f74d..8b7535397bc 100644 --- a/app/views/projects/deploy_tokens/_form.html.haml +++ b/app/views/projects/deploy_tokens/_form.html.haml @@ -1,7 +1,7 @@ %p.profile-settings-content = s_("DeployTokens|Pick a name for the application, and we'll give you a unique deploy token.") -= form_for token, url: create_deploy_token_namespace_project_settings_repository_path(project.namespace, project), method: :post do |f| += form_for token, url: create_deploy_token_namespace_project_settings_repository_path(project.namespace, project, anchor: 'js-deploy-tokens'), method: :post do |f| = form_errors(token) .form-group diff --git a/app/views/projects/protected_branches/shared/_create_protected_branch.html.haml b/app/views/projects/protected_branches/shared/_create_protected_branch.html.haml index c2d6c034e35..df2dcf19ed4 100644 --- a/app/views/projects/protected_branches/shared/_create_protected_branch.html.haml +++ b/app/views/projects/protected_branches/shared/_create_protected_branch.html.haml @@ -1,4 +1,5 @@ = form_for [@project.namespace.becomes(Namespace), @project, @protected_branch], html: { class: 'new-protected-branch js-new-protected-branch' } do |f| + %input{ type: 'hidden', name: 'update_section', value: 'js-protected-branches-settings' } .card .card-header %h3.card-title diff --git a/app/views/projects/protected_branches/shared/_index.html.haml b/app/views/projects/protected_branches/shared/_index.html.haml index 4f1c6c92484..539b184e5c2 100644 --- a/app/views/projects/protected_branches/shared/_index.html.haml +++ b/app/views/projects/protected_branches/shared/_index.html.haml @@ -1,6 +1,6 @@ - expanded = Rails.env.test? -%section.qa-protected-branches-settings.settings.no-animate{ class: ('expanded' if expanded) } +%section.qa-protected-branches-settings.settings.no-animate#js-protected-branches-settings{ class: ('expanded' if expanded) } .settings-header %h4 Protected Branches diff --git a/app/views/projects/protected_branches/shared/_protected_branch.html.haml b/app/views/projects/protected_branches/shared/_protected_branch.html.haml index 05cee483c0e..81b07af22ad 100644 --- a/app/views/projects/protected_branches/shared/_protected_branch.html.haml +++ b/app/views/projects/protected_branches/shared/_protected_branch.html.haml @@ -21,4 +21,4 @@ - if can_admin_project %td - = link_to 'Unprotect', [@project.namespace.becomes(Namespace), @project, protected_branch], disabled: local_assigns[:disabled], data: { confirm: 'Branch will be writable for developers. Are you sure?' }, method: :delete, class: "btn btn-warning" + = link_to 'Unprotect', [@project.namespace.becomes(Namespace), @project, protected_branch, { update_section: 'js-protected-branches-settings' }], disabled: local_assigns[:disabled], data: { confirm: 'Branch will be writable for developers. Are you sure?' }, method: :delete, class: "btn btn-warning" diff --git a/app/views/projects/protected_tags/shared/_create_protected_tag.html.haml b/app/views/projects/protected_tags/shared/_create_protected_tag.html.haml index 0ae5ca3ff36..f98781b77f4 100644 --- a/app/views/projects/protected_tags/shared/_create_protected_tag.html.haml +++ b/app/views/projects/protected_tags/shared/_create_protected_tag.html.haml @@ -1,4 +1,5 @@ = form_for [@project.namespace.becomes(Namespace), @project, @protected_tag], html: { class: 'new-protected-tag js-new-protected-tag' } do |f| + %input{ type: 'hidden', name: 'update_section', value: 'js-protected-tags-settings' } .card .card-header %h3.card-title diff --git a/app/views/projects/protected_tags/shared/_protected_tag.html.haml b/app/views/projects/protected_tags/shared/_protected_tag.html.haml index 1702e38df7e..cc6f0309123 100644 --- a/app/views/projects/protected_tags/shared/_protected_tag.html.haml +++ b/app/views/projects/protected_tags/shared/_protected_tag.html.haml @@ -19,4 +19,4 @@ - if can? current_user, :admin_project, @project %td - = link_to 'Unprotect', [@project.namespace.becomes(Namespace), @project, protected_tag], data: { confirm: 'Tag will be writable for developers. Are you sure?' }, method: :delete, class: 'btn btn-warning' + = link_to 'Unprotect', [@project.namespace.becomes(Namespace), @project, protected_tag, { update_section: 'js-protected-tags-settings' }], data: { confirm: 'Tag will be writable for developers. Are you sure?' }, method: :delete, class: 'btn btn-warning' diff --git a/spec/controllers/projects/deploy_keys_controller_spec.rb b/spec/controllers/projects/deploy_keys_controller_spec.rb index d2f133f972a..73bf169085f 100644 --- a/spec/controllers/projects/deploy_keys_controller_spec.rb +++ b/spec/controllers/projects/deploy_keys_controller_spec.rb @@ -19,7 +19,7 @@ describe Projects::DeployKeysController do it 'redirects to blob' do get :index, params - expect(response).to redirect_to(namespace_project_settings_repository_path(params)) + expect(response).to redirect_to(project_settings_repository_path(project, anchor: 'js-deploy-keys-settings')) end end diff --git a/spec/controllers/projects/mirrors_controller_spec.rb b/spec/controllers/projects/mirrors_controller_spec.rb index 5d64f362252..6114eef7003 100644 --- a/spec/controllers/projects/mirrors_controller_spec.rb +++ b/spec/controllers/projects/mirrors_controller_spec.rb @@ -36,7 +36,7 @@ describe Projects::MirrorsController do it 'processes a successful update' do do_put(project, remote_mirrors_attributes: remote_mirror_attributes) - expect(response).to redirect_to(project_settings_repository_path(project)) + expect(response).to redirect_to(project_settings_repository_path(project, anchor: 'js-push-remote-settings')) expect(flash[:notice]).to match(/successfully updated/) end @@ -53,7 +53,7 @@ describe Projects::MirrorsController do it 'processes an unsuccessful update' do do_put(project, remote_mirrors_attributes: remote_mirror_attributes) - expect(response).to redirect_to(project_settings_repository_path(project)) + expect(response).to redirect_to(project_settings_repository_path(project, anchor: 'js-push-remote-settings')) expect(flash[:alert]).to match(/Only allowed protocols are/) end |