2019-12-05 05:12:49 +01:00
|
|
|
defmodule PhilomenaWeb.Gallery.OrderController do
|
|
|
|
use PhilomenaWeb, :controller
|
|
|
|
|
|
|
|
alias Philomena.Galleries.Gallery
|
|
|
|
alias Philomena.Galleries
|
|
|
|
|
2020-01-23 18:32:26 +01:00
|
|
|
plug PhilomenaWeb.FilterBannedUsersPlug
|
|
|
|
|
2019-12-05 05:12:49 +01:00
|
|
|
plug PhilomenaWeb.CanaryMapPlug, update: :edit
|
|
|
|
plug :load_and_authorize_resource, model: Gallery, id_name: "gallery_id", persisted: true
|
|
|
|
|
|
|
|
def update(conn, %{"image_ids" => image_ids}) when is_list(image_ids) do
|
|
|
|
gallery = conn.assigns.gallery
|
|
|
|
|
|
|
|
Galleries.reorder_gallery(gallery, image_ids)
|
|
|
|
|
|
|
|
json(conn, %{})
|
|
|
|
end
|
2020-01-11 05:20:19 +01:00
|
|
|
end
|