mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-03-28 06:17:46 +01:00
Minor fixup
This commit is contained in:
parent
9782c943c2
commit
9e9a8d3e41
2 changed files with 13 additions and 11 deletions
|
@ -28,10 +28,16 @@ defmodule PhilomenaWeb.Profile.TagChangeController do
|
|||
|> order_by(desc: :id)
|
||||
|> Repo.paginate(conn.assigns.scrivener)
|
||||
|
||||
# params.permit(:added, :only_tag) ...
|
||||
pagination_params =
|
||||
[added: conn.params["added"], only_tag: conn.params["only_tag"]]
|
||||
|> Keyword.filter(fn {k, _v} -> Map.has_key?(conn.params, "#{k}") end)
|
||||
|
||||
render(conn, "index.html",
|
||||
title: "Tag Changes for User `#{user.name}'",
|
||||
user: user,
|
||||
tag_changes: tag_changes
|
||||
tag_changes: tag_changes,
|
||||
pagination_params: pagination_params
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,20 +4,16 @@ h1
|
|||
= @user.name
|
||||
|
||||
- route = fn p -> Routes.profile_tag_change_path(@conn, :index, @user, p) end
|
||||
- only_tag = if is_binary(@conn.params["only_tag"]) && @conn.params["only_tag"] != "", do: @conn.params["only_tag"]
|
||||
- only_tag_param = (if only_tag, do: [only_tag: only_tag], else: [])
|
||||
- params = (if @conn.params["added"], do: [added: @conn.params["added"]], else: []) ++ only_tag_param
|
||||
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @tag_changes, route: route, conn: @conn, params: params
|
||||
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @tag_changes, route: route, conn: @conn, params: @pagination_params
|
||||
|
||||
.block
|
||||
.block__header
|
||||
= form_for @conn, Routes.profile_tag_change_path(@conn, :index, @user), [method: "get", enforce_utf8: false], fn f ->
|
||||
input.input name="only_tag" title="Only show this tag." value=only_tag placeholder="Tag" autocapitalize="none"
|
||||
button.button type="submit" title="Search"
|
||||
i.fa.fa-search
|
||||
= text_input f, :only_tag, class: "input", placeholder: "Tag", title: "Only show this tag", autocapitalize: "none"
|
||||
= submit "Search", class: "button", title: "Search"
|
||||
|
||||
= link "Removed", to: Routes.profile_tag_change_path(@conn, :index, @user, [added: 0] ++ only_tag_param)
|
||||
= link "Added", to: Routes.profile_tag_change_path(@conn, :index, @user, [added: 1] ++ only_tag_param)
|
||||
= link "All", to: Routes.profile_tag_change_path(@conn, :index, @user, only_tag_param)
|
||||
= link "Removed", to: Routes.profile_tag_change_path(@conn, :index, @user, Keyword.merge(@pagination_params, added: 0))
|
||||
= link "Added", to: Routes.profile_tag_change_path(@conn, :index, @user, Keyword.merge(@pagination_params, added: 1))
|
||||
= link "All", to: Routes.profile_tag_change_path(@conn, :index, @user, Keyword.delete(@pagination_params, :added))
|
||||
|
||||
= render PhilomenaWeb.TagChangeView, "index.html", conn: @conn, tag_changes: @tag_changes, pagination: pagination
|
||||
|
|
Loading…
Add table
Reference in a new issue