2 Commits

  1. 9
      CHANGELOG.md
  2. 11
      lib/mirage/notes.ex
  3. 2
      lib/mirage_web/live/inbox_live/index.ex
  4. 12
      lib/mirage_web/live/inbox_live/index.html.leex
  5. 6
      lib/mirage_web/live/note_live/index.ex
  6. 20
      lib/mirage_web/live/note_live/index.html.leex
  7. 2
      mix.exs

9
CHANGELOG.md

@ -5,6 +5,15 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline
<!-- changelog -->
## [v0.90.0](https://git.inhji.de/inhji/mirage/compare/v0.89.1...v0.90.0) (2021-03-28)
### Features:
* move @ notes to /notes, add # notes as pinned
## [v0.89.1](https://git.inhji.de/inhji/mirage/compare/v0.89.0...v0.89.1) (2021-03-27)

11
lib/mirage/notes.ex

@ -41,6 +41,17 @@ defmodule Mirage.Notes do
Repo.all(q)
end
def list_notes(:pinned) do
q =
from n in Note,
where: like(n.title, "#%"),
limit: 3,
select: n,
preload: ^@note_preloads
Repo.all(q)
end
def list_notes(:last_edited) do
q =
from n in Note,

2
lib/mirage_web/live/inbox_live/index.ex

@ -6,7 +6,6 @@ defmodule MirageWeb.InboxLive.Index do
current_user = user_id && Mirage.Accounts.get_user!(user_id)
unlinked = Mirage.Notes.list_notes(:unlinked)
untagged = Mirage.Notes.list_notes(:untagged)
at = Mirage.Notes.list_notes(:at)
today = Mirage.Notes.list_notes(:today)
drafts = Mirage.Lists.get_list_by_name("@drafts")
drafted_notes = if drafts, do: drafts.notes, else: []
@ -18,7 +17,6 @@ defmodule MirageWeb.InboxLive.Index do
current_user: current_user,
notes: %{
today: today,
at: at,
untagged: untagged,
unlinked: unlinked,
drafts: drafted_notes

12
lib/mirage_web/live/inbox_live/index.html.leex

@ -41,15 +41,3 @@
<%= live_component @socket, MirageWeb.InboxLive.ItemComponent, note: note, type: :untagged %>
<% end %>
</section>
<hr>
<section>
<h3><i class="bi bi-puzzle"></i> At</h3>
<%= for note <- @notes.at do %>
<%= live_component @socket, MirageWeb.InboxLive.ItemComponent, note: note, type: :unlinked %>
<% end %>
</section>

6
lib/mirage_web/live/note_live/index.ex

@ -9,13 +9,17 @@ defmodule MirageWeb.NoteLive.Index do
last_edited = Mirage.Notes.list_notes(:last_edited)
most_viewed = Mirage.Notes.list_notes(:most_viewed)
today = Mirage.Notes.list_notes(:today)
at = Mirage.Notes.list_notes(:at)
pinned = Mirage.Notes.list_notes(:pinned)
{:ok,
socket
|> assign(:notes, %{
last_edited: last_edited,
most_viewed: most_viewed,
today: today
today: today,
at: at,
pinned: pinned
})
|> with_user(session)}
end

20
lib/mirage_web/live/note_live/index.html.leex

@ -16,6 +16,26 @@
<hr>
<section>
<h3><i class="bi bi-puzzle"></i> Special</h3>
<%= for note <- @notes.at do %>
<%= live_component @socket, MirageWeb.InboxLive.ItemComponent, note: note, type: :unlinked %>
<% end %>
</section>
<hr>
<section>
<h3><i class="bi bi-pin-angle"></i> Pinned</h3>
<%= for note <- @notes.pinned do %>
<%= live_component @socket, MirageWeb.InboxLive.ItemComponent, note: note, type: :unlinked %>
<% end %>
</section>
<hr>
<section>
<h3><i class="bi bi-pencil"></i> Last Edited</h3>

2
mix.exs

@ -1,7 +1,7 @@
defmodule Mirage.MixProject do
use Mix.Project
@version "0.89.1"
@version "0.90.0"
def project do
[

Loading…
Cancel
Save