6 Commits

  1. 19
      CHANGELOG.md
  2. 22
      README.md
  3. 19
      lib/mirage_web/controllers/user_controller.ex
  4. 24
      lib/mirage_web/live/inbox_live.ex
  5. 16
      lib/mirage_web/live/inbox_live.html.leex
  6. 4
      lib/mirage_web/live/list_live/index.html.leex
  7. 4
      lib/mirage_web/router.ex
  8. 22
      lib/mirage_web/templates/layout/_sidebar.html.eex
  9. 2
      lib/mirage_web/templates/setting/index.html.eex
  10. 2
      mix.exs

19
CHANGELOG.md

@ -5,6 +5,25 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline
<!-- changelog -->
## [v0.65.0](https://git.inhji.de/inhji/mirage/compare/v0.64.0...v0.65.0) (2021-03-09)
### Chores:
* remove user routes
### Features:
* Add Inbox Live
### Bug Fixes:
* clean up
* add hero to lists
## [v0.64.0](https://git.inhji.de/inhji/mirage/compare/v0.63.0...v0.64.0) (2021-03-09)

22
README.md

@ -1,25 +1,15 @@
# Mirage
To generate a release:
Available mix tasks:
* Create a new release commit and generate the changelog with `mix rel`
* Deploy build the release and publish it with `mix deploy`
* `mix deploy`: Generate changelog, release and deploy
* `mix rel`: Generate changelog
* `mix push`: Deploy release
* `mix deps`: Update Hex.pm and npm deps
To start your Phoenix server:
* Install dependencies with `mix deps.get`
* Create and migrate your database with `mix ecto.setup`
* Install Node.js dependencies with `npm install` inside the `assets` directory
* Start Phoenix endpoint with `mix phx.server`
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html).
## Learn more
* Official website: https://www.phoenixframework.org/
* Guides: https://hexdocs.pm/phoenix/overview.html
* Docs: https://hexdocs.pm/phoenix
* Forum: https://elixirforum.com/c/phoenix-forum
* Source: https://github.com/phoenixframework/phoenix
* Start Phoenix endpoint with `mix phx.server`

19
lib/mirage_web/controllers/user_controller.ex

@ -1,19 +0,0 @@
defmodule MirageWeb.UserController do
use MirageWeb, :controller
def index(conn, _params) do
unlinked = Mirage.Notes.list_notes(:unlinked)
untagged = Mirage.Notes.list_notes(:untagged)
at = Mirage.Notes.list_notes(:at)
today = Mirage.Notes.list_notes(:today)
render(conn, "index.html",
notes: %{
today: today,
at: at,
untagged: untagged,
unlinked: unlinked
}
)
end
end

24
lib/mirage_web/live/inbox_live.ex

@ -0,0 +1,24 @@
defmodule MirageWeb.InboxLive do
use MirageWeb, :live_view
@impl true
def mount(_params, %{"user_id" => user_id}, socket) do
current_user = user_id && Mirage.Accounts.get_user!(user_id)
settings = Mirage.Settings.list_settings_as_map()
unlinked = Mirage.Notes.list_notes(:unlinked)
untagged = Mirage.Notes.list_notes(:untagged)
at = Mirage.Notes.list_notes(:at)
today = Mirage.Notes.list_notes(:today)
{:ok,
assign(socket, %{
current_user: current_user,
notes: %{
today: today,
at: at,
untagged: untagged,
unlinked: unlinked
}
})}
end
end

16
lib/mirage_web/templates/user/index.html.eex → lib/mirage_web/live/inbox_live.html.leex

@ -1,3 +1,7 @@
<%= if @current_user do %>
<%= live_render @socket, MirageWeb.GotoAnythingLive, id: "goto-anything-wrapper" %>
<% end %>
<header class="hero">
<h1>Inbox</h1>
</header>
@ -7,7 +11,7 @@
<div class="cards">
<%= for note <- @notes.today do %>
<%= link to: Routes.note_show_path(@conn, :show, note), class: "col card" do %>
<%= live_patch to: Routes.note_show_path(MirageWeb.Endpoint, :show, note), class: "col card" do %>
<strong><%= note.title %></strong>
<p><%= note.content |> String.slice(0..50) %></p>
<% end %>
@ -21,7 +25,7 @@
<div class="grid cards">
<%= for note <- @notes.unlinked do %>
<%= link to: Routes.note_show_path(@conn, :show, note), class: "col card" do %>
<%= live_patch to: Routes.note_show_path(MirageWeb.Endpoint, :show, note), class: "col card" do %>
<strong><%= note.title %></strong>
<p><%= note.content |> String.slice(0..50) %></p>
<% end %>
@ -36,7 +40,7 @@
<div class="grid cards">
<%= for note <- @notes.untagged do %>
<%= link to: Routes.note_show_path(@conn, :show, note), class: "col card" do %>
<%= live_patch to: Routes.note_show_path(MirageWeb.Endpoint, :show, note), class: "col card" do %>
<strong><%= note.title %></strong>
<p><%= note.content |> String.slice(0..50) %></p>
<% end %>
@ -50,7 +54,7 @@
<div class="grid cards">
<%= for note <- @notes.at do %>
<%= link to: Routes.note_show_path(@conn, :show, note), class: "col card" do %>
<%= live_patch to: Routes.note_show_path(MirageWeb.Endpoint, :show, note), class: "col card" do %>
<strong><%= note.title %></strong>
<p><%= note.content |> String.slice(0..50) %></p>
<% end %>
@ -59,5 +63,5 @@
</section>
<div class="buttons">
<%= link "Edit User", to: Routes.user_settings_path(@conn, :edit), class: "button" %>
</div>
<%= link "Edit User", to: Routes.user_settings_path(MirageWeb.Endpoint, :edit), class: "button" %>
</div>

4
lib/mirage_web/live/list_live/index.html.leex

@ -1,4 +1,6 @@
<h1>Listing Lists</h1>
<header class="hero">
<h1>Listing Lists</h1>
</header>
<%= if @live_action in [:new, :edit] do %>
<%= live_modal @socket, MirageWeb.ListLive.FormComponent,

4
lib/mirage_web/router.ex

@ -84,9 +84,9 @@ defmodule MirageWeb.Router do
scope "/", MirageWeb do
pipe_through [:browser, :require_authenticated_user]
get "/user", UserController, :index
live "/inbox", InboxLive
resources "/user/settings", SettingController, only: [:index, :show, :edit, :update]
resources "/settings", SettingController, only: [:index, :show, :edit, :update]
get "/user/edit", UserSettingsController, :edit
put "/user/edit", UserSettingsController, :update

22
lib/mirage_web/templates/layout/_sidebar.html.eex

@ -3,7 +3,7 @@
<li>
<a>&nbsp;</a>
</li>
<%= active_link(@conn, to: Routes.user_path(@conn, :index), wrap_tag: :li) do %>
<%= active_link(@conn, to: Routes.live_path(@conn, MirageWeb.InboxLive), wrap_tag: :li) do %>
<span class="icon">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="icon" viewBox="0 0 16 16">
<path d="M4.98 4a.5.5 0 0 0-.39.188L1.54 8H6a.5.5 0 0 1 .5.5 1.5 1.5 0 1 0 3 0A.5.5 0 0 1 10 8h4.46l-3.05-3.812A.5.5 0 0 0 11.02 4H4.98zm9.954 5H10.45a2.5 2.5 0 0 1-4.9 0H1.066l.32 2.562a.5.5 0 0 0 .497.438h12.234a.5.5 0 0 0 .496-.438L14.933 9zM3.809 3.563A1.5 1.5 0 0 1 4.981 3h6.038a1.5 1.5 0 0 1 1.172.563l3.7 4.625a.5.5 0 0 1 .105.374l-.39 3.124A1.5 1.5 0 0 1 14.117 13H1.883a1.5 1.5 0 0 1-1.489-1.314l-.39-3.124a.5.5 0 0 1 .106-.374l3.7-4.625z"/>
@ -47,16 +47,14 @@
</span>
<span class="label">Lists</span>
<% end %>
<li>
<a href="/user/settings">
<span class="icon">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="icon" viewBox="0 0 16 16">
<path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492zM5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0z"/>
<path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52l-.094-.319zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.377l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115l.094-.319z"/>
</svg>
</span>
<span class="label">Settings</span>
</a>
</li>
<%= active_link(@conn, to: "/settings", wrap_tag: :li) do %>
<span class="icon">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="icon" viewBox="0 0 16 16">
<path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492zM5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0z"/>
<path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52l-.094-.319zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.377l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115l.094-.319z"/>
</svg>
</span>
<span class="label">Settings</span>
<% end %>
</ul>
</aside>

2
lib/mirage_web/templates/setting/index.html.eex

@ -1,5 +1,5 @@
<header class="hero">
<h1>Listing Settings</h1>
<h1>Settings</h1>
</header>
<div class="width-full bg-content">

2
mix.exs

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

Loading…
Cancel
Save