mix format

This commit is contained in:
byte[] 2020-03-31 11:39:11 -04:00
parent c8b0d9ca3d
commit 1c12c010fa
6 changed files with 22 additions and 4 deletions

View file

@ -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)

View file

@ -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

View file

@ -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"])

View file

@ -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

View file

@ -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

View file

@ -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