mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-01-19 22:27:59 +01:00
bans view changes
This commit is contained in:
parent
9ed5652aad
commit
38c4e35bb7
6 changed files with 43 additions and 12 deletions
|
@ -10,6 +10,7 @@
|
||||||
.field
|
.field
|
||||||
=> label f, :reason, "Reason (shown to the banned user, and to staff on the user's profile page):"
|
=> label f, :reason, "Reason (shown to the banned user, and to staff on the user's profile page):"
|
||||||
= text_input f, :reason, class: "input input--wide", placeholder: "Reason", required: true
|
= text_input f, :reason, class: "input input--wide", placeholder: "Reason", required: true
|
||||||
|
= error_tag f, :reason
|
||||||
|
|
||||||
.field
|
.field
|
||||||
=> label f, :note, "Admin-only note:"
|
=> label f, :note, "Admin-only note:"
|
||||||
|
@ -18,5 +19,12 @@
|
||||||
.field
|
.field
|
||||||
=> label f, :until, "End time relative to now, in simple English (e.g. \"1 week from now\"):"
|
=> label f, :until, "End time relative to now, in simple English (e.g. \"1 week from now\"):"
|
||||||
= text_input f, :until, class: "input input--wide", placeholder: "Until", required: true
|
= text_input f, :until, class: "input input--wide", placeholder: "Until", required: true
|
||||||
|
= error_tag f, :until
|
||||||
|
|
||||||
|
br
|
||||||
|
.field
|
||||||
|
=> checkbox f, :enabled
|
||||||
|
= label f, :enabled
|
||||||
|
br
|
||||||
|
|
||||||
= submit "Save Ban", class: "button"
|
= submit "Save Ban", class: "button"
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
.field
|
.field
|
||||||
=> label f, :reason, "Reason (shown to the banned user, and to staff on the user's profile page):"
|
=> label f, :reason, "Reason (shown to the banned user, and to staff on the user's profile page):"
|
||||||
= text_input f, :reason, class: "input input--wide", placeholder: "Reason", required: true
|
= text_input f, :reason, class: "input input--wide", placeholder: "Reason", required: true
|
||||||
|
= error_tag f, :reason
|
||||||
|
|
||||||
.field
|
.field
|
||||||
=> label f, :note, "Admin-only note:"
|
=> label f, :note, "Admin-only note:"
|
||||||
|
@ -18,5 +19,12 @@
|
||||||
.field
|
.field
|
||||||
=> label f, :until, "End time relative to now, in simple English (e.g. \"1 week from now\"):"
|
=> label f, :until, "End time relative to now, in simple English (e.g. \"1 week from now\"):"
|
||||||
= text_input f, :until, class: "input input--wide", placeholder: "Until", required: true
|
= text_input f, :until, class: "input input--wide", placeholder: "Until", required: true
|
||||||
|
= error_tag f, :until
|
||||||
|
|
||||||
|
br
|
||||||
|
.field
|
||||||
|
=> checkbox f, :enabled
|
||||||
|
= label f, :enabled
|
||||||
|
br
|
||||||
|
|
||||||
= submit "Save Ban", class: "button"
|
= submit "Save Ban", class: "button"
|
||||||
|
|
|
@ -7,13 +7,10 @@
|
||||||
=> label f, :username, "Username:"
|
=> label f, :username, "Username:"
|
||||||
= text_input f, :username, class: "input", placeholder: "Username", required: true
|
= text_input f, :username, class: "input", placeholder: "Username", required: true
|
||||||
|
|
||||||
.field
|
|
||||||
=> checkbox f, :override_ip_ban, class: "checkbox"
|
|
||||||
= label f, :override_ip_ban, "Override IP ban?"
|
|
||||||
|
|
||||||
.field
|
.field
|
||||||
=> label f, :reason, "Reason (shown to the banned user, and to staff on the user's profile page):"
|
=> label f, :reason, "Reason (shown to the banned user, and to staff on the user's profile page):"
|
||||||
= text_input f, :reason, class: "input input--wide", placeholder: "Reason", required: true
|
= text_input f, :reason, class: "input input--wide", placeholder: "Reason", required: true
|
||||||
|
= error_tag f, :reason
|
||||||
|
|
||||||
.field
|
.field
|
||||||
=> label f, :note, "Admin-only note:"
|
=> label f, :note, "Admin-only note:"
|
||||||
|
@ -22,5 +19,12 @@
|
||||||
.field
|
.field
|
||||||
=> label f, :until, "End time relative to now, in simple English (e.g. \"1 week from now\"):"
|
=> label f, :until, "End time relative to now, in simple English (e.g. \"1 week from now\"):"
|
||||||
= text_input f, :until, class: "input input--wide", placeholder: "Until", required: true
|
= text_input f, :until, class: "input input--wide", placeholder: "Until", required: true
|
||||||
|
= error_tag f, :until
|
||||||
|
|
||||||
|
br
|
||||||
|
.field
|
||||||
|
=> checkbox f, :enabled
|
||||||
|
= label f, :enabled
|
||||||
|
br
|
||||||
|
|
||||||
= submit "Save Ban", class: "button"
|
= submit "Save Ban", class: "button"
|
||||||
|
|
|
@ -25,7 +25,6 @@ h1 User Bans
|
||||||
th Expires
|
th Expires
|
||||||
th Reason/Note
|
th Reason/Note
|
||||||
th Ban ID
|
th Ban ID
|
||||||
th Auto IP Ban
|
|
||||||
th Options
|
th Options
|
||||||
|
|
||||||
tbody
|
tbody
|
||||||
|
@ -53,11 +52,6 @@ h1 User Bans
|
||||||
td
|
td
|
||||||
= ban.generated_ban_id
|
= ban.generated_ban_id
|
||||||
|
|
||||||
= if ban.override_ip_ban do
|
|
||||||
td.danger Disabled
|
|
||||||
- else
|
|
||||||
td.success Enabled
|
|
||||||
|
|
||||||
td
|
td
|
||||||
=> link "Edit", to: Routes.admin_user_ban_path(@conn, :edit, ban)
|
=> link "Edit", to: Routes.admin_user_ban_path(@conn, :edit, ban)
|
||||||
' •
|
' •
|
||||||
|
|
|
@ -2,6 +2,6 @@ defmodule PhilomenaWeb.BanView do
|
||||||
use PhilomenaWeb, :view
|
use PhilomenaWeb, :view
|
||||||
|
|
||||||
def active?(ban) do
|
def active?(ban) do
|
||||||
NaiveDateTime.diff(ban.valid_until, NaiveDateTime.utc_now()) > 0
|
ban.enabled and NaiveDateTime.diff(ban.valid_until, NaiveDateTime.utc_now()) > 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,23 @@
|
||||||
defmodule RelativeDate.Parser do
|
defmodule RelativeDate.Parser do
|
||||||
import NimbleParsec
|
import NimbleParsec
|
||||||
|
|
||||||
|
number_words =
|
||||||
|
choice([
|
||||||
|
string("a") |> replace(1),
|
||||||
|
string("an") |> replace(1),
|
||||||
|
string("one") |> replace(1),
|
||||||
|
string("two") |> replace(2),
|
||||||
|
string("three") |> replace(3),
|
||||||
|
string("four") |> replace(4),
|
||||||
|
string("five") |> replace(5),
|
||||||
|
string("six") |> replace(6),
|
||||||
|
string("seven") |> replace(7),
|
||||||
|
string("eight") |> replace(8),
|
||||||
|
string("nine") |> replace(9),
|
||||||
|
string("ten") |> replace(10),
|
||||||
|
integer(min: 1)
|
||||||
|
])
|
||||||
|
|
||||||
time_specifier =
|
time_specifier =
|
||||||
choice([
|
choice([
|
||||||
string("second") |> replace(1),
|
string("second") |> replace(1),
|
||||||
|
@ -37,7 +54,7 @@ defmodule RelativeDate.Parser do
|
||||||
|
|
||||||
date =
|
date =
|
||||||
space
|
space
|
||||||
|> integer(min: 1)
|
|> concat(number_words)
|
||||||
|> concat(space)
|
|> concat(space)
|
||||||
|> concat(time_specifier)
|
|> concat(time_specifier)
|
||||||
|> concat(space)
|
|> concat(space)
|
||||||
|
|
Loading…
Reference in a new issue