mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-01-19 14:17:59 +01:00
mix format
This commit is contained in:
parent
c8b0d9ca3d
commit
1c12c010fa
6 changed files with 22 additions and 4 deletions
|
@ -5,7 +5,12 @@ defmodule PhilomenaWeb.Admin.Advert.ImageController do
|
|||
alias Philomena.Adverts
|
||||
|
||||
plug :verify_authorized
|
||||
plug :load_and_authorize_resource, model: Advert, id_name: "advert_id", persisted: true, only: [:edit, :update, :delete]
|
||||
|
||||
plug :load_and_authorize_resource,
|
||||
model: Advert,
|
||||
id_name: "advert_id",
|
||||
persisted: true,
|
||||
only: [:edit, :update, :delete]
|
||||
|
||||
def edit(conn, _params) do
|
||||
changeset = Adverts.change_advert(conn.assigns.advert)
|
||||
|
|
|
@ -22,7 +22,11 @@ defmodule PhilomenaWeb.Api.Json.Search.ImageController do
|
|||
|
||||
conn
|
||||
|> put_view(PhilomenaWeb.Api.Json.ImageView)
|
||||
|> render("index.json", images: images, total: images.total_entries, interactions: interactions)
|
||||
|> render("index.json",
|
||||
images: images,
|
||||
total: images.total_entries,
|
||||
interactions: interactions
|
||||
)
|
||||
|
||||
{:error, msg} ->
|
||||
conn
|
||||
|
|
|
@ -9,6 +9,7 @@ defmodule PhilomenaWeb.Api.Json.Search.ReverseController do
|
|||
|
||||
def create(conn, %{"image" => image_params}) do
|
||||
user = conn.assigns.current_user
|
||||
|
||||
images =
|
||||
image_params
|
||||
|> Map.put("distance", conn.params["distance"])
|
||||
|
|
|
@ -320,6 +320,7 @@ defmodule PhilomenaWeb.Router do
|
|||
only: [:index, :new, :create, :edit, :update, :delete]
|
||||
|
||||
resources "/site_notices", SiteNoticeController, except: [:show]
|
||||
|
||||
resources "/adverts", AdvertController, except: [:show] do
|
||||
resources "/image", Advert.ImageController, only: [:edit, :update], singleton: true
|
||||
end
|
||||
|
|
|
@ -3,7 +3,8 @@ defmodule PhilomenaWeb.Api.Json.GalleryView do
|
|||
|
||||
def render("index.json", %{galleries: galleries, total: total} = assigns) do
|
||||
%{
|
||||
galleries: render_many(galleries, PhilomenaWeb.Api.Json.GalleryView, "gallery.json", assigns),
|
||||
galleries:
|
||||
render_many(galleries, PhilomenaWeb.Api.Json.GalleryView, "gallery.json", assigns),
|
||||
total: total
|
||||
}
|
||||
end
|
||||
|
|
|
@ -18,7 +18,13 @@ defmodule PhilomenaWeb.Api.Json.ProfileView do
|
|||
uploads_count: user.uploads_count,
|
||||
posts_count: user.forum_posts_count,
|
||||
topics_count: user.topic_count,
|
||||
links: render_many(user.public_links, PhilomenaWeb.Api.Json.UserLinkView, "user_link.json", assigns),
|
||||
links:
|
||||
render_many(
|
||||
user.public_links,
|
||||
PhilomenaWeb.Api.Json.UserLinkView,
|
||||
"user_link.json",
|
||||
assigns
|
||||
),
|
||||
awards: render_many(user.awards, PhilomenaWeb.Api.Json.AwardView, "award.json", assigns)
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue