Commit 0f77d24b authored by Mike Greiling's avatar Mike Greiling Committed by Tim Zallmann

Keep project settings sections expanded after submitting form

parent 6aa56a70
...@@ -21,6 +21,6 @@ class Projects::AvatarsController < Projects::ApplicationController ...@@ -21,6 +21,6 @@ class Projects::AvatarsController < Projects::ApplicationController
@project.save @project.save
redirect_to edit_project_path(@project), status: :found redirect_to edit_project_path(@project, anchor: 'js-general-project-settings'), status: :found
end end
end end
...@@ -61,7 +61,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -61,7 +61,7 @@ class ProjectsController < Projects::ApplicationController
flash[:notice] = _("Project '%{project_name}' was successfully updated.") % { project_name: @project.name } flash[:notice] = _("Project '%{project_name}' was successfully updated.") % { project_name: @project.name }
format.html do format.html do
redirect_to(edit_project_path(@project)) redirect_to(edit_project_path(@project, anchor: 'js-general-project-settings'))
end end
else else
flash.now[:alert] = result[:message] flash.now[:alert] = result[:message]
...@@ -174,7 +174,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -174,7 +174,7 @@ class ProjectsController < Projects::ApplicationController
) )
rescue ::Projects::HousekeepingService::LeaseTaken => ex rescue ::Projects::HousekeepingService::LeaseTaken => ex
redirect_to( redirect_to(
edit_project_path(@project), edit_project_path(@project, anchor: 'js-project-advanced-settings'),
alert: ex.to_s alert: ex.to_s
) )
end end
...@@ -183,7 +183,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -183,7 +183,7 @@ class ProjectsController < Projects::ApplicationController
@project.add_export_job(current_user: current_user) @project.add_export_job(current_user: current_user)
redirect_to( redirect_to(
edit_project_path(@project), edit_project_path(@project, anchor: 'js-export-project'),
notice: _("Project export started. A download link will be sent by email.") notice: _("Project export started. A download link will be sent by email.")
) )
end end
...@@ -195,7 +195,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -195,7 +195,7 @@ class ProjectsController < Projects::ApplicationController
send_file export_project_path, disposition: 'attachment' send_file export_project_path, disposition: 'attachment'
else else
redirect_to( redirect_to(
edit_project_path(@project), edit_project_path(@project, anchor: 'js-export-project'),
alert: _("Project export link has expired. Please generate a new export from your project settings.") alert: _("Project export link has expired. Please generate a new export from your project settings.")
) )
end end
...@@ -208,7 +208,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -208,7 +208,7 @@ class ProjectsController < Projects::ApplicationController
flash[:alert] = _("Project export could not be deleted.") flash[:alert] = _("Project export could not be deleted.")
end end
redirect_to(edit_project_path(@project)) redirect_to(edit_project_path(@project, anchor: 'js-export-project'))
end end
def generate_new_export def generate_new_export
...@@ -216,7 +216,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -216,7 +216,7 @@ class ProjectsController < Projects::ApplicationController
export export
else else
redirect_to( redirect_to(
edit_project_path(@project), edit_project_path(@project, anchor: 'js-export-project'),
alert: _("Project export could not be deleted.") alert: _("Project export could not be deleted.")
) )
end end
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
.settings-content .settings-content
.project-edit-errors .project-edit-errors
= form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, class: "edit-project" }, authenticity_token: true do |f| = 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 %fieldset
.row .row
.form-group.col-md-9 .form-group.col-md-9
...@@ -75,6 +76,7 @@ ...@@ -75,6 +76,7 @@
Enable or disable certain project features and choose access levels. Enable or disable certain project features and choose access levels.
.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' }
-# haml-lint:disable InlineJavaScript -# haml-lint:disable InlineJavaScript
%script.js-project-permissions-form-data{ type: "application/json" }= project_permissions_panel_data(@project) %script.js-project-permissions-form-data{ type: "application/json" }= project_permissions_panel_data(@project)
.js-project-permissions-form .js-project-permissions-form
...@@ -94,6 +96,7 @@ ...@@ -94,6 +96,7 @@
= 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" }, authenticity_token: true do |f|
%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-save qa-save-merge-request-changes" = f.submit 'Save changes', class: "btn btn-save qa-save-merge-request-changes"
......
- if @project.valid? - if @project.valid?
:plain :plain
location.href = "#{edit_project_path(@project)}"; location.href = "#{edit_project_path(@project, anchor: params[:update_section])}";
location.reload();
- else - else
:plain :plain
$(".project-edit-errors").html("#{escape_javascript(render('errors'))}"); $(".project-edit-errors").html("#{escape_javascript(render('errors'))}");
......
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