Compare commits
2 Commits
0593fcdb9a
...
37dccdd4db
Author | SHA1 | Date |
---|---|---|
Shadowfacts | 37dccdd4db | |
Shadowfacts | 25ed3f53d3 |
|
@ -148,3 +148,7 @@ label.sidebar-toggle > .oi {
|
||||||
.item-content > .raw-content {
|
.item-content > .raw-content {
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.item-table tr > .date {
|
||||||
|
min-width: 200px;
|
||||||
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ defmodule FrenzyWeb.ItemController do
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
def read(conn, _params) do
|
def read(conn, params) do
|
||||||
item = conn.assigns[:item] |> Repo.preload(:feed)
|
item = conn.assigns[:item] |> Repo.preload(:feed)
|
||||||
|
|
||||||
changeset =
|
changeset =
|
||||||
|
@ -42,10 +42,11 @@ defmodule FrenzyWeb.ItemController do
|
||||||
})
|
})
|
||||||
|
|
||||||
{:ok, item} = Repo.update(changeset)
|
{:ok, item} = Repo.update(changeset)
|
||||||
redirect(conn, to: Routes.item_path(Endpoint, :show, item.id))
|
path = Map.get(params, "redirect") || Routes.item_path(Endpoint, :show, item.id)
|
||||||
|
redirect(conn, to: path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def unread(conn, _params) do
|
def unread(conn, params) do
|
||||||
item = conn.assigns[:item] |> Repo.preload(:feed)
|
item = conn.assigns[:item] |> Repo.preload(:feed)
|
||||||
|
|
||||||
changeset =
|
changeset =
|
||||||
|
@ -54,7 +55,8 @@ defmodule FrenzyWeb.ItemController do
|
||||||
read_date: nil
|
read_date: nil
|
||||||
})
|
})
|
||||||
|
|
||||||
Repo.update(changeset)
|
{:ok, item} = Repo.update(changeset)
|
||||||
redirect(conn, to: Routes.item_path(Endpoint, :show, item.id))
|
path = Map.get(params, "redirect") || Routes.item_path(Endpoint, :show, item.id)
|
||||||
|
redirect(conn, to: path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,19 +25,32 @@
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped item-table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<%= for item <- @items do %>
|
<%= for item <- @items do %>
|
||||||
<tr <%= if item.read do %>class="item-read"<% end %>>
|
<tr <%= if item.read do %>class="item-read"<% end %>>
|
||||||
<td>
|
<td>
|
||||||
<a href="<%= Routes.item_path(@conn, :show, item.id) %>"><%= item.title || "(Untitled)" %></a>
|
<a href="<%= Routes.item_path(@conn, :show, item.id) %>"><%= item.title || "(Untitled)" %></a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="date">
|
||||||
<%= if item.date do %>
|
<%= if item.date do %>
|
||||||
<% {:ok, date} = Timex.format(item.date, "{YYYY}-{0M}-{0D} {0h12}:{m} {AM}") %>
|
<% {:ok, date} = Timex.format(item.date, "{YYYY}-{0M}-{0D} {0h12}:{m} {AM}") %>
|
||||||
<%= date %>
|
<%= date %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="py-0 align-middle">
|
||||||
|
<%= if item.read do %>
|
||||||
|
<%= form_tag Routes.item_path(@conn, :unread, item.id), method: :post do %>
|
||||||
|
<input type="hidden" name="redirect" value="<%=Routes.feed_path(@conn, :show, @feed.id) %>">
|
||||||
|
<%= submit "Unread", class: "btn btn-sm btn-secondary" %>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<%= form_tag Routes.item_path(@conn, :read, item.id), method: :post do %>
|
||||||
|
<input type="hidden" name="redirect" value="<%=Routes.feed_path(@conn, :show, @feed.id) %>">
|
||||||
|
<%= submit "Read", class: "btn btn-sm btn-secondary" %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped item-table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<%= for item <- @items do %>
|
<%= for item <- @items do %>
|
||||||
<tr <%= if item.read do %>class="item-read"<% end %>>
|
<tr <%= if item.read do %>class="item-read"<% end %>>
|
||||||
|
@ -15,20 +15,33 @@
|
||||||
<%= item.title || "(Untitled)" %>
|
<%= item.title || "(Untitled)" %>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="align-middle">
|
||||||
<a href="<%= Routes.feed_path(@conn, :show, item.feed.id) %>">
|
<a href="<%= Routes.feed_path(@conn, :show, item.feed.id) %>" style="white-space: nowrap;">
|
||||||
<%= if item.feed.favicon do %>
|
<%= if item.feed.favicon do %>
|
||||||
<img src="<%= item.feed.favicon %>" alt="<%= item.feed.title %> favicon" class="favicon">
|
<img src="<%= item.feed.favicon %>" alt="<%= item.feed.title %> favicon" class="favicon">
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= item.feed.title || "(Untitled)" %>
|
<%= item.feed.title || "(Untitled)" %>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="date align-middle">
|
||||||
<%= if item.date do %>
|
<%= if item.date do %>
|
||||||
<% {:ok, date} = Timex.format(item.date, "{YYYY}-{0M}-{0D} {0h12}:{m} {AM}") %>
|
<% {:ok, date} = Timex.format(item.date, "{YYYY}-{0M}-{0D} {0h12}:{m} {AM}") %>
|
||||||
<%= date %>
|
<%= date %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="py-0 align-middle">
|
||||||
|
<%= if item.read do %>
|
||||||
|
<%= form_tag Routes.item_path(@conn, :unread, item.id), method: :post do %>
|
||||||
|
<input type="hidden" name="redirect" value="<%=Routes.group_path(@conn, :read, @group.id) %>">
|
||||||
|
<%= submit "Unread", class: "btn btn-sm btn-secondary" %>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<%= form_tag Routes.item_path(@conn, :read, item.id), method: :post do %>
|
||||||
|
<input type="hidden" name="redirect" value="<%=Routes.group_path(@conn, :read, @group.id) %>">
|
||||||
|
<%= submit "Read", class: "btn btn-sm btn-secondary" %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in New Issue