mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-01-19 22:27: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
|
alias Philomena.Adverts
|
||||||
|
|
||||||
plug :verify_authorized
|
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
|
def edit(conn, _params) do
|
||||||
changeset = Adverts.change_advert(conn.assigns.advert)
|
changeset = Adverts.change_advert(conn.assigns.advert)
|
||||||
|
|
|
@ -22,7 +22,11 @@ defmodule PhilomenaWeb.Api.Json.Search.ImageController do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_view(PhilomenaWeb.Api.Json.ImageView)
|
|> 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} ->
|
{:error, msg} ->
|
||||||
conn
|
conn
|
||||||
|
|
|
@ -9,6 +9,7 @@ defmodule PhilomenaWeb.Api.Json.Search.ReverseController do
|
||||||
|
|
||||||
def create(conn, %{"image" => image_params}) do
|
def create(conn, %{"image" => image_params}) do
|
||||||
user = conn.assigns.current_user
|
user = conn.assigns.current_user
|
||||||
|
|
||||||
images =
|
images =
|
||||||
image_params
|
image_params
|
||||||
|> Map.put("distance", conn.params["distance"])
|
|> Map.put("distance", conn.params["distance"])
|
||||||
|
|
|
@ -320,6 +320,7 @@ defmodule PhilomenaWeb.Router do
|
||||||
only: [:index, :new, :create, :edit, :update, :delete]
|
only: [:index, :new, :create, :edit, :update, :delete]
|
||||||
|
|
||||||
resources "/site_notices", SiteNoticeController, except: [:show]
|
resources "/site_notices", SiteNoticeController, except: [:show]
|
||||||
|
|
||||||
resources "/adverts", AdvertController, except: [:show] do
|
resources "/adverts", AdvertController, except: [:show] do
|
||||||
resources "/image", Advert.ImageController, only: [:edit, :update], singleton: true
|
resources "/image", Advert.ImageController, only: [:edit, :update], singleton: true
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,8 @@ defmodule PhilomenaWeb.Api.Json.GalleryView do
|
||||||
|
|
||||||
def render("index.json", %{galleries: galleries, total: total} = assigns) 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
|
total: total
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,13 @@ defmodule PhilomenaWeb.Api.Json.ProfileView do
|
||||||
uploads_count: user.uploads_count,
|
uploads_count: user.uploads_count,
|
||||||
posts_count: user.forum_posts_count,
|
posts_count: user.forum_posts_count,
|
||||||
topics_count: user.topic_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)
|
awards: render_many(user.awards, PhilomenaWeb.Api.Json.AwardView, "award.json", assigns)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue