Commit fc16e863 authored by jboyson's avatar jboyson

Update controller to use simple redirect

Now that the form is submitting with a normal post,
We can remove all of the js handling.

We replace the `format` calls with a simple redirect.

And finally remove update.js.haml as it is no longer used.
parent 3d5825a5
......@@ -90,22 +90,14 @@ class ProjectsController < Projects::ApplicationController
# Refresh the repo in case anything changed
@repository = @project.repository
respond_to do |format|
if result[:status] == :success
flash[:notice] = _("Project '%{project_name}' was successfully updated.") % { project_name: @project.name }
format.html do
redirect_to(edit_project_path(@project, anchor: 'js-general-project-settings'))
end
else
flash[:alert] = result[:message]
@project.reset
format.html { render_edit }
end
format.js
if result[:status] == :success
flash[:notice] = _("Project '%{project_name}' was successfully updated.") % { project_name: @project.name }
else
flash[:alert] = result[:message]
@project.reset
end
redirect_to(edit_project_path(@project, anchor: 'js-general-project-settings'))
end
# rubocop: disable CodeReuse/ActiveRecord
......
- if @project.valid?
:plain
location.href = "#{edit_project_path(@project, anchor: params[:update_section])}";
location.reload();
- else
:plain
$(".flash-container").html("#{escape_javascript(render('errors'))}");
$('.save-project-loader').hide();
$('.project-edit-container').show();
$('.edit-project .js-btn-success-general-project-settings').enable();
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