-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated comments * Added basic media tables to sources#show * Adds a very basic listing and show page for media
- Loading branch information
1 parent
dabec62
commit 8bdd189
Showing
8 changed files
with
102 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
lib/pinchflat_web/controllers/media/media_item_controller.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
defmodule PinchflatWeb.Media.MediaItemController do | ||
use PinchflatWeb, :controller | ||
|
||
alias Pinchflat.Media | ||
|
||
def show(conn, %{"id" => id}) do | ||
media_item = Media.get_media_item!(id) | ||
|
||
render(conn, :show, media_item: media_item) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
defmodule PinchflatWeb.Media.MediaItemHTML do | ||
use PinchflatWeb, :html | ||
|
||
embed_templates "media_item_html/*" | ||
end |
18 changes: 18 additions & 0 deletions
18
lib/pinchflat_web/controllers/media/media_item_html/show.html.heex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<div class="mb-6 flex gap-3 flex-row items-center justify-between"> | ||
<div class="flex gap-3 items-center"> | ||
<.link :if={@conn.params["source_id"]} navigate={~p"/sources/#{@media_item.source_id}"}> | ||
<.icon name="hero-arrow-left" class="w-10 h-10 hover:dark:text-white" /> | ||
</.link> | ||
<h2 class="text-title-md2 font-bold text-black dark:text-white ml-4"> | ||
Media Item #<%= @media_item.id %> | ||
</h2> | ||
</div> | ||
</div> | ||
<div class="rounded-sm border border-stroke bg-white px-5 pb-2.5 pt-6 shadow-default dark:border-strokedark dark:bg-boxdark sm:px-7.5 xl:pb-1"> | ||
<div class="max-w-full overflow-x-auto"> | ||
<div class="flex flex-col gap-10 dark:text-white"> | ||
<h3 class="font-bold text-xl">Attributes</h3> | ||
<.list_items_from_map map={Map.from_struct(@media_item)} /> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
test/pinchflat_web/controllers/media_item_controller_test.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
defmodule PinchflatWeb.MediaItemControllerTest do | ||
use PinchflatWeb.ConnCase | ||
|
||
import Pinchflat.MediaFixtures | ||
|
||
describe "show media" do | ||
setup [:create_media_item] | ||
|
||
test "renders the page", %{conn: conn, media_item: media_item} do | ||
conn = get(conn, ~p"/media/#{media_item}") | ||
assert html_response(conn, 200) =~ "Media Item ##{media_item.id}" | ||
end | ||
end | ||
|
||
defp create_media_item(_) do | ||
media_item = media_item_fixture() | ||
%{media_item: media_item} | ||
end | ||
end |