[Pools] Fix ordering returning error 406 (#668)

Fixes #555
This commit is contained in:
Donovan Daniels 2024-07-12 10:55:35 -05:00 committed by GitHub
parent 8f702da82a
commit ac0ef59b3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 8 deletions

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class PoolOrdersController < ApplicationController
respond_to :html, :json, :js
respond_to :html, :json
before_action :member_only
def edit

View File

@ -1,3 +1,5 @@
import Utility from "./utility";
let Pool = {};
Pool.dialog_setup = false;
@ -35,12 +37,16 @@ Pool.initialize_simple_edit = function() {
$("#sortable").disableSelection();
$("#ordering-form").submit(function(e) {
$.ajax({
type: "put",
url: e.target.action,
data: $("#sortable").sortable("serialize") + "&" + $(e.target).serialize()
});
e.preventDefault();
$.ajax({
type: "post",
url: e.target.action,
data: $("#sortable").sortable("serialize") + "&" + $(e.target).serialize() + "&format=json"
}).done(() => {
window.location.href = e.target.action;
}).fail((data) => {
Utility.error(`Error: ${data.responseText}`);
});
});
}

View File

@ -13,8 +13,8 @@
<% end %>
</ul>
<%= custom_form_for(@pool, :format => :js, :html => {:id => "ordering-form"}) do |f| %>
<%= submit_tag "Save" %>
<%= custom_form_for(@pool, html: { id: "ordering-form" }) do |f| %>
<%= f.submit "Save" %>
<% end %>
</div>
</div>