5 Commits

  1. 19
      CHANGELOG.md
  2. 7
      assets/css/app.scss
  3. 1
      lib/mirage/links/link.ex
  4. 2
      lib/mirage_web/live/blog_live.html.leex
  5. 8
      lib/mirage_web/live/list_live/index.ex
  6. 34
      lib/mirage_web/live/list_live/index.html.leex
  7. 12
      lib/mirage_web/live/list_live/show.ex
  8. 1
      lib/mirage_web/live/list_live/show.html.leex
  9. 2
      mix.exs

19
CHANGELOG.md

@ -5,6 +5,25 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline
<!-- changelog -->
## [v0.72.0](https://git.inhji.de/inhji/mirage/compare/v0.71.0...v0.72.0) (2021-03-14)
### Features:
* move delete to list show
### Bug Fixes:
* improve empty blog
* use normalize url
### Refactors:
* add width-wrapper variable
## [v0.71.0](https://git.inhji.de/inhji/mirage/compare/v0.70.1...v0.71.0) (2021-03-14)

7
assets/css/app.scss

@ -45,6 +45,7 @@ $colors: (
$font-content: 'Open Sans', Helvetica, sans-serif;
$font-heading: $font-content;
$width-wrapper: 60rem;
$width-sidebar: 15rem;
$width-sidebar-collapsed: 3rem;
@ -117,7 +118,7 @@ a {
/* === Layout === */
.container { max-width: 60rem; }
.container { max-width: $width-wrapper; }
.grid, .flex { display: flex; }
.col, .spacer { flex: 1; }
.flex-1 {flex: 1;}
@ -127,7 +128,7 @@ a {
body.logged-in {
.container {
max-width: 60rem + $width-sidebar;
max-width: $width-wrapper + $width-sidebar;
}
#wrapper {
@ -377,7 +378,7 @@ article {
body.logged-in {
.container {
max-width: 60rem + $width-sidebar-collapsed;
max-width: $width-wrapper + $width-sidebar-collapsed;
}
#wrapper {

1
lib/mirage/links/link.ex

@ -22,6 +22,7 @@ defmodule Mirage.Links.Link do
|> validate_required(:url)
|> unique_constraint(:url)
|> maybe_extract_domain()
|> normalize_url()
|> Mirage.Tags.maybe_load_tag_string()
end

2
lib/mirage_web/live/blog_live.html.leex

@ -11,7 +11,7 @@
return_to: Routes.list_show_path(@socket, :show, @list) %>
<% end %>
<%= if is_nil(@list) do %>
<%= if is_nil(@list) or Enum.count(@list) == 0 do %>
<section class="width-full bg-content">
Looks like you did not create a blog list yet. Just name it <code>@blog</code> and it will show up here.
</section>

8
lib/mirage_web/live/list_live/index.ex

@ -32,14 +32,6 @@ defmodule MirageWeb.ListLive.Index do
|> assign(:list, nil)
end
@impl true
def handle_event("delete", %{"id" => id}, socket) do
list = Lists.get_list!(id)
{:ok, _} = Lists.delete_list(list)
{:noreply, assign(socket, :lists, list_lists())}
end
defp list_lists do
Lists.list_lists()
end

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

@ -1,5 +1,6 @@
<header class="hero">
<h1>Listing Lists</h1>
<%= live_patch "New List", to: Routes.list_index_path(@socket, :new), class: "button" %>
</header>
<%= if @live_action in [:new, :edit] do %>
@ -11,29 +12,14 @@
return_to: Routes.list_index_path(@socket, :index) %>
<% end %>
<table>
<thead>
<tr>
<th>Name</th>
<th>Is public</th>
<th></th>
</tr>
</thead>
<tbody id="lists">
<div class="bg-content width-full">
<div class="cards">
<%= for list <- @lists do %>
<tr id="list-<%= list.id %>">
<td><%= list.name %></td>
<td><%= list.is_public %></td>
<td>
<span><%= live_redirect "Show", to: Routes.list_show_path(@socket, :show, list) %></span>
<span><%= live_patch "Edit", to: Routes.list_index_path(@socket, :edit, list) %></span>
<span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: list.id, data: [confirm: "Are you sure?"] %></span>
</td>
</tr>
<%= live_redirect to: Routes.list_show_path(@socket, :show, list) do %>
<div class="card">
<strong><%= list.name %></strong>
</div>
<% end %>
<% end %>
</tbody>
</table>
<span><%= live_patch "New List", to: Routes.list_index_path(@socket, :new) %></span>
</div>
</div>

12
lib/mirage_web/live/list_live/show.ex

@ -19,6 +19,18 @@ defmodule MirageWeb.ListLive.Show do
|> assign(:list, Lists.get_list!(id))}
end
@impl true
def handle_event("delete", %{"id" => id}, socket) do
list = Lists.get_list!(id)
{:ok, _} = Lists.delete_list(list)
{:noreply, push_redirect(socket, to: Routes.list_index_path(socket, :index))}
end
defp list_lists do
Lists.list_lists()
end
defp page_title(:show), do: "Show List"
defp page_title(:edit), do: "Edit List"
end

1
lib/mirage_web/live/list_live/show.html.leex

@ -34,5 +34,6 @@
<%= if @current_user do %>
<div class="buttons">
<%= live_patch "Edit", to: Routes.list_show_path(@socket, :edit, @list), class: "button" %>
<%= link "Delete", to: "#", phx_click: "delete", phx_value_id: @list.id, data: [confirm: "Are you sure?"], class: "button" %>
</div>
<% end %>

2
mix.exs

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

Loading…
Cancel
Save