Index controller built out.
This commit is contained in:
parent
3f508c1781
commit
3caf827e55
@ -23,6 +23,7 @@ defmodule LogsrvApi.Filesystem do
|
||||
def all(Page) do
|
||||
dir(:pages)
|
||||
|> File.ls!
|
||||
|> Enum.sort
|
||||
|> Enum.map(fn(fd) ->
|
||||
Page.init(fd)
|
||||
end)
|
||||
@ -31,6 +32,7 @@ defmodule LogsrvApi.Filesystem do
|
||||
def all(Journal) do
|
||||
dir(:journals)
|
||||
|> File.ls!
|
||||
|> Enum.sort |> Enum.reverse
|
||||
|> Enum.map(fn(fd) ->
|
||||
Journal.init(fd)
|
||||
end)
|
||||
|
||||
@ -2,12 +2,16 @@ defmodule LogsrvApi.Page do
|
||||
alias LogsrvApi.{Filesystem,Page,Journal}
|
||||
|
||||
def init(fd) do
|
||||
title = fd |> String.replace(~r/_/," ") |> String.replace(~r/\.md$/,"")
|
||||
title = fd
|
||||
|> String.replace(~r/_/," ")
|
||||
|> String.replace(~r/\.md$/,"")
|
||||
|> String.replace("%2F","/")
|
||||
|
||||
date_modified = Page |> Filesystem.locate(fd)
|
||||
tags = [:fun]
|
||||
|
||||
%{
|
||||
title: title,
|
||||
title: title |> String.capitalize(),
|
||||
filename: fd,
|
||||
date_modified: date_modified,
|
||||
tags: tags
|
||||
|
||||
@ -11,9 +11,14 @@
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<section class="container">
|
||||
<img style="padding:1em;border-radius:1em;" src={Routes.static_path(@conn, "/images/logseq-logo.png")} alt="Logo"/>
|
||||
</section>
|
||||
<section class="container" style="flex-direction:row-reverse;">
|
||||
<img style="padding:1em;border-radius:1em;" src={Routes.static_path(@conn, "/images/logseq-logo.png")} alt="Logo"/>
|
||||
<ul>
|
||||
<li> <b>Directory:</b> <%= LogsrvApi.Filesystem.dir %> </li>
|
||||
<li> <b>Journals:</b> <%= @pages |> length %> </li>
|
||||
<li> <b>Pages:</b> <%= @journals |> length %> </li>
|
||||
</ul>
|
||||
</section>
|
||||
</header>
|
||||
<%= @inner_content %>
|
||||
</body>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user