various fixes:

line-heights
ability to edit filters
fix tag parameter decoding again
better error_tag message
This commit is contained in:
byte[] 2019-12-12 10:51:44 -05:00
parent 54be9dfa5d
commit d851e8cf62
6 changed files with 19 additions and 4 deletions

View file

@ -27,13 +27,14 @@ body {
font-size: 13px; font-size: 13px;
margin: 0; margin: 0;
padding: 0; padding: 0;
line-height: 15px; line-height: 1.15em;
} }
h1, h2, h3, h4, h5 { h1, h2, h3, h4, h5 {
font-weight: normal; font-weight: normal;
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
margin-bottom: 0.62em; margin-bottom: 0.62em;
line-height: 1.15em;
} }
h1 { font-size: 24px; } h1 { font-size: 24px; }

View file

@ -115,7 +115,8 @@ defimpl Canada.Can, for: [Atom, Philomena.Users.User] do
# View filters they own and system filters # View filters they own and system filters
def can?(_user, :show, %Filter{system: true}), do: true def can?(_user, :show, %Filter{system: true}), do: true
def can?(%User{id: id}, :show, %Filter{user_id: id}), do: true def can?(%User{}, action, Filter) when action in [:index, :new, :create], do: true
def can?(%User{id: id}, action, %Filter{user_id: id}) when action in [:show, :edit, :update], do: true
# Edit filters they own # Edit filters they own
def can?(%User{id: id}, action, %Filter{user_id: id}) when action in [:edit, :update], do: true def can?(%User{id: id}, action, %Filter{user_id: id}) when action in [:edit, :update], do: true

View file

@ -29,6 +29,7 @@ defmodule PhilomenaWeb.ImageReverse do
{:ok, analysis} = Analyzers.analyze(path) {:ok, analysis} = Analyzers.analyze(path)
{analysis, path} {analysis, path}
end end
defp analyze(_upload), do: :error
defp intensities(:error), do: :error defp intensities(:error), do: :error
defp intensities({analysis, path}) do defp intensities({analysis, path}) do

View file

@ -9,6 +9,7 @@ defmodule PhilomenaWeb.RecodeParameterPlug do
|> to_string() |> to_string()
|> URI.encode_www_form() |> URI.encode_www_form()
|> String.replace("%2B", "+") |> String.replace("%2B", "+")
|> String.replace("%25", "%")
params = Map.put(conn.params, name, fixed_value) params = Map.put(conn.params, name, fixed_value)

View file

@ -40,3 +40,6 @@
br br
= button_to "Remove my avatar", Routes.avatar_path(@conn, :delete), method: "delete", class: "button", data: [confirm: "Are you really, really sure?"] = button_to "Remove my avatar", Routes.avatar_path(@conn, :delete), method: "delete", class: "button", data: [confirm: "Are you really, really sure?"]
br
= link "Back", to: Routes.pow_registration_path(@conn, :edit)

View file

@ -10,7 +10,7 @@ defmodule PhilomenaWeb.ErrorHelpers do
""" """
def error_tag(form, field) do def error_tag(form, field) do
Enum.map(Keyword.get_values(form.errors, field), fn error -> Enum.map(Keyword.get_values(form.errors, field), fn error ->
content_tag(:span, translate_error(error), class: "help-block") content_tag(:span, humanize_name(field) <> translate_error(error), class: "help-block")
end) end)
end end
@ -41,4 +41,12 @@ defmodule PhilomenaWeb.ErrorHelpers do
Gettext.dgettext(PhilomenaWeb.Gettext, "errors", msg, opts) Gettext.dgettext(PhilomenaWeb.Gettext, "errors", msg, opts)
end end
end end
defp humanize_name(field) do
field
|> to_string()
|> String.replace("_", " ")
|> String.capitalize()
|> Kernel.<>(" ")
end
end end