mix convert_to_heex

This commit is contained in:
Liam 2024-06-01 23:50:36 -04:00
parent 7d03903622
commit d4cf28f986
546 changed files with 13856 additions and 9376 deletions

View file

@ -0,0 +1,32 @@
<div class="block__content flex alternating-color">
<div class="flex__grow">
<% # TODO %>
<a href={~p"/channels/#{@channel}"}>
<% # - if channel.channel_image.present? %>
<% # => image_tag channel.uploaded_channel_image.url, width: 32, height: 32, alt: "#{channel.title}'s logo'", class: 'channel-strip__image' %>
<% # - else %>
<% # => image_tag 'no_avatar_original.svg', width: 32, height: 32, alt: "#{channel.title}'s logo'", class: 'channel-strip__image' %>
<%= @channel.title || @channel.short_name %>
</a>
</div>
<div class="flex__fixed flex__right">
<%= if @channel.is_live do %>
<span class="channel-strip__state label label--narrow label--success">
LIVE NOW
</span>
<br />
<%= @channel.viewers %>
<%=
if @channel.viewers == 1 do
"viewer"
else
"viewers"
end
%>
<% else %>
<span class="channel-strip__state label label--narrow label--danger">
OFF AIR
</span>
<% end %>
</div>
</div>

View file

@ -1,19 +0,0 @@
.block__content.flex.alternating-color
.flex__grow
/ TODO
a href=~p"/channels/#{@channel}"
/- if channel.channel_image.present?
/ => image_tag channel.uploaded_channel_image.url, width: 32, height: 32, alt: "#{channel.title}'s logo'", class: 'channel-strip__image'
/- else
/ => image_tag 'no_avatar_original.svg', width: 32, height: 32, alt: "#{channel.title}'s logo'", class: 'channel-strip__image'
= @channel.title || @channel.short_name
.flex__fixed.flex__right
= if @channel.is_live do
span.channel-strip__state.label.label--narrow.label--success
' LIVE NOW
br
=> @channel.viewers
= if @channel.viewers == 1, do: "viewer", else: "viewers"
- else
span.channel-strip__state.label.label--narrow.label--danger
' OFF AIR

View file

@ -0,0 +1,17 @@
<div class="block__content flex alternating-color">
<div class="flex__shrink spacing-right">
<%= render(PhilomenaWeb.ImageView, "_image_container.html", image: @comment.image, size: :thumb_tiny, conn: @conn) %>
</div>
<div class="flex__grow">
<a href={"/#{@comment.image.id}#comment_#{@comment.id}"}>
#
<%= @comment.image.id %>
</a>
by
<span class="hyphenate-breaks">
<%= render(PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @comment, conn: @conn) %>
</span>
<br />
<%= pretty_time(@comment.created_at) %>
</div>
</div>

View file

@ -1,12 +0,0 @@
.block__content.flex.alternating-color
.flex__shrink.spacing-right
= render PhilomenaWeb.ImageView, "_image_container.html", image: @comment.image, size: :thumb_tiny, conn: @conn
.flex__grow
a href="/#{@comment.image.id}#comment_#{@comment.id}"
| #
=> @comment.image.id
' by
span.hyphenate-breaks
= render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @comment, conn: @conn
br
= pretty_time(@comment.created_at)

View file

@ -0,0 +1,14 @@
<div class="block__content alternating-color">
<%= if @topic.sticky do %>
<i class="fa fa-thumbtack"></i>
<% end %>
<%= if @topic.last_post do %>
<span class="hyphenate-breaks">
<%= render(PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @topic.last_post, conn: @conn) %>
</span>
<%= link("replied to", to: ~p"/forums/#{@topic.forum}/topics/#{@topic}?#{[post_id: @topic.last_post]}" <> "#post_#{@topic.last_post.id}") %>
<% end %>
<%= link(@topic.title, to: ~p"/forums/#{@topic.forum}/topics/#{@topic}") %>
in
<%= link(@topic.forum.name, to: ~p"/forums/#{@topic.forum}") %>
</div>

View file

@ -1,10 +0,0 @@
.block__content.alternating-color
= if @topic.sticky do
i.fa.fa-thumbtack>
= if @topic.last_post do
span.hyphenate-breaks
= render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @topic.last_post, conn: @conn
= link("replied to", to: ~p"/forums/#{@topic.forum}/topics/#{@topic}?#{[post_id: @topic.last_post]}" <> "#post_#{@topic.last_post.id}")
=<> link(@topic.title, to: ~p"/forums/#{@topic.forum}/topics/#{@topic}")
' in
=> link(@topic.forum.name, to: ~p"/forums/#{@topic.forum}")

View file

@ -0,0 +1,89 @@
<div class="column-layout">
<%= if @show_sidebar do %>
<aside class="column-layout__left" id="activity-side">
<%= if not is_nil(@featured_image) and not PhilomenaWeb.ImageView.filter_or_spoiler_hits?(@conn, @featured_image) do %>
<div class="center">
<h4 class="remove-top-margin">
Featured Image
</h4>
<%= render(PhilomenaWeb.ImageView, "_image_box.html", image: @featured_image, size: :medium, conn: @conn) %>
</div>
<% end %>
<div class="block block--fixed block--fixed--sub block--success center hide-mobile">
Enjoy the site?
<a href="/pages/donations">
Become a patron or donate!
</a>
</div>
<div class="block block--fixed block--fixed--sub center hide-mobile">
Issues? Want to chat?
<a href="/pages/contact">
Contact us!
</a>
</div>
<div class="block hide-mobile">
<a class="block__header--single-item center" href="/search?q=first_seen_at.gt:3 days ago&amp;sf=wilson_score&amp;sd=desc">
Trending Images
</a>
<div class="block__content flex flex--centered flex--wrap image-flex-grid">
<%= for image <- @top_scoring do %>
<%= render(PhilomenaWeb.ImageView, "_image_box.html", image: image, size: :thumb_small, conn: @conn) %>
<% end %>
</div>
<a class="block__header--single-item center" href="/search?q=*&amp;sf=score&amp;sd=desc">
All Time Top Scoring
</a>
</div>
<div class="block hide-mobile">
<a class="block__header--single-item center" href="/channels">
Streams
</a>
<%= for channel <- @streams do %>
<%= render(PhilomenaWeb.ActivityView, "_channel_strip.html", channel: channel, conn: @conn) %>
<% end %>
</div>
<div class="block hide-mobile">
<a class="block__header--single-item center" href="/forums">
Forum Activity
</a>
<%= for topic <- @topics do %>
<%= render(PhilomenaWeb.ActivityView, "_topic_strip.html", topic: topic, conn: @conn) %>
<% end %>
</div>
<div class="block hide-mobile">
<a class="block__header--single-item center" href="/comments">
Recent Comments
</a>
<%= for comment <- @comments do %>
<%= render(PhilomenaWeb.ActivityView, "_comment_strip.html", comment: comment, conn: @conn) %>
<% end %>
<a class="block__header--single-item center" href="/search?q=first_seen_at.gt:3 days ago&amp;sf=comment_count&amp;sd=desc">
Most Commented-on Images
</a>
</div>
</aside>
<% end %>
<div class="column-layout__main">
<%= render(PhilomenaWeb.ImageView, "index.html", conn: @conn, images: @images, size: :thumb) %>
<%= if @show_sidebar and not is_nil(@watched) and Enum.any?(@watched) do %>
<div class="block">
<div class="block__header">
<span class="block__header__title">
Watched Images
</span>
<a href="/search?q=my:watched" title="Browse Watched Images">
<i class="fa fa-eye"></i>
<span class="hide-mobile">
Browse Watched Images
</span>
</a>
</div>
<div class="block__content js-resizable-media-container">
<%= for image <- @watched do %>
<%= render(PhilomenaWeb.ImageView, "_image_box.html", image: image, link: ~p"/images/#{image}?#{[q: "my:watched"]}", size: :thumb_small, conn: @conn) %>
<% end %>
</div>
</div>
<% end %>
</div>
</div>

View file

@ -1,54 +0,0 @@
.column-layout
= if @show_sidebar do
aside.column-layout__left#activity-side
= if not is_nil(@featured_image) and not PhilomenaWeb.ImageView.filter_or_spoiler_hits?(@conn, @featured_image) do
.center
h4.remove-top-margin Featured Image
= render PhilomenaWeb.ImageView, "_image_box.html", image: @featured_image, size: :medium, conn: @conn
.block.block--fixed.block--fixed--sub.block--success.center.hide-mobile
' Enjoy the site?
a href="/pages/donations"
' Become a patron or donate!
.block.block--fixed.block--fixed--sub.center.hide-mobile
' Issues? Want to chat?
a href="/pages/contact" Contact us!
.block.hide-mobile
a.block__header--single-item.center href="/search?q=first_seen_at.gt:3 days ago&amp;sf=wilson_score&amp;sd=desc"
' Trending Images
.block__content.flex.flex--centered.flex--wrap.image-flex-grid
= for image <- @top_scoring do
= render PhilomenaWeb.ImageView, "_image_box.html", image: image, size: :thumb_small, conn: @conn
a.block__header--single-item.center href="/search?q=*&amp;sf=score&amp;sd=desc"
' All Time Top Scoring
.block.hide-mobile
a.block__header--single-item.center href="/channels"
' Streams
= for channel <- @streams do
= render PhilomenaWeb.ActivityView, "_channel_strip.html", channel: channel, conn: @conn
.block.hide-mobile
a.block__header--single-item.center href="/forums"
' Forum Activity
= for topic <- @topics do
= render PhilomenaWeb.ActivityView, "_topic_strip.html", topic: topic, conn: @conn
.block.hide-mobile
a.block__header--single-item.center href="/comments"
' Recent Comments
= for comment <- @comments do
= render PhilomenaWeb.ActivityView, "_comment_strip.html", comment: comment, conn: @conn
a.block__header--single-item.center href="/search?q=first_seen_at.gt:3 days ago&amp;sf=comment_count&amp;sd=desc"
' Most Commented-on Images
.column-layout__main
= render PhilomenaWeb.ImageView, "index.html", conn: @conn, images: @images, size: :thumb
= if @show_sidebar and not is_nil(@watched) and Enum.any?(@watched) do
.block
.block__header
span.block__header__title
' Watched Images
a href="/search?q=my:watched" title="Browse Watched Images"
i.fa.fa-eye>
span.hide-mobile
' Browse Watched Images
.block__content.js-resizable-media-container
= for image <- @watched do
= render PhilomenaWeb.ImageView, "_image_box.html", image: image, link: ~p"/images/#{image}?#{[q: "my:watched"]}", size: :thumb_small, conn: @conn

View file

@ -0,0 +1,59 @@
<%= form_for @changeset, @action, [multipart: true], fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>
Oops, something went wrong! Please check the errors below.
</p>
</div>
<% end %>
<%= if @changeset.data.__meta__.state != :loaded do %>
<div class="field">
<%= label(f, :image, "Upload image:") %>
<%= file_input(f, :image, class: "input input--wide") %>
<%= error_tag(f, :image) %>
<%= error_tag(f, :image_mime_type) %>
<%= error_tag(f, :image_size) %>
<%= error_tag(f, :image_width) %>
<%= error_tag(f, :image_height) %>
</div>
<% else %>
<div class="field">
<%= link("Change image", to: ~p"/admin/adverts/#{@changeset.data}/image/edit", class: "button") %>
</div>
<% end %>
<div class="field">
<%= label(f, :link, "Link which the advert should take users to:") %>
<%= url_input(f, :link, class: "input input--wide", placeholder: "Link", required: true) %>
<%= error_tag(f, :link) %>
</div>
<div class="field">
<%= label(f, :title, "Title/alt-text for the advert:") %>
<%= text_input(f, :title, class: "input input--wide", placeholder: "Title", required: true) %>
<%= error_tag(f, :title) %>
</div>
<div class="field">
<%= label(f, :start_time, "Start time for the advert (usually \"now\"):") %>
<%= text_input(f, :start_time, class: "input input--wide", placeholder: "Start") %>
<%= error_tag(f, :start_time) %>
</div>
<div class="field">
<%= label(f, :finish_time, "Finish time for the advert (e.g. \"2 weeks from now\"):") %>
<%= text_input(f, :finish_time, class: "input input--wide", placeholder: "Finish") %>
<%= error_tag(f, :finish_time) %>
</div>
<div class="field">
<%= label(f, :notes, "Notes (Payment details, contact info, etc):") %>
<%= text_input(f, :notes, class: "input input--wide", placeholder: "Notes") %>
<%= error_tag(f, :notes) %>
</div>
<div class="field">
<%= label(f, :restrictions, "Restriction:") %>
<%= select(f, :restrictions, restrictions(), class: "input") %>
<%= error_tag(f, :restrictions) %>
</div>
<div class="field">
<%= checkbox(f, :live, class: "checkbox") %>
<%= label(f, :live, "Live") %>
</div>
<%= submit("Save Advert", class: "button") %>
<% end %>

View file

@ -1,53 +0,0 @@
= form_for @changeset, @action, [multipart: true], fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
= if @changeset.data.__meta__.state != :loaded do
.field
=> label f, :image, "Upload image:"
= file_input f, :image, class: "input input--wide"
= error_tag f, :image
= error_tag f, :image_mime_type
= error_tag f, :image_size
= error_tag f, :image_width
= error_tag f, :image_height
- else
.field
= link "Change image", to: ~p"/admin/adverts/#{@changeset.data}/image/edit", class: "button"
.field
=> label f, :link, "Link which the advert should take users to:"
= url_input f, :link, class: "input input--wide", placeholder: "Link", required: true
= error_tag f, :link
.field
=> label f, :title, "Title/alt-text for the advert:"
= text_input f, :title, class: "input input--wide", placeholder: "Title", required: true
= error_tag f, :title
.field
=> label f, :start_time, "Start time for the advert (usually \"now\"):"
= text_input f, :start_time, class: "input input--wide", placeholder: "Start"
= error_tag f, :start_time
.field
=> label f, :finish_time, "Finish time for the advert (e.g. \"2 weeks from now\"):"
= text_input f, :finish_time, class: "input input--wide", placeholder: "Finish"
= error_tag f, :finish_time
.field
=> label f, :notes, "Notes (Payment details, contact info, etc):"
= text_input f, :notes, class: "input input--wide", placeholder: "Notes"
= error_tag f, :notes
.field
=> label f, :restrictions, "Restriction:"
= select f, :restrictions, restrictions(), class: "input"
= error_tag f, :restrictions
.field
=> checkbox f, :live, class: "checkbox"
= label f, :live, "Live"
= submit "Save Advert", class: "button"

View file

@ -0,0 +1,4 @@
<h1>
Editing advert
</h1>
<%= render(PhilomenaWeb.Admin.AdvertView, "_form.html", changeset: @changeset, action: ~p"/admin/adverts/#{@advert}", conn: @conn) %>

View file

@ -1,2 +0,0 @@
h1 Editing advert
= render PhilomenaWeb.Admin.AdvertView, "_form.html", changeset: @changeset, action: ~p"/admin/adverts/#{@advert}", conn: @conn

View file

@ -0,0 +1,22 @@
<h2>
Edit Advert
</h2>
<%= form_for @changeset, ~p"/admin/adverts/#{@advert}/image", [multipart: true], fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>
Oops, something went wrong! Please check the errors below.
</p>
</div>
<% end %>
<div class="field">
<%= label(f, :image, "Upload image:") %>
<%= file_input(f, :image, class: "input input--wide") %>
<%= error_tag(f, :image) %>
<%= error_tag(f, :image_mime_type) %>
<%= error_tag(f, :image_size) %>
<%= error_tag(f, :image_width) %>
<%= error_tag(f, :image_height) %>
</div>
<%= submit("Save Advert", class: "button") %>
<% end %>

View file

@ -1,17 +0,0 @@
h2 Edit Advert
= form_for @changeset, ~p"/admin/adverts/#{@advert}/image", [multipart: true], fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
.field
=> label f, :image, "Upload image:"
= file_input f, :image, class: "input input--wide"
= error_tag f, :image
= error_tag f, :image_mime_type
= error_tag f, :image_size
= error_tag f, :image_width
= error_tag f, :image_height
= submit "Save Advert", class: "button"

View file

@ -0,0 +1,99 @@
<% route = fn p -> ~p"/admin/adverts?#{p}" end %>
<% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @adverts, route: route) %>
<div class="block">
<div class="block__header">
<a href={~p"/admin/adverts/new"}>
<i class="fa fa-plus"></i>
New advert
</a>
<%= pagination %>
</div>
<div class="block__content">
<table class="table">
<thead>
<tr>
<th class="table--adverts__image">
Image
</th>
<th>
Ad Information
</th>
<th>
Start
</th>
<th>
Finish
</th>
<th>
Enabled
</th>
<th>
Restriction
</th>
<th>
Statistics
</th>
<th>
Options
</th>
</tr>
</thead>
<tbody>
<%= for advert <- @adverts do %>
<tr>
<td>
<img src={advert_image_url(advert)} />
</td>
<td>
<strong>
URL:
</strong>
<%= link(advert.link, to: advert.link) %>
<br />
<strong>
Title:
</strong>
<em>
<%= advert.title %>
</em>
<%= if present?(advert.notes) do %>
<br />
<strong>
Notes:
</strong>
<%= advert.notes %>
<% end %>
</td>
<td class={time_column_class(advert.start_date)}>
<%= pretty_time(advert.start_date) %>
</td>
<td class={time_column_class(advert.finish_date)}>
<%= pretty_time(advert.finish_date) %>
</td>
<td>
<%= live_text(advert) %>
</td>
<td>
<%= advert.restrictions %>
</td>
<td>
Impressions:
<%= advert.impressions %>
<br />
Clicks:
<%= advert.clicks %>
</td>
<td>
<%= link("Edit", to: ~p"/admin/adverts/#{advert}/edit") %>
&bull;
<%= link("Destroy", to: ~p"/admin/adverts/#{advert}", data: [confirm: "Are you really, really sure?", method: "delete"]) %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="block__header block__header--light">
<%= pagination %>
</div>
</div>

View file

@ -1,73 +0,0 @@
- route = fn p -> ~p"/admin/adverts?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @adverts, route: route
.block
.block__header
a href=~p"/admin/adverts/new"
i.fa.fa-plus>
' New advert
= pagination
.block__content
table.table
thead
tr
th.table--adverts__image Image
th Ad Information
th Start
th Finish
th Enabled
th Restriction
th Statistics
th Options
tbody
= for advert <- @adverts do
tr
td
img src=advert_image_url(advert)
td
strong
' URL:
= link advert.link, to: advert.link
br
strong
' Title:
em
= advert.title
= if present?(advert.notes) do
br
strong
' Notes:
= advert.notes
td class=time_column_class(advert.start_date)
= pretty_time advert.start_date
td class=time_column_class(advert.finish_date)
= pretty_time advert.finish_date
td
= live_text(advert)
td
= advert.restrictions
td
' Impressions:
= advert.impressions
br
' Clicks:
= advert.clicks
td
=> link "Edit", to: ~p"/admin/adverts/#{advert}/edit"
' &bull;
= link "Destroy", to: ~p"/admin/adverts/#{advert}", data: [confirm: "Are you really, really sure?", method: "delete"]
.block__header.block__header--light
= pagination

View file

@ -0,0 +1,4 @@
<h1>
New advert
</h1>
<%= render(PhilomenaWeb.Admin.AdvertView, "_form.html", changeset: @changeset, action: ~p"/admin/adverts", conn: @conn) %>

View file

@ -1,2 +0,0 @@
h1 New advert
= render PhilomenaWeb.Admin.AdvertView, "_form.html", changeset: @changeset, action: ~p"/admin/adverts", conn: @conn

View file

@ -0,0 +1,70 @@
<div class="block">
<div class="block__header">
<div class="block__header__title approval-grid">
<div class="approval-items--main">
<span>
ID
</span>
<span>
Image
</span>
<span>
Uploader
</span>
<span>
Time
</span>
</div>
<div class="approval-items--footer hide-mobile">
<span class="hide-mobile">
Actions
</span>
</div>
</div>
</div>
<%= for image <- @images do %>
<div class="block__content alternating-color">
<div class="approval-grid">
<div class="approval-items--main">
<span>
<%= link(">>#{image.id}", to: ~p"/images/#{image}") %>
</span>
<div class={"approval-items__details #{class_for_image(image)}"}>
<span>
<%= image_thumb(@conn, image) %>
</span>
<span>
<%= warning_text(image) %>
</span>
</div>
<span>
<%= if image.user do %>
<%= link(image.user.name, to: ~p"/profiles/#{image.user}") %>
<% else %>
<em>
<%= truncated_ip_link(image.ip) %>
</em>
<%= link_to_fingerprint(@conn, image.fingerprint) %>
<% end %>
</span>
<span>
<%= pretty_time(image.created_at) %>
</span>
</div>
<div class="approval-items--footer">
<%= if can?(@conn, :approve, image) do %>
<%= button_to("Approve", ~p"/images/#{image}/approve", method: "post", class: "button button--state-success") %>
<% end %>
<%= if can?(@conn, :hide, image) do %>
<%= form_for :image, ~p"/images/#{image}/delete", [method: "post"], fn f -> %>
<div class="field field--inline">
<%= text_input(f, :deletion_reason, class: "input input--wide", placeholder: "Rule violation", required: true) %>
<%= submit("Delete", class: "button button--state-danger button--separate-left") %>
</div>
<% end %>
<% end %>
</div>
</div>
</div>
<% end %>
</div>

View file

@ -1,34 +0,0 @@
.block
.block__header
.block__header__title.approval-grid
.approval-items--main
span ID
span Image
span Uploader
span Time
.approval-items--footer.hide-mobile
span.hide-mobile Actions
= for image <- @images do
.block__content.alternating-color
.approval-grid
.approval-items--main
span = link ">>#{image.id}", to: ~p"/images/#{image}"
.approval-items__details class=class_for_image(image)
span = image_thumb(@conn, image)
span = warning_text(image)
span
= if image.user do
= link image.user.name, to: ~p"/profiles/#{image.user}"
- else
em>
= truncated_ip_link(image.ip)
= link_to_fingerprint(@conn, image.fingerprint)
span = pretty_time(image.created_at)
.approval-items--footer
= if can?(@conn, :approve, image) do
= button_to "Approve", ~p"/images/#{image}/approve", method: "post", class: "button button--state-success"
= if can?(@conn, :hide, image) do
= form_for :image, ~p"/images/#{image}/delete", [method: "post"], fn f ->
.field.field--inline
= text_input f, :deletion_reason, class: "input input--wide", placeholder: "Rule violation", required: true
= submit "Delete", class: "button button--state-danger button--separate-left"

View file

@ -0,0 +1,18 @@
<% route = fn p -> ~p"/admin/approvals?#{p}" end %>
<% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @images, route: route) %>
<h1>
Approval Queue
</h1>
<div class="block">
<div class="block__header">
<%= pagination %>
</div>
<%= if Enum.any?(@images) do %>
<%= render(PhilomenaWeb.Admin.ApprovalView, "_approvals.html", images: @images, conn: @conn) %>
<% else %>
No images are pending approval. Good job!
<% end %>
<div class="block__header block__header--light">
<%= pagination %>
</div>
</div>

View file

@ -1,16 +0,0 @@
- route = fn p -> ~p"/admin/approvals?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @images, route: route
h1 Approval Queue
.block
.block__header
= pagination
= if Enum.any?(@images) do
= render PhilomenaWeb.Admin.ApprovalView, "_approvals.html", images: @images, conn: @conn
- else
' No images are pending approval. Good job!
.block__header.block__header--light
= pagination

View file

@ -0,0 +1,108 @@
<h1>
Artist Links
</h1>
<p>
Link creation is done via the Users menu.
</p>
<p>
Verifying a link will automatically award an artist badge if the link is public, no artist badge exists, and an "artist:" tag is specified.
</p>
<%= form_for :artist_link, ~p"/admin/artist_links", [method: "get", class: "hform"], fn f -> %>
<div class="field">
<%= text_input(f, :q, name: :q, value: @conn.params["q"], class: "input hform__text", placeholder: "Search query", autocapitalize: "none") %>
<%= submit("Search", class: "hform__button button") %>
</div>
<% end %>
<% route = fn p -> ~p"/admin/artist_links?#{p}" end %>
<% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @artist_links, route: route, params: link_scope(@conn), conn: @conn) %>
<div class="block">
<div class="block__header">
<%= if @conn.params["all"] do %>
<%= link("Show unverified only", to: ~p"/admin/artist_links") %>
<% else %>
<%= link("Show all", to: ~p"/admin/artist_links?#{[all: "true"]}") %>
<% end %>
<%= pagination %>
</div>
<div class="block__content">
<table class="table">
<thead>
<tr>
<th>
State
</th>
<th>
User
</th>
<th>
URL
</th>
<th>
Options
</th>
<th>
Mark
</th>
<th>
Public
</th>
</tr>
</thead>
<tbody>
<%= for link <- @artist_links do %>
<tr>
<td class={link_state_class(link)}>
<strong>
<%= link_state_name(link) %>
</strong>
<%= if contacted?(link) do %>
<br />
by
<%= link.contacted_by_user.name %>
<br />
(
<%= pretty_time(link.contacted_at) %>
)
<% end %>
</td>
<td>
<%= render(PhilomenaWeb.UserAttributionView, "_user.html", object: link, awards: true, conn: @conn) %>
<%= render(PhilomenaWeb.TagView, "_tag_list.html", tags: display_order(link.user.linked_tags), conn: @conn) %>
</td>
<td>
<%= link(String.slice(link.uri, 0, 100), to: link.uri) %>
<%= if link.tag do %>
<br />
<%= render(PhilomenaWeb.TagView, "_tag.html", tag: link.tag, conn: @conn) %>
<% end %>
</td>
<td>
<%= link("View", to: ~p"/profiles/#{link.user}/artist_links/#{link}") %>
&bull;
<%= link("Edit", to: ~p"/profiles/#{link.user}/artist_links/#{link}/edit") %>
</td>
<td>
<%= link("Verify", to: ~p"/admin/artist_links/#{link}/verification", method: :post) %>
&bull;
<%= link("Reject", to: ~p"/admin/artist_links/#{link}/reject", method: :post) %>
<br />
<%= if not verified?(link) do %>
<%= if contacted?(link) do %>
Artist contacted
<% else %>
<%= link("Artist contacted", to: ~p"/admin/artist_links/#{link}/contact", method: :post) %>
<% end %>
<% end %>
</td>
<td>
<%= public_text(link) %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="block__header block__header--light">
<%= pagination %>
</div>
</div>

View file

@ -1,78 +0,0 @@
h1 Artist Links
p Link creation is done via the Users menu.
p Verifying a link will automatically award an artist badge if the link is public, no artist badge exists, and an "artist:" tag is specified.
= form_for :artist_link, ~p"/admin/artist_links", [method: "get", class: "hform"], fn f ->
.field
= text_input f, :q, name: :q, value: @conn.params["q"], class: "input hform__text", placeholder: "Search query", autocapitalize: "none"
= submit "Search", class: "hform__button button"
- route = fn p -> ~p"/admin/artist_links?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @artist_links, route: route, params: link_scope(@conn), conn: @conn
.block
.block__header
= if @conn.params["all"] do
= link "Show unverified only", to: ~p"/admin/artist_links"
- else
= link "Show all", to: ~p"/admin/artist_links?#{[all: "true"]}"
= pagination
.block__content
table.table
thead
tr
th State
th User
th URL
th Options
th Mark
th Public
tbody
= for link <- @artist_links do
tr
td class=link_state_class(link)
strong
= link_state_name(link)
= if contacted?(link) do
br
' by
= link.contacted_by_user.name
br
| (
= pretty_time link.contacted_at
| )
td
= render PhilomenaWeb.UserAttributionView, "_user.html", object: link, awards: true, conn: @conn
= render PhilomenaWeb.TagView, "_tag_list.html", tags: display_order(link.user.linked_tags), conn: @conn
td
= link String.slice(link.uri, 0, 100), to: link.uri
= if link.tag do
br
= render PhilomenaWeb.TagView, "_tag.html", tag: link.tag, conn: @conn
td
=> link "View", to: ~p"/profiles/#{link.user}/artist_links/#{link}"
' &bull;
= link "Edit", to: ~p"/profiles/#{link.user}/artist_links/#{link}/edit"
td
=> link "Verify", to: ~p"/admin/artist_links/#{link}/verification", method: :post
' &bull;
=> link "Reject", to: ~p"/admin/artist_links/#{link}/reject", method: :post
br
= if not verified?(link) do
= if contacted?(link) do
' Artist contacted
- else
= link "Artist contacted", to: ~p"/admin/artist_links/#{link}/contact", method: :post
td
= public_text(link)
.block__header.block__header--light
= pagination

View file

@ -0,0 +1,43 @@
<%= form_for @changeset, @action, [multipart: true], fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>
Oops, something went wrong! Please check the errors below.
</p>
</div>
<% end %>
<div class="field">
<%= label(f, :title, "Badge name:") %>
<%= text_input(f, :title, class: "input input--wide", placeholder: "Name", required: true) %>
<%= error_tag(f, :title) %>
</div>
<div class="field">
<%= label(f, :description, "An optional short description:") %>
<%= text_input(f, :description, class: "input input--wide", placeholder: "Description") %>
<%= error_tag(f, :description) %>
</div>
<div class="field">
<%= checkbox(f, :disable_award, class: "checkbox") %>
<%= label(f, :disable_award, "Prevent image from appearing in \"Badge to award\" list") %>
</div>
<div class="field">
<%= checkbox(f, :priority, class: "checkbox") %>
<%= label(f, :priority, "Displays before badges that don't have this checkbox checked") %>
</div>
<%= if @changeset.data.__meta__.state != :loaded do %>
<h4>
Image
</h4>
<div class="field">
<%= label(f, :image, "Upload SVG image:") %>
<%= file_input(f, :image, class: "input input--wide") %>
<%= error_tag(f, :image) %>
<%= error_tag(f, :image_mime_type) %>
</div>
<% else %>
<div class="field">
<%= link("Change image", to: ~p"/admin/badges/#{@changeset.data}/image/edit", class: "button") %>
</div>
<% end %>
<%= submit("Save Badge", class: "button", data: [disable_with: raw("Saving&hellip;")]) %>
<% end %>

View file

@ -1,35 +0,0 @@
= form_for @changeset, @action, [multipart: true], fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
.field
=> label f, :title, "Badge name:"
= text_input f, :title, class: "input input--wide", placeholder: "Name", required: true
= error_tag f, :title
.field
=> label f, :description, "An optional short description:"
= text_input f, :description, class: "input input--wide", placeholder: "Description"
= error_tag f, :description
.field
=> checkbox f, :disable_award, class: "checkbox"
= label f, :disable_award, "Prevent image from appearing in \"Badge to award\" list"
.field
=> checkbox f, :priority, class: "checkbox"
= label f, :priority, "Displays before badges that don't have this checkbox checked"
= if @changeset.data.__meta__.state != :loaded do
h4 Image
.field
=> label f, :image, "Upload SVG image:"
= file_input f, :image, class: "input input--wide"
= error_tag f, :image
= error_tag f, :image_mime_type
- else
.field
= link "Change image", to: ~p"/admin/badges/#{@changeset.data}/image/edit", class: "button"
= submit "Save Badge", class: "button", data: [disable_with: raw("Saving&hellip;")]

View file

@ -0,0 +1,5 @@
<h2>
Edit Badge
</h2>
<%= render("_form.html", Map.put(assigns, :action, ~p"/admin/badges/#{@badge}")) %>
<%= link("Back", to: ~p"/admin/badges") %>

View file

@ -1,5 +0,0 @@
h2 Edit Badge
= render "_form.html", Map.put(assigns, :action, ~p"/admin/badges/#{@badge}")
= link "Back", to: ~p"/admin/badges"

View file

@ -0,0 +1,22 @@
<h2>
Edit Badge
</h2>
<%= form_for @changeset, ~p"/admin/badges/#{@badge}/image", [multipart: true], fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>
Oops, something went wrong! Please check the errors below.
</p>
</div>
<% end %>
<h4>
Image
</h4>
<div class="field">
<%= label(f, :image, "Upload SVG image:") %>
<%= file_input(f, :image, class: "input input--wide") %>
<%= error_tag(f, :image) %>
<%= error_tag(f, :image_mime_type) %>
</div>
<%= submit("Save Badge", class: "button", data: [disable_with: raw("Saving&hellip;")]) %>
<% end %>

View file

@ -1,15 +0,0 @@
h2 Edit Badge
= form_for @changeset, ~p"/admin/badges/#{@badge}/image", [multipart: true], fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
h4 Image
.field
=> label f, :image, "Upload SVG image:"
= file_input f, :image, class: "input input--wide"
= error_tag f, :image
= error_tag f, :image_mime_type
= submit "Save Badge", class: "button", data: [disable_with: raw("Saving&hellip;")]

View file

@ -0,0 +1,51 @@
<h2>
Badges
</h2>
<% route = fn p -> ~p"/admin/badges?#{p}" end %>
<% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @badges, route: route, conn: @conn) %>
<div class="block">
<div class="block__header">
<a href={~p"/admin/badges/new"}>
<i class="fa fa-plus"></i>
New Badge
</a>
<%= pagination %>
</div>
<div class="block__content">
<table class="table">
<thead>
<tr>
<th>
Badge
</th>
<th>
Image
</th>
<th>
Options
</th>
</tr>
</thead>
<tbody>
<%= for badge <- @badges do %>
<tr>
<td>
<%= badge.title %>
</td>
<td>
<%= badge_image(badge, width: 32, height: 32) %>
</td>
<td>
<%= link("Users", to: ~p"/admin/badges/#{badge}/users") %>
&bull;
<%= link("Edit", to: ~p"/admin/badges/#{badge}/edit") %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="block__header block__header--light">
<%= pagination %>
</div>
</div>

View file

@ -1,36 +0,0 @@
h2 Badges
- route = fn p -> ~p"/admin/badges?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @badges, route: route, conn: @conn
.block
.block__header
a href=~p"/admin/badges/new"
i.fa.fa-plus>
' New Badge
= pagination
.block__content
table.table
thead
tr
th Badge
th Image
th Options
tbody
= for badge <- @badges do
tr
td
= badge.title
td
= badge_image(badge, width: 32, height: 32)
td
=> link "Users", to: ~p"/admin/badges/#{badge}/users"
' &bull;
= link "Edit", to: ~p"/admin/badges/#{badge}/edit"
.block__header.block__header--light
= pagination

View file

@ -0,0 +1,5 @@
<h2>
New Badge
</h2>
<%= render("_form.html", Map.put(assigns, :action, ~p"/admin/badges")) %>
<%= link("Back", to: ~p"/admin/badges") %>

View file

@ -1,5 +0,0 @@
h2 New Badge
= render "_form.html", Map.put(assigns, :action, ~p"/admin/badges")
= link "Back", to: ~p"/admin/badges"

View file

@ -0,0 +1,35 @@
<h1>
Users with
<%= @badge.title %>
badge
</h1>
<% route = fn p -> ~p"/admin/badges/#{@badge}/users?#{p}" end %>
<% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @users, route: route, conn: @conn) %>
<div class="block">
<div class="block__header">
<%= pagination %>
</div>
<div class="block__content">
<table class="table">
<thead>
<tr>
<th>
User
</th>
</tr>
</thead>
<tbody>
<%= for user <- @users do %>
<tr>
<td>
<%= link(user.name, to: ~p"/profiles/#{user}") %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="block__header block__header--light">
<%= pagination %>
</div>
</div>

View file

@ -1,25 +0,0 @@
h1
' Users with
=> @badge.title
' badge
- route = fn p -> ~p"/admin/badges/#{@badge}/users?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @users, route: route, conn: @conn
.block
.block__header
= pagination
.block__content
table.table
thead
tr
th User
tbody
= for user <- @users do
tr
td
= link user.name, to: ~p"/profiles/#{user}"
.block__header.block__header--light
= pagination

View file

@ -0,0 +1,113 @@
<h2>
Do-Not-Post Requests
</h2>
<%= form_for :dnp_entry, ~p"/admin/dnp_entries", [method: "get", class: "hform"], fn f -> %>
<div class="field">
<%= text_input(f, :q, name: :q, value: @conn.params["q"], class: "input hform__text", placeholder: "Search query", autocapitalize: "none") %>
<%= submit("Search", class: "hform__button button") %>
</div>
<% end %>
<% route = fn p -> ~p"/admin/dnp_entries?#{p}" end %>
<% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @dnp_entries, route: route, params: [states: state_param(@conn.params["states"])]) %>
<div class="block">
<div class="block__header">
<%= pagination %>
<span class="block__header__title">
Display Only:
</span>
<%= link("All Open", to: ~p"/admin/dnp_entries?#{[states: ~W(requested claimed rescinded acknowledged)]}") %>
<%= link("Listed", to: ~p"/admin/dnp_entries?#{[states: ~W(listed)]}") %>
<%= link("Rescinded", to: ~p"/admin/dnp_entries?#{[states: ~W(rescinded acknowledged)]}") %>
<%= link("Closed", to: ~p"/admin/dnp_entries?#{[states: ~W(closed)]}") %>
</div>
<div class="block__content">
<table class="table">
<thead>
<tr>
<td>
Tag
</td>
<td>
Requesting User
</td>
<td>
Type
</td>
<td>
Conditions
</td>
<td>
Status
</td>
<td>
Created
</td>
<td>
Modified
</td>
<td>
Options
</td>
</tr>
</thead>
<tbody>
<%= for {body, request} <- @dnp_entries do %>
<tr>
<td>
<%= render(PhilomenaWeb.TagView, "_tag.html", tag: request.tag, conn: @conn) %>
</td>
<td>
<%= link(request.requesting_user.name, to: ~p"/profiles/#{request.requesting_user}") %>
</td>
<td>
<%= request.dnp_type %>
</td>
<td>
<%= body %>
</td>
<td class={dnp_entry_row_class(request)}>
<%= pretty_state(request) %>
<%= if request.modifying_user do %>
by
<%= link(request.modifying_user.name, to: ~p"/profiles/#{request.modifying_user}") %>
<% end %>
</td>
<td>
<%= pretty_time(request.created_at) %>
</td>
<td>
<%= pretty_time(request.updated_at) %>
</td>
<td>
<%= link("Show", to: ~p"/dnp/#{request}") %>
&bull;
<%= link("Send PM", to: ~p"/conversations/new?#{[recipient: request.requesting_user.name]}") %>
<%= case request.aasm_state do %>
<% s when s in ["requested", "claimed"] -> %>
&bull;
<%= link("Claim", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "claimed"]}", data: [method: "post", confirm: "Are you really, really sure?"]) %>
&bull;
<%= link("Approve", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "listed"]}", data: [method: "post", confirm: "Are you really, really sure?"]) %>
&bull;
<%= link("Close", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "closed"]}", data: [method: "post", confirm: "Are you really, really sure?"]) %>
<% "listed" -> %>
&bull;
<%= link("Rescind", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "rescinded"]}", data: [method: "post", confirm: "Are you really, really sure?"]) %>
&bull;
<%= link("Close", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "closed"]}", data: [method: "post", confirm: "Are you really, really sure?"]) %>
<% s when s in ["rescinded", "acknowledged"] -> %>
&bull;
<%= link("Claim", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "acknowledged"]}", data: [method: "post", confirm: "Are you really, really sure?"]) %>
&bull;
<%= link("Close", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "closed"]}", data: [method: "post", confirm: "Are you really, really sure?"]) %>
<% _state -> %>
&bull;
<%= link("Claim", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "claimed"]}", data: [method: "post", confirm: "Are you really, really sure?"]) %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>

View file

@ -1,90 +0,0 @@
h2 Do-Not-Post Requests
= form_for :dnp_entry, ~p"/admin/dnp_entries", [method: "get", class: "hform"], fn f ->
.field
= text_input f, :q, name: :q, value: @conn.params["q"], class: "input hform__text", placeholder: "Search query", autocapitalize: "none"
= submit "Search", class: "hform__button button"
- route = fn p -> ~p"/admin/dnp_entries?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @dnp_entries, route: route, params: [states: state_param(@conn.params["states"])]
.block
.block__header
= pagination
span.block__header__title Display Only:
=> link "All Open", to: ~p"/admin/dnp_entries?#{[states: ~W(requested claimed rescinded acknowledged)]}"
=> link "Listed", to: ~p"/admin/dnp_entries?#{[states: ~W(listed)]}"
=> link "Rescinded", to: ~p"/admin/dnp_entries?#{[states: ~W(rescinded acknowledged)]}"
=> link "Closed", to: ~p"/admin/dnp_entries?#{[states: ~W(closed)]}"
.block__content
table.table
thead
tr
td Tag
td Requesting User
td Type
td Conditions
td Status
td Created
td Modified
td Options
tbody
= for {body, request} <- @dnp_entries do
tr
td
= render PhilomenaWeb.TagView, "_tag.html", tag: request.tag, conn: @conn
td
= link request.requesting_user.name, to: ~p"/profiles/#{request.requesting_user}"
td
= request.dnp_type
td
= body
td class=dnp_entry_row_class(request)
=> pretty_state(request)
= if request.modifying_user do
' by
= link request.modifying_user.name, to: ~p"/profiles/#{request.modifying_user}"
td
= pretty_time(request.created_at)
td
= pretty_time(request.updated_at)
td
=> link "Show", to: ~p"/dnp/#{request}"
' &bull;
=> link "Send PM", to: ~p"/conversations/new?#{[recipient: request.requesting_user.name]}"
= case request.aasm_state do
- s when s in ["requested", "claimed"] ->
' &bull;
=> link "Claim", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "claimed"]}", data: [method: "post", confirm: "Are you really, really sure?"]
' &bull;
=> link "Approve", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "listed"]}", data: [method: "post", confirm: "Are you really, really sure?"]
' &bull;
=> link "Close", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "closed"]}", data: [method: "post", confirm: "Are you really, really sure?"]
- "listed" ->
' &bull;
=> link "Rescind", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "rescinded"]}", data: [method: "post", confirm: "Are you really, really sure?"]
' &bull;
= link "Close", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "closed"]}", data: [method: "post", confirm: "Are you really, really sure?"]
- s when s in ["rescinded", "acknowledged"] ->
' &bull;
=> link "Claim", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "acknowledged"]}", data: [method: "post", confirm: "Are you really, really sure?"]
' &bull;
= link "Close", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "closed"]}", data: [method: "post", confirm: "Are you really, really sure?"]
- _state ->
' &bull;
=> link "Claim", to: ~p"/admin/dnp_entries/#{request}/transition?#{[state: "claimed"]}", data: [method: "post", confirm: "Are you really, really sure?"]

View file

@ -0,0 +1,44 @@
<table class="table">
<thead>
<tr>
<th>
User
</th>
<th>
Email
</th>
<th>
Amount
</th>
<th>
Note
</th>
<th>
At
</th>
</tr>
</thead>
<tbody>
<%= for donation <- @donations do %>
<tr>
<td>
<%= if donation.user do %>
<%= link(donation.user.name, to: ~p"/profiles/#{donation.user}") %>
<% end %>
</td>
<td>
<%= donation.email %>
</td>
<td>
<%= donation.amount %>
</td>
<td title={donation.note}>
<%= String.slice(donation.note, 0, 30) %>
</td>
<td>
<%= pretty_time(donation.created_at) %>
</td>
</tr>
<% end %>
</tbody>
</table>

View file

@ -1,27 +0,0 @@
table.table
thead
tr
th User
th Email
th Amount
th Note
th At
tbody
= for donation <- @donations do
tr
td
= if donation.user do
= link donation.user.name, to: ~p"/profiles/#{donation.user}"
td
= donation.email
td
= donation.amount
td title=donation.note
= String.slice(donation.note, 0, 30)
td
= pretty_time donation.created_at

View file

@ -0,0 +1,16 @@
<% route = fn p -> ~p"/admin/donations?#{p}" end %>
<% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @donations, route: route, conn: @conn) %>
<h1>
Donations
</h1>
<div class="block">
<div class="block__header">
<%= pagination %>
</div>
<div class="block__content">
<%= render(PhilomenaWeb.Admin.DonationView, "_table.html", donations: @donations, conn: @conn) %>
</div>
<div class="block__header block__header--light">
<%= pagination %>
</div>
</div>

View file

@ -1,14 +0,0 @@
- route = fn p -> ~p"/admin/donations?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @donations, route: route, conn: @conn
h1 Donations
.block
.block__header
= pagination
.block__content
= render PhilomenaWeb.Admin.DonationView, "_table.html", donations: @donations, conn: @conn
.block__header.block__header--light
= pagination

View file

@ -0,0 +1,29 @@
<div class="walloftext">
<h1>
<%= @user.name %>
's Donations
</h1>
<%= render(PhilomenaWeb.Admin.DonationView, "_table.html", donations: @donations, conn: @conn) %>
<h1>
Add Donation
</h1>
<%= form_for @changeset, ~p"/admin/donations", fn f -> %>
<div class="field">
<%= label(f, :user_id, "User ID:") %>
<%= number_input(f, :user_id, class: "input input--short", value: @user.id) %>
</div>
<div class="field">
<%= label(f, :email, "Email:") %>
<%= text_input(f, :email, class: "input input--wide", value: @user.email) %>
</div>
<div class="field">
<%= label(f, :amount, "Amount:") %>
<%= number_input(f, :amount, class: "input input--wide", min: 0, step: 0.01) %>
</div>
<div class="field">
<%= label(f, :note, "Note:") %>
<%= textarea(f, :note, class: "input input--wide") %>
</div>
<%= submit("Create Donation", class: "button") %>
<% end %>
</div>

View file

@ -1,26 +0,0 @@
.walloftext
h1
= @user.name
| 's Donations
= render PhilomenaWeb.Admin.DonationView, "_table.html", donations: @donations, conn: @conn
h1 Add Donation
= form_for @changeset, ~p"/admin/donations", fn f ->
.field
=> label f, :user_id, "User ID:"
= number_input f, :user_id, class: "input input--short", value: @user.id
.field
=> label f, :email, "Email:"
= text_input f, :email, class: "input input--wide", value: @user.email
.field
=> label f, :amount, "Amount:"
= number_input f, :amount, class: "input input--wide", min: 0, step: 0.01
.field
=> label f, :note, "Note:"
= textarea f, :note, class: "input input--wide"
= submit "Create Donation", class: "button"

View file

@ -0,0 +1,34 @@
<%= form_for @changeset, @action, fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>
Oops, something went wrong! Please check the errors below.
</p>
</div>
<% end %>
<div class="field">
<%= label(f, :fingerprint, "Fingerprint:") %>
<%= text_input(f, :fingerprint, class: "input", placeholder: "Fingerprint", required: true) %>
</div>
<div class="field">
<%= 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) %>
<%= error_tag(f, :reason) %>
</div>
<div class="field">
<%= label(f, :note, "Admin-only note:") %>
<%= text_input(f, :note, class: "input input--wide", placeholder: "Note") %>
</div>
<div class="field">
<%= 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) %>
<%= error_tag(f, :until) %>
</div>
<br />
<div class="field">
<%= checkbox(f, :enabled) %>
<%= label(f, :enabled) %>
</div>
<br />
<%= submit("Save Ban", class: "button") %>
<% end %>

View file

@ -1,30 +0,0 @@
= form_for @changeset, @action, fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
.field
=> label f, :fingerprint, "Fingerprint:"
= text_input f, :fingerprint, class: "input", placeholder: "Fingerprint", required: true
.field
=> 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
= error_tag f, :reason
.field
=> label f, :note, "Admin-only note:"
= text_input f, :note, class: "input input--wide", placeholder: "Note"
.field
=> 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
= error_tag f, :until
br
.field
=> checkbox f, :enabled
= label f, :enabled
br
= submit "Save Ban", class: "button"

View file

@ -0,0 +1,6 @@
<h1>
Editing ban
</h1>
<%= render(PhilomenaWeb.Admin.FingerprintBanView, "_form.html", changeset: @changeset, action: ~p"/admin/fingerprint_bans/#{@fingerprint}", conn: @conn) %>
<br />
<%= link("Back", to: ~p"/admin/fingerprint_bans") %>

View file

@ -1,6 +0,0 @@
h1 Editing ban
= render PhilomenaWeb.Admin.FingerprintBanView, "_form.html", changeset: @changeset, action: ~p"/admin/fingerprint_bans/#{@fingerprint}", conn: @conn
br
= link "Back", to: ~p"/admin/fingerprint_bans"

View file

@ -0,0 +1,86 @@
<h1>
Fingerprint Bans
</h1>
<% route = fn p -> ~p"/admin/fingerprint_bans?#{p}" end %>
<% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @fingerprint_bans, route: route, params: page_params(@conn.params)) %>
<%= form_for :fingerprint_ban, ~p"/admin/fingerprint_bans", [method: "get", class: "hform"], fn f -> %>
<div class="field">
<%= text_input(f, :q, name: "q", class: "hform__text input", placeholder: "Search") %>
<%= submit("Search", class: "button hform__button") %>
</div>
<% end %>
<div class="block">
<div class="block__header">
<a href={~p"/admin/fingerprint_bans/new"}>
<i class="fa fa-plus"></i>
New fingerprint ban
</a>
<%= pagination %>
</div>
<div class="block__content">
<table class="table">
<thead>
<tr>
<th>
Fingerprint
</th>
<th>
Created
</th>
<th>
Expires
</th>
<th>
Reason/Note
</th>
<th>
Ban ID
</th>
<th>
Options
</th>
</tr>
</thead>
<tbody>
<%= for ban <- @fingerprint_bans do %>
<tr>
<td>
<%= link(ban.fingerprint, to: ~p"/fingerprint_profiles/#{ban.fingerprint}") %>
</td>
<td>
<%= pretty_time(ban.created_at) %>
<%= user_abbrv(ban.banning_user) %>
</td>
<td class={ban_row_class(ban)}>
<%= pretty_time(ban.valid_until) %>
</td>
<td>
<%= ban.reason %>
<%= if present?(ban.note) do %>
<p class="block block--fixed">
<em>
Note:
<%= ban.note %>
</em>
</p>
<% end %>
</td>
<td>
<%= ban.generated_ban_id %>
</td>
<td>
<%= link("Edit", to: ~p"/admin/fingerprint_bans/#{ban}/edit") %>
<%= if @current_user.role == "admin" do %>
&bull;
<%= link("Destroy", to: ~p"/admin/fingerprint_bans/#{ban}", data: [confirm: "Are you really, really sure?", method: "delete"]) %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="block__header block__header--light">
<%= pagination %>
</div>
</div>

View file

@ -1,62 +0,0 @@
h1 Fingerprint Bans
- route = fn p -> ~p"/admin/fingerprint_bans?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @fingerprint_bans, route: route, params: page_params(@conn.params)
= form_for :fingerprint_ban, ~p"/admin/fingerprint_bans", [method: "get", class: "hform"], fn f ->
.field
= text_input f, :q, name: "q", class: "hform__text input", placeholder: "Search"
= submit "Search", class: "button hform__button"
.block
.block__header
a href=~p"/admin/fingerprint_bans/new"
i.fa.fa-plus>
' New fingerprint ban
= pagination
.block__content
table.table
thead
tr
th Fingerprint
th Created
th Expires
th Reason/Note
th Ban ID
th Options
tbody
= for ban <- @fingerprint_bans do
tr
td
= link ban.fingerprint, to: ~p"/fingerprint_profiles/#{ban.fingerprint}"
td
=> pretty_time ban.created_at
= user_abbrv ban.banning_user
td class=ban_row_class(ban)
= pretty_time ban.valid_until
td
= ban.reason
= if present?(ban.note) do
p.block.block--fixed
em
' Note:
= ban.note
td
= ban.generated_ban_id
td
=> link "Edit", to: ~p"/admin/fingerprint_bans/#{ban}/edit"
= if @current_user.role == "admin" do
' &bull;
=> link "Destroy", to: ~p"/admin/fingerprint_bans/#{ban}", data: [confirm: "Are you really, really sure?", method: "delete"]
.block__header.block__header--light
= pagination

View file

@ -0,0 +1,6 @@
<h1>
New Fingerprint Ban
</h1>
<%= render(PhilomenaWeb.Admin.FingerprintBanView, "_form.html", changeset: @changeset, action: ~p"/admin/fingerprint_bans", conn: @conn) %>
<br />
<%= link("Back", to: ~p"/admin/fingerprint_bans") %>

View file

@ -1,5 +0,0 @@
h1 New Fingerprint Ban
= render PhilomenaWeb.Admin.FingerprintBanView, "_form.html", changeset: @changeset, action: ~p"/admin/fingerprint_bans", conn: @conn
br
= link "Back", to: ~p"/admin/fingerprint_bans"

View file

@ -0,0 +1,30 @@
<%= form_for @changeset, @action, fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>
Oops, something went wrong! Please check the errors below.
</p>
</div>
<% end %>
<div class="field">
<%= label(f, :name, "Name:") %>
<%= text_input(f, :name, class: "input input--wide") %>
<%= error_tag(f, :name) %>
</div>
<div class="field">
<%= label(f, :short_name, "Slug:") %>
<%= text_input(f, :short_name, class: "input input--wide") %>
<%= error_tag(f, :short_name) %>
</div>
<div class="field">
<%= label(f, :description, "Description:") %>
<%= textarea(f, :description, class: "input input--wide") %>
<%= error_tag(f, :description) %>
</div>
<div class="field">
<%= label(f, :access_level, "Access level:") %>
<%= select(f, :access_level, ["normal", "assistant", "staff"], class: "input") %>
<%= error_tag(f, :access_level) %>
</div>
<%= submit("Save Forum", class: "button") %>
<% end %>

View file

@ -1,26 +0,0 @@
= form_for @changeset, @action, fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
.field
=> label f, :name, "Name:"
= text_input f, :name, class: "input input--wide"
= error_tag f, :name
.field
=> label f, :short_name, "Slug:"
= text_input f, :short_name, class: "input input--wide"
= error_tag f, :short_name
.field
=> label f, :description, "Description:"
= textarea f, :description, class: "input input--wide"
= error_tag f, :description
.field
=> label f, :access_level, "Access level:"
= select f, :access_level, ["normal", "assistant", "staff"], class: "input"
= error_tag f, :access_level
= submit "Save Forum", class: "button"

View file

@ -0,0 +1,5 @@
<h2>
Edit Forum
</h2>
<%= render("_form.html", Map.put(assigns, :action, ~p"/admin/forums/#{@forum}")) %>
<%= link("Back", to: ~p"/admin/forums") %>

View file

@ -1,5 +0,0 @@
h2 Edit Forum
= render "_form.html", Map.put(assigns, :action, ~p"/admin/forums/#{@forum}")
= link "Back", to: ~p"/admin/forums"

View file

@ -0,0 +1,28 @@
<h2>
Listing Forums
</h2>
<table class="table">
<thead>
<tr>
<th>
Name
</th>
<th>
Options
</th>
</tr>
</thead>
<tbody>
<%= for forum <- @forums do %>
<tr>
<td>
<%= link(forum.name, to: ~p"/forums/#{forum}") %>
</td>
<td class="text-right">
<%= link("Edit", to: ~p"/admin/forums/#{forum}/edit") %>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= link("New Forum", to: ~p"/admin/forums/new") %>

View file

@ -1,17 +0,0 @@
h2 Listing Forums
table.table
thead
tr
th Name
th Options
tbody
= for forum <- @forums do
tr
td
= link forum.name, to: ~p"/forums/#{forum}"
td class="text-right"
= link "Edit", to: ~p"/admin/forums/#{forum}/edit"
= link "New Forum", to: ~p"/admin/forums/new"

View file

@ -0,0 +1,5 @@
<h2>
New Forum
</h2>
<%= render("_form.html", Map.put(assigns, :action, ~p"/admin/forums")) %>
<%= link("Back", to: ~p"/admin/forums") %>

View file

@ -1,5 +0,0 @@
h2 New Forum
= render "_form.html", Map.put(assigns, :action, ~p"/admin/forums")
= link "Back", to: ~p"/admin/forums"

View file

@ -0,0 +1,19 @@
<%= form_for @changeset, @action, fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>
Oops, something went wrong! Please check the errors below.
</p>
</div>
<% end %>
<div class="field">
<%= label(f, :body, "Note") %>
<%= text_input(f, :body, class: "input input--wide", required: true) %>
<%= error_tag(f, :body) %>
</div>
<%= hidden_input(f, :notable_id) %>
<%= hidden_input(f, :notable_type) %>
<div class="field">
<%= submit("Save", class: "button") %>
</div>
<% end %>

View file

@ -1,15 +0,0 @@
= form_for @changeset, @action, fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
.field
=> label f, :body, "Note"
= text_input f, :body, class: "input input--wide", required: true
= error_tag f, :body
= hidden_input f, :notable_id
= hidden_input f, :notable_type
.field
= submit "Save", class: "button"

View file

@ -0,0 +1,44 @@
<table class="table">
<thead>
<tr>
<td>
Object
</td>
<td>
Note
</td>
<td>
Time
</td>
<td>
Moderator
</td>
<td>
Actions
</td>
</tr>
</thead>
<tbody>
<%= for {body, note} <- @mod_notes do %>
<tr>
<td>
<%= link_to_noted_thing(note.notable) %>
</td>
<td>
<%= body %>
</td>
<td>
<%= pretty_time(note.created_at) %>
</td>
<td>
<%= link(note.moderator.name, to: ~p"/profiles/#{note.moderator}") %>
</td>
<td>
<%= link("Edit", to: ~p"/admin/mod_notes/#{note}/edit") %>
&bull;
<%= link("Delete", to: ~p"/admin/mod_notes/#{note}", data: [confirm: "Are you really, really sure?", method: "delete"]) %>
</td>
</tr>
<% end %>
</tbody>
</table>

View file

@ -1,27 +0,0 @@
table.table
thead
tr
td Object
td Note
td Time
td Moderator
td Actions
tbody
= for {body, note} <- @mod_notes do
tr
td
= link_to_noted_thing(note.notable)
td
= body
td
= pretty_time note.created_at
td
= link note.moderator.name, to: ~p"/profiles/#{note.moderator}"
td
=> link "Edit", to: ~p"/admin/mod_notes/#{note}/edit"
' &bull;
=> link "Delete", to: ~p"/admin/mod_notes/#{note}", data: [confirm: "Are you really, really sure?", method: "delete"]

View file

@ -0,0 +1,6 @@
<h2>
Editing mod note for
<%= @mod_note.notable_type %>
<%= @mod_note.notable_id %>
</h2>
<%= render(PhilomenaWeb.Admin.ModNoteView, "_form.html", changeset: @changeset, action: ~p"/admin/mod_notes/#{@mod_note}", conn: @conn) %>

View file

@ -1,6 +0,0 @@
h2
' Editing mod note for
=> @mod_note.notable_type
=> @mod_note.notable_id
= render PhilomenaWeb.Admin.ModNoteView, "_form.html", changeset: @changeset, action: ~p"/admin/mod_notes/#{@mod_note}", conn: @conn

View file

@ -0,0 +1,16 @@
<% route = fn p -> ~p"/admin/mod_notes?#{p}" end %>
<% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @mod_notes, route: route, conn: @conn) %>
<h2>
Mod Notes
</h2>
<div class="block">
<div class="block__header">
<span class="block__header__title">
Mod Notes
</span>
<%= pagination %>
</div>
<div class="block__content">
<%= render(PhilomenaWeb.Admin.ModNoteView, "_table.html", mod_notes: @mod_notes, conn: @conn) %>
</div>
</div>

View file

@ -1,12 +0,0 @@
- route = fn p -> ~p"/admin/mod_notes?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @mod_notes, route: route, conn: @conn
h2 Mod Notes
.block
.block__header
span.block__header__title Mod Notes
= pagination
.block__content
= render PhilomenaWeb.Admin.ModNoteView, "_table.html", mod_notes: @mod_notes, conn: @conn

View file

@ -0,0 +1,6 @@
<h2>
New mod note for
<%= @conn.params["notable_type"] %>
<%= @conn.params["notable_id"] %>
</h2>
<%= render(PhilomenaWeb.Admin.ModNoteView, "_form.html", changeset: @changeset, action: ~p"/admin/mod_notes", conn: @conn) %>

View file

@ -1,6 +0,0 @@
h2
' New mod note for
=> @conn.params["notable_type"]
=> @conn.params["notable_id"]
= render PhilomenaWeb.Admin.ModNoteView, "_form.html", changeset: @changeset, action: ~p"/admin/mod_notes", conn: @conn

View file

@ -0,0 +1,78 @@
<table class="table">
<thead>
<tr>
<th>
Thing
</th>
<th>
Reason
</th>
<th>
User
</th>
<th class="hide-mobile">
Opened
</th>
<th>
State
</th>
<th>
Options
</th>
</tr>
</thead>
<tbody>
<%= for report <- @reports do %>
<tr>
<td>
<%= reported_image(@conn, report.reportable) %>
<%= link_to_reported_thing(report.reportable) %>
</td>
<td>
<span title={report.reason}>
<%= truncate(report.reason) %>
</span>
</td>
<td>
<%= if report.user do %>
<%= link(report.user.name, to: ~p"/profiles/#{report.user}") %>
<% else %>
<em>
<%= truncated_ip_link(report.ip) %>
</em>
<%= link_to_fingerprint(@conn, report.fingerprint) %>
<% end %>
<%= if not is_nil(report.user) and Enum.any?(report.user.linked_tags) do %>
<%= render(PhilomenaWeb.TagView, "_tag_list.html", tags: ordered_tags(report.user.linked_tags), conn: @conn) %>
<% end %>
</td>
<td class="hide-mobile">
<%= pretty_time(report.created_at) %>
</td>
<td class={report_row_class(report)}>
<%= pretty_state(report) %>
<%= user_abbrv(report.admin) %>
</td>
<td>
<%= link("Show", to: ~p"/admin/reports/#{report}") %>
<%= if report.open do %>
<%= if report.user do %>
&bull;
<%= link("Send PM", to: ~p"/conversations/new?#{[recipient: report.user.name]}") %>
<% end %>
<%= if is_nil(report.admin) and not current?(report.admin, @conn.assigns.current_user) do %>
&bull;
<%= link("Claim", to: ~p"/admin/reports/#{report}/claim", data: [method: "post"]) %>
<% end %>
<%= if current?(report.admin, @conn.assigns.current_user) do %>
&bull;
<%= link("Release", to: ~p"/admin/reports/#{report}/claim", data: [method: "delete"]) %>
<% end %>
&bull;
<%= link("Close", to: ~p"/admin/reports/#{report}/close", data: [method: "post", confirm: "Are you really, really sure?"]) %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>

View file

@ -1,53 +0,0 @@
table.table
thead
tr
th Thing
th Reason
th User
th.hide-mobile Opened
th State
th Options
tbody
= for report <- @reports do
tr
td
=> reported_image @conn, report.reportable
= link_to_reported_thing report.reportable
td
span title=report.reason
= truncate(report.reason)
td
= if report.user do
= link report.user.name, to: ~p"/profiles/#{report.user}"
- else
em>
= truncated_ip_link(report.ip)
= link_to_fingerprint(@conn, report.fingerprint)
= if not is_nil(report.user) and Enum.any?(report.user.linked_tags) do
= render PhilomenaWeb.TagView, "_tag_list.html", tags: ordered_tags(report.user.linked_tags), conn: @conn
td.hide-mobile
= pretty_time report.created_at
td class=report_row_class(report)
=> pretty_state(report)
= user_abbrv report.admin
td
=> link "Show", to: ~p"/admin/reports/#{report}"
= if report.open do
= if report.user do
' &bull;
=> link "Send PM", to: ~p"/conversations/new?#{[recipient: report.user.name]}"
= if is_nil(report.admin) and not current?(report.admin, @conn.assigns.current_user) do
' &bull;
=> link "Claim", to: ~p"/admin/reports/#{report}/claim", data: [method: "post"]
= if current?(report.admin, @conn.assigns.current_user) do
' &bull;
=> link "Release", to: ~p"/admin/reports/#{report}/claim", data: [method: "delete"]
' &bull;
=> link "Close", to: ~p"/admin/reports/#{report}/close", data: [method: "post", confirm: "Are you really, really sure?"]

View file

@ -0,0 +1,62 @@
<% route = fn p -> ~p"/admin/reports?#{p}" end %>
<% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", route: route, page: @reports, conn: @conn, params: [rq: @conn.params["rq"] || "*"]) %>
<h1>
Reports
</h1>
<%= if Enum.any?(@my_reports) do %>
<div class="block">
<div class="block__header">
<span class="block__header__title">
Your Reports
</span>
</div>
<div class="block__content">
<%= render(PhilomenaWeb.Admin.ReportView, "_reports.html", reports: @my_reports, conn: @conn) %>
</div>
</div>
<% end %>
<%= if Enum.any?(@system_reports) do %>
<div class="block">
<div class="block__header block--danger">
<span class="block__header__title">
System Reports
</span>
</div>
<div class="block__content">
<%= render(PhilomenaWeb.Admin.ReportView, "_reports.html", reports: @system_reports, conn: @conn) %>
</div>
</div>
<% end %>
<div class="block">
<div class="block__header">
<span class="block__header__title">
All Reports
</span>
<%= pagination %>
</div>
<div class="block__content">
<%= if Enum.any?(@reports) do %>
<%= render(PhilomenaWeb.Admin.ReportView, "_reports.html", reports: @reports, conn: @conn) %>
<% else %>
<p>
We couldn't find any reports for you, sorry!
</p>
<% end %>
</div>
<div class="block__header block__header--light">
<%= pagination %>
</div>
</div>
<%= form_for :report, ~p"/admin/reports", [method: "get", class: "hform"], fn f -> %>
<div class="field">
<%= text_input(f, :rq, name: :rq, value: @conn.params["rq"], class: "input hform__text", placeholder: "Search reports", autocapitalize: "none") %>
<%= submit("Search", class: "hform__button button") %>
</div>
<% end %>
<div class="field">
<label for="rq">
Searchable fields: id, created_at, reason, state, open, user, user_id, admin, admin_id, ip, fingerprint, reportable_type, reportable_id, image_id
<br />
Report reason is used if you don't specify a field.
</label>
</div>

View file

@ -1,42 +0,0 @@
- route = fn p -> ~p"/admin/reports?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", route: route, page: @reports, conn: @conn, params: [rq: @conn.params["rq"] || "*"]
h1 Reports
= if Enum.any?(@my_reports) do
.block
.block__header
span.block__header__title Your Reports
.block__content
= render PhilomenaWeb.Admin.ReportView, "_reports.html", reports: @my_reports, conn: @conn
= if Enum.any?(@system_reports) do
.block
.block__header.block--danger
span.block__header__title System Reports
.block__content
= render PhilomenaWeb.Admin.ReportView, "_reports.html", reports: @system_reports, conn: @conn
.block
.block__header
span.block__header__title All Reports
= pagination
.block__content
= if Enum.any?(@reports) do
= render PhilomenaWeb.Admin.ReportView, "_reports.html", reports: @reports, conn: @conn
- else
p We couldn't find any reports for you, sorry!
.block__header.block__header--light
= pagination
= form_for :report, ~p"/admin/reports", [method: "get", class: "hform"], fn f ->
.field
= text_input f, :rq, name: :rq, value: @conn.params["rq"], class: "input hform__text", placeholder: "Search reports", autocapitalize: "none"
= submit "Search", class: "hform__button button"
.field
label for="rq"
' Searchable fields: id, created_at, reason, state, open, user, user_id, admin, admin_id, ip, fingerprint, reportable_type, reportable_id, image_id
br
' Report reason is used if you don't specify a field.

View file

@ -0,0 +1,62 @@
<h1>
Showing Report
</h1>
<p>
<%= link_to_reported_thing(@report.reportable) %>
</p>
<article class="block communication">
<div class="block__content flex flex--no-wrap">
<div class="flex__fixed spacing-right">
<%= render(PhilomenaWeb.UserAttributionView, "_anon_user_avatar.html", object: @report, conn: @conn) %>
</div>
<div class="flex__grow communication__body">
<span class="communication__body__sender-name">
<%= render(PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @report, awards: true, conn: @conn) %>
</span>
<br />
<%= render(PhilomenaWeb.UserAttributionView, "_anon_user_title.html", object: @report, conn: @conn) %>
<div class="communication__body__text">
<%= @body %>
</div>
</div>
</div>
<div class="block__content communication__options">
<div class="flex flex--wrap flex--spaced-out">
<div>
Reported
<%= pretty_time(@report.created_at) %>
</div>
<div class="flex__right">
<%= link_to_ip(@conn, @report.ip) %>
<%= link_to_fingerprint(@conn, @report.fingerprint) %>
</div>
</div>
<div>
User-Agent:
<code>
<%= @report.user_agent %>
</code>
</div>
</div>
</article>
<%= if assigns[:mod_notes] do %>
<h4>
Mod Notes
</h4>
<%= render(PhilomenaWeb.Admin.ModNoteView, "_table.html", mod_notes: @mod_notes, conn: @conn) %>
<%= link("Add New Note", to: ~p"/admin/mod_notes/new?#{[notable_id: @report.id, notable_type: "Report"]}") %>
<% end %>
<p>
<%= if @report.user do %>
<%= link("Send PM", to: ~p"/conversations/new?#{[recipient: @report.user.name]}", class: "button button--link") %>
<% end %>
<%= if @report.open do %>
<%= link("Close", to: ~p"/admin/reports/#{@report}/close", class: "button", data: [method: "post"]) %>
<%= if current?(@report.admin, @conn.assigns.current_user) do %>
<%= link("Release", to: ~p"/admin/reports/#{@report}/claim", class: "button", data: [method: "delete"]) %>
<% else %>
<%= link("Claim", to: ~p"/admin/reports/#{@report}/claim", class: "button", data: [method: "post"]) %>
<% end %>
<% end %>
</p>
<%= link("Back", to: ~p"/admin/reports", class: "button button-link") %>

View file

@ -1,48 +0,0 @@
h1 Showing Report
p
= link_to_reported_thing @report.reportable
article.block.communication
.block__content.flex.flex--no-wrap
.flex__fixed.spacing-right
= render PhilomenaWeb.UserAttributionView, "_anon_user_avatar.html", object: @report, conn: @conn
.flex__grow.communication__body
span.communication__body__sender-name = render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @report, awards: true, conn: @conn
br
= render PhilomenaWeb.UserAttributionView, "_anon_user_title.html", object: @report, conn: @conn
.communication__body__text
=<> @body
.block__content.communication__options
.flex.flex--wrap.flex--spaced-out
div
' Reported
= pretty_time @report.created_at
.flex__right
=> link_to_ip @conn, @report.ip
=> link_to_fingerprint @conn, @report.fingerprint
div
' User-Agent:
code
= @report.user_agent
= if assigns[:mod_notes] do
h4 Mod Notes
= render PhilomenaWeb.Admin.ModNoteView, "_table.html", mod_notes: @mod_notes, conn: @conn
= link "Add New Note", to: ~p"/admin/mod_notes/new?#{[notable_id: @report.id, notable_type: "Report"]}"
p
= if @report.user do
=> link "Send PM", to: ~p"/conversations/new?#{[recipient: @report.user.name]}", class: "button button--link"
= if @report.open do
=> link "Close", to: ~p"/admin/reports/#{@report}/close", class: "button", data: [method: "post"]
= if current?(@report.admin, @conn.assigns.current_user) do
=> link "Release", to: ~p"/admin/reports/#{@report}/claim", class: "button", data: [method: "delete"]
- else
=> link "Claim", to: ~p"/admin/reports/#{@report}/claim", class: "button", data: [method: "post"]
= link "Back", to: ~p"/admin/reports", class: "button button-link"

View file

@ -0,0 +1,56 @@
<%= form_for @changeset, @action, fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>
Oops, something went wrong! Please check the errors below.
</p>
</div>
<% end %>
<div class="field">
<%= label(f, :title, "Title (the bold bit) for the site notice; keep this short:") %>
<%= text_input(f, :title, class: "input input--wide", placeholder: "Title", required: true) %>
<%= error_tag(f, :title) %>
</div>
<div class="field">
<%= label(f, :text, "Main body of the site notice:") %>
<%= text_input(f, :text, class: "input input--wide", placeholder: "Text", required: true) %>
<%= error_tag(f, :text) %>
</div>
<h3>
Link
<small>
(optional; leave these two fields blank for no link)
</small>
</h3>
<div class="field">
<%= label(f, :link_text, "Text which will contain the link:") %>
<%= text_input(f, :link_text, class: "input input--wide", placeholder: "Link text") %>
<%= error_tag(f, :link_text) %>
</div>
<div class="field">
<%= label(f, :link, "Link which the site notice should take users to:") %>
<%= text_input(f, :link, class: "input input--wide", placeholder: "Link") %>
<%= error_tag(f, :link) %>
</div>
<h3>
Run Time
</h3>
<div class="field">
<%= label(f, :start_time, "Start time for the site notice (usually \"now\"):") %>
<%= text_input(f, :start_time, class: "input input--wide", required: true) %>
<%= error_tag(f, :start_time) %>
</div>
<div class="field">
<%= label(f, :finish_time, "Finish time for the site notice (e.g. \"2 weeks from now\"):") %>
<%= text_input(f, :finish_time, class: "input input--wide", required: true) %>
<%= error_tag(f, :finish_time) %>
</div>
<h3>
Enable
</h3>
<div class="field">
<%= checkbox(f, :live, class: "checkbox") %>
<%= label(f, :live, "Live") %>
</div>
<%= submit("Save Site Notice", class: "button") %>
<% end %>

View file

@ -1,47 +0,0 @@
= form_for @changeset, @action, fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
.field
=> label f, :title, "Title (the bold bit) for the site notice; keep this short:"
= text_input f, :title, class: "input input--wide", placeholder: "Title", required: true
= error_tag f, :title
.field
=> label f, :text, "Main body of the site notice:"
= text_input f, :text, class: "input input--wide", placeholder: "Text", required: true
= error_tag f, :text
h3
' Link
small
' (optional; leave these two fields blank for no link)
.field
=> label f, :link_text, "Text which will contain the link:"
= text_input f, :link_text, class: "input input--wide", placeholder: "Link text"
= error_tag f, :link_text
.field
=> label f, :link, "Link which the site notice should take users to:"
= text_input f, :link, class: "input input--wide", placeholder: "Link"
= error_tag f, :link
h3 Run Time
.field
=> label f, :start_time, "Start time for the site notice (usually \"now\"):"
= text_input f, :start_time, class: "input input--wide", required: true
= error_tag f, :start_time
.field
=> label f, :finish_time, "Finish time for the site notice (e.g. \"2 weeks from now\"):"
= text_input f, :finish_time, class: "input input--wide", required: true
= error_tag f, :finish_time
h3 Enable
.field
=> checkbox f, :live, class: "checkbox"
= label f, :live, "Live"
= submit "Save Site Notice", class: "button"

View file

@ -0,0 +1,4 @@
<h1>
Editing site notice
</h1>
<%= render(PhilomenaWeb.Admin.SiteNoticeView, "_form.html", changeset: @changeset, action: ~p"/admin/site_notices/#{@site_notice}", conn: @conn) %>

View file

@ -1,2 +0,0 @@
h1 Editing site notice
= render PhilomenaWeb.Admin.SiteNoticeView, "_form.html", changeset: @changeset, action: ~p"/admin/site_notices/#{@site_notice}", conn: @conn

View file

@ -0,0 +1,65 @@
<h1>
Site Notices
</h1>
<% route = fn p -> ~p"/admin/site_notices?#{p}" end %>
<% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @admin_site_notices, route: route, conn: @conn) %>
<div class="block">
<div class="block__header">
<a href={~p"/admin/site_notices/new"}>
<i class="fa fa-plus"></i>
New site notice
</a>
<%= pagination %>
</div>
<div class="block__content">
<table class="table">
<thead>
<tr>
<th>
Title
</th>
<th>
Start
</th>
<th>
Finish
</th>
<th>
Live?
</th>
<th>
Options
</th>
</tr>
</thead>
<tbody>
<%= for site_notice <- @admin_site_notices do %>
<tr>
<td>
<em>
<%= site_notice.title %>
</em>
</td>
<td class={time_column_class(site_notice.start_date)}>
<%= pretty_time(site_notice.start_date) %>
</td>
<td class={time_column_class(site_notice.finish_date)}>
<%= pretty_time(site_notice.finish_date) %>
</td>
<td>
<%= live_text(site_notice) %>
</td>
<td>
<%= link("Edit", to: ~p"/admin/site_notices/#{site_notice}/edit") %>
&bull;
<%= link("Destroy", to: ~p"/admin/site_notices/#{site_notice}", data: [confirm: "Are you really, really sure?", method: "delete"]) %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="block__header block__header--light">
<%= pagination %>
</div>
</div>

View file

@ -1,44 +0,0 @@
h1 Site Notices
- route = fn p -> ~p"/admin/site_notices?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @admin_site_notices, route: route, conn: @conn
.block
.block__header
a href=~p"/admin/site_notices/new"
i.fa.fa-plus>
' New site notice
= pagination
.block__content
table.table
thead
tr
th Title
th Start
th Finish
th Live?
th Options
tbody
= for site_notice <- @admin_site_notices do
tr
td
em = site_notice.title
td class=time_column_class(site_notice.start_date)
= pretty_time site_notice.start_date
td class=time_column_class(site_notice.finish_date)
= pretty_time site_notice.finish_date
td
= live_text site_notice
td
=> link "Edit", to: ~p"/admin/site_notices/#{site_notice}/edit"
' &bull;
=> link "Destroy", to: ~p"/admin/site_notices/#{site_notice}", data: [confirm: "Are you really, really sure?", method: "delete"]
.block__header.block__header--light
= pagination

View file

@ -0,0 +1,4 @@
<h1>
New site notice
</h1>
<%= render(PhilomenaWeb.Admin.SiteNoticeView, "_form.html", changeset: @changeset, action: ~p"/admin/site_notices", conn: @conn) %>

View file

@ -1,2 +0,0 @@
h1 New site notice
= render PhilomenaWeb.Admin.SiteNoticeView, "_form.html", changeset: @changeset, action: ~p"/admin/site_notices", conn: @conn

View file

@ -0,0 +1,34 @@
<%= form_for @changeset, @action, fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>
Oops, something went wrong! Please check the errors below.
</p>
</div>
<% end %>
<div class="field">
<%= label(f, :specification, "Specification:") %>
<%= text_input(f, :specification, class: "input", placeholder: "Specification", required: true) %>
</div>
<div class="field">
<%= 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) %>
<%= error_tag(f, :reason) %>
</div>
<div class="field">
<%= label(f, :note, "Admin-only note:") %>
<%= text_input(f, :note, class: "input input--wide", placeholder: "Note") %>
</div>
<div class="field">
<%= 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) %>
<%= error_tag(f, :until) %>
</div>
<br />
<div class="field">
<%= checkbox(f, :enabled) %>
<%= label(f, :enabled) %>
</div>
<br />
<%= submit("Save Ban", class: "button") %>
<% end %>

View file

@ -1,30 +0,0 @@
= form_for @changeset, @action, fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
.field
=> label f, :specification, "Specification:"
= text_input f, :specification, class: "input", placeholder: "Specification", required: true
.field
=> 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
= error_tag f, :reason
.field
=> label f, :note, "Admin-only note:"
= text_input f, :note, class: "input input--wide", placeholder: "Note"
.field
=> 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
= error_tag f, :until
br
.field
=> checkbox f, :enabled
= label f, :enabled
br
= submit "Save Ban", class: "button"

View file

@ -0,0 +1,6 @@
<h1>
Editing ban
</h1>
<%= render(PhilomenaWeb.Admin.SubnetBanView, "_form.html", changeset: @changeset, action: ~p"/admin/subnet_bans/#{@subnet}", conn: @conn) %>
<br />
<%= link("Back", to: ~p"/admin/subnet_bans") %>

View file

@ -1,6 +0,0 @@
h1 Editing ban
= render PhilomenaWeb.Admin.SubnetBanView, "_form.html", changeset: @changeset, action: ~p"/admin/subnet_bans/#{@subnet}", conn: @conn
br
= link "Back", to: ~p"/admin/subnet_bans"

View file

@ -0,0 +1,86 @@
<h1>
Subnet Bans
</h1>
<% route = fn p -> ~p"/admin/subnet_bans?#{p}" end %>
<% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @subnet_bans, route: route, params: page_params(@conn.params)) %>
<%= form_for :subnet_ban, ~p"/admin/subnet_bans", [method: "get", class: "hform"], fn f -> %>
<div class="field">
<%= text_input(f, :q, name: "q", class: "hform__text input", placeholder: "Search") %>
<%= submit("Search", class: "button hform__button") %>
</div>
<% end %>
<div class="block">
<div class="block__header">
<a href={~p"/admin/subnet_bans/new"}>
<i class="fa fa-plus"></i>
New subnet ban
</a>
<%= pagination %>
</div>
<div class="block__content">
<table class="table">
<thead>
<tr>
<th>
Specification
</th>
<th>
Created
</th>
<th>
Expires
</th>
<th>
Reason/Note
</th>
<th>
Ban ID
</th>
<th>
Options
</th>
</tr>
</thead>
<tbody>
<%= for ban <- @subnet_bans do %>
<tr>
<td>
<%= link(ban.specification, to: ~p"/ip_profiles/#{to_string(ban.specification)}") %>
</td>
<td>
<%= pretty_time(ban.created_at) %>
<%= user_abbrv(ban.banning_user) %>
</td>
<td class={ban_row_class(ban)}>
<%= pretty_time(ban.valid_until) %>
</td>
<td>
<%= ban.reason %>
<%= if present?(ban.note) do %>
<p class="block block--fixed">
<em>
Note:
<%= ban.note %>
</em>
</p>
<% end %>
</td>
<td>
<%= ban.generated_ban_id %>
</td>
<td>
<%= link("Edit", to: ~p"/admin/subnet_bans/#{ban}/edit") %>
<%= if @current_user.role == "admin" do %>
&bull;
<%= link("Destroy", to: ~p"/admin/subnet_bans/#{ban}", data: [confirm: "Are you really, really sure?", method: "delete"]) %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="block__header block__header--light">
<%= pagination %>
</div>
</div>

View file

@ -1,62 +0,0 @@
h1 Subnet Bans
- route = fn p -> ~p"/admin/subnet_bans?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @subnet_bans, route: route, params: page_params(@conn.params)
= form_for :subnet_ban, ~p"/admin/subnet_bans", [method: "get", class: "hform"], fn f ->
.field
= text_input f, :q, name: "q", class: "hform__text input", placeholder: "Search"
= submit "Search", class: "button hform__button"
.block
.block__header
a href=~p"/admin/subnet_bans/new"
i.fa.fa-plus>
' New subnet ban
= pagination
.block__content
table.table
thead
tr
th Specification
th Created
th Expires
th Reason/Note
th Ban ID
th Options
tbody
= for ban <- @subnet_bans do
tr
td
= link ban.specification, to: ~p"/ip_profiles/#{to_string(ban.specification)}"
td
=> pretty_time ban.created_at
= user_abbrv ban.banning_user
td class=ban_row_class(ban)
= pretty_time ban.valid_until
td
= ban.reason
= if present?(ban.note) do
p.block.block--fixed
em
' Note:
= ban.note
td
= ban.generated_ban_id
td
=> link "Edit", to: ~p"/admin/subnet_bans/#{ban}/edit"
= if @current_user.role == "admin" do
' &bull;
=> link "Destroy", to: ~p"/admin/subnet_bans/#{ban}", data: [confirm: "Are you really, really sure?", method: "delete"]
.block__header.block__header--light
= pagination

View file

@ -0,0 +1,6 @@
<h1>
New Subnet Ban
</h1>
<%= render(PhilomenaWeb.Admin.SubnetBanView, "_form.html", changeset: @changeset, action: ~p"/admin/subnet_bans", conn: @conn) %>
<br />
<%= link("Back", to: ~p"/admin/subnet_bans") %>

View file

@ -1,5 +0,0 @@
h1 New Subnet Ban
= render PhilomenaWeb.Admin.SubnetBanView, "_form.html", changeset: @changeset, action: ~p"/admin/subnet_bans", conn: @conn
br
= link "Back", to: ~p"/admin/subnet_bans"

View file

@ -0,0 +1,121 @@
<%= form_for @changeset, @action, fn f -> %>
<%= if @changeset.action do %>
<div class="alert alert-danger">
<p>
Oops, something went wrong! Please check the errors below.
</p>
</div>
<% end %>
<div class="block">
<div class="block__header">
<span class="block__header__title">
Essential user details
</span>
</div>
<label class="table-list__label">
<div class="table-list__label__text">
Name:
</div>
<div class="table-list__label__input">
<%= error_tag(f, :name) %>
<%= text_input(f, :name, class: "input") %>
</div>
</label>
<label class="table-list__label">
<div class="table-list__label__text">
Email:
</div>
<div class="table-list__label__input">
<%= error_tag(f, :email) %>
<%= text_input(f, :email, class: "input") %>
</div>
</label>
<label class="table-list__label">
<div class="table-list__label__text">
Role:
</div>
<div class="table-list__label__input">
<%= select(f, :role, ["user", "assistant", "moderator", "admin"], class: "input") %>
</div>
</label>
<label class="table-list__label">
<div class="table-list__label__text">
Secondary banner:
</div>
<div class="table-list__label__input">
<%= select(f, :secondary_role, [[key: "-", value: ""], "Site Developer", "Devops", "Philomena Contributor", "Public Relations"], class: "input") %>
</div>
</label>
<label class="table-list__label">
<div class="table-list__label__text">
Hide staff banner:
</div>
<div class="table-list__label__input">
<%= checkbox(f, :hide_default_role, class: "checkbox") %>
</div>
</label>
<label class="table-list__label">
<div class="table-list__label__text">
Senior staff:
</div>
<div class="table-list__label__input">
<%= checkbox(f, :senior_staff, class: "checkbox") %>
</div>
</label>
<label class="table-list__label">
<div class="table-list__label__text">
Bypass rate limits:
</div>
<div class="table-list__label__input">
<%= checkbox(f, :bypass_rate_limits, class: "checkbox") %>
</div>
</label>
<div class="table-list__label">
<div class="table-list__label__text">
Avatar
</div>
<div class="table-list__label__input">
<%= link("Remove avatar", to: ~p"/admin/users/#{@user}/avatar", class: "button", data: [method: "delete", confirm: "Are you really, really sure?"]) %>
</div>
</div>
</div>
<div class="block">
<div class="block__header">
<span class="block__header__title">
General user flags
</span>
</div>
<ul>
<p>
<strong>
Be careful when issuing these permissions to staff members!
</strong>
Staff members with relevant roles may have these permissions anyway. Issuing them may break things, such as tag aliasing.
</p>
</ul>
<ul>
<%= collection_checkboxes(f, :roles, filtered_roles(general_permissions(), @roles), mapper: &checkbox_mapper/6) %>
</ul>
</div>
<div class="block">
<div class="block__header warning">
<span class="block__header__title">
Special roles for assistants
</span>
</div>
<ul>
<%= collection_checkboxes(f, :roles, filtered_roles(assistant_permissions(), @roles), mapper: &checkbox_mapper/6) %>
</ul>
</div>
<div class="block">
<div class="block__header danger">
<span class="block__header__title">
Special roles for moderators
</span>
</div>
<ul>
<%= collection_checkboxes(f, :roles, filtered_roles(moderator_permissions(), @roles), mapper: &checkbox_mapper/6) %>
</ul>
</div>
<%= submit("Save User", class: "button") %>
<% end %>

View file

@ -1,58 +0,0 @@
= form_for @changeset, @action, fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.
.block
.block__header
span.block__header__title Essential user details
label.table-list__label
.table-list__label__text Name:
.table-list__label__input
= error_tag f, :name
= text_input f, :name, class: "input"
label.table-list__label
.table-list__label__text Email:
.table-list__label__input
= error_tag f, :email
= text_input f, :email, class: "input"
label.table-list__label
.table-list__label__text Role:
.table-list__label__input = select f, :role, ["user", "assistant", "moderator", "admin"], class: "input"
label.table-list__label
.table-list__label__text Secondary banner:
.table-list__label__input = select f, :secondary_role, [[key: "-", value: ""], "Site Developer", "Devops", "Philomena Contributor", "Public Relations"], class: "input"
label.table-list__label
.table-list__label__text Hide staff banner:
.table-list__label__input = checkbox f, :hide_default_role, class: "checkbox"
label.table-list__label
.table-list__label__text Senior staff:
.table-list__label__input = checkbox f, :senior_staff, class: "checkbox"
label.table-list__label
.table-list__label__text Bypass rate limits:
.table-list__label__input = checkbox f, :bypass_rate_limits, class: "checkbox"
.table-list__label
.table-list__label__text Avatar
.table-list__label__input
= link "Remove avatar", to: ~p"/admin/users/#{@user}/avatar", class: "button", data: [method: "delete", confirm: "Are you really, really sure?"]
.block
.block__header
span.block__header__title General user flags
ul
p
strong> Be careful when issuing these permissions to staff members!
| Staff members with relevant roles may have these permissions anyway. Issuing them may break things, such as tag aliasing.
ul = collection_checkboxes f, :roles, filtered_roles(general_permissions(), @roles), mapper: &checkbox_mapper/6
.block
.block__header.warning
span.block__header__title Special roles for assistants
ul = collection_checkboxes f, :roles, filtered_roles(assistant_permissions(), @roles), mapper: &checkbox_mapper/6
.block
.block__header.danger
span.block__header__title Special roles for moderators
ul = collection_checkboxes f, :roles, filtered_roles(moderator_permissions(), @roles), mapper: &checkbox_mapper/6
= submit "Save User", class: "button"

View file

@ -0,0 +1,4 @@
<h1>
Editing user
</h1>
<%= render(PhilomenaWeb.Admin.UserView, "_form.html", Map.put(assigns, :action, ~p"/admin/users/#{@user}")) %>

View file

@ -1,3 +0,0 @@
h1 Editing user
= render PhilomenaWeb.Admin.UserView, "_form.html", Map.put(assigns, :action, ~p"/admin/users/#{@user}")

View file

@ -0,0 +1,12 @@
<h1>
Force-assigning a filter for user
<%= @user.name %>
</h1>
<%= form_for @changeset, ~p"/admin/users/#{@user}/force_filter", [method: "post"], fn f -> %>
<div class="field">
<%= text_input(f, :forced_filter_id, placeholder: "Filter ID", class: "input", required: true) %>
</div>
<div class="field">
<%= submit("Force", class: "button button--state-primary") %>
</div>
<% end %>

View file

@ -1,9 +0,0 @@
h1
' Force-assigning a filter for user
= @user.name
= form_for @changeset, ~p"/admin/users/#{@user}/force_filter", [method: "post"], fn f ->
.field
=> text_input f, :forced_filter_id, placeholder: "Filter ID", class: "input", required: true
.field
= submit "Force", class: "button button--state-primary"

View file

@ -0,0 +1,124 @@
<h1>
Users
</h1>
<%= form_for :user, ~p"/admin/users", [method: "get", class: "hform"], fn f -> %>
<div class="field">
<%= text_input(f, :q, name: "q", class: "hform__text input", placeholder: "Search query") %>
<%= submit("Search", class: "button hform__button") %>
</div>
<% end %>
<%= link("Site staff", to: ~p"/admin/users?#{[staff: 1]}") %>
&bull;
<%= link("2FA users", to: ~p"/admin/users?#{[twofactor: 1]}") %>
<% route = fn p -> ~p"/admin/users?#{p}" end %>
<% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @users, route: route, conn: @conn, params: page_params(@conn.params)) %>
<div class="block">
<div class="block__header">
<%= pagination %>
</div>
<div class="block__content"></div>
<table class="table">
<thead>
<tr>
<th>
Name
</th>
<th>
Email
</th>
<th>
Activated
</th>
<th>
Role
</th>
<th>
Created
</th>
<th>
Options
</th>
</tr>
</thead>
<tbody>
<%= for user <- @users do %>
<tr>
<td>
<%= link(user.name, to: ~p"/profiles/#{user}") %>
<%= cond do %>
<% user.otp_required_for_login -> %>
<span class="banner__2fa success">
<i class="fas fa-check"></i>
2FA
</span>
<% user.role != "user" and !user.otp_required_for_login -> %>
<span class="banner__2fa danger">
<i class="fas fa-times"></i>
2FA
</span>
<% true -> %>
<% end %>
</td>
<td>
<%= if can?(@conn, :edit, Philomena.Users.User) do %>
<%= user.email %>
<% else %>
<i>
N/A
</i>
<% end %>
</td>
<td>
<%= cond do %>
<% user.deleted_at -> %>
<strong>
Deactivated
</strong>
<%= pretty_time(user.deleted_at) %>
<% user.confirmed_at -> %>
Active
<% true -> %>
<strong>
Unconfirmed
</strong>
<% end %>
</td>
<td>
<%= String.capitalize(user.role) %>
</td>
<td>
<%= pretty_time(user.created_at) %>
</td>
<td>
<%= if can?(@conn, :edit, user) do %>
<%= link to: ~p"/admin/users/#{user}/edit" do %>
<i class="fa fa-fw fa-user-edit"></i>
Edit
<% end %>
<% end %>
<% # = if user.deleted_at do %>
<% # => link_to 'Reactivate', admin_user_activation_path(user), data: { confirm: t('are_you_sure') }, method: :create %>
<% # - else %>
<% # => link_to 'Deactivate', admin_user_activation_path(user), data: { confirm: t('are_you_sure') }, method: :delete %>
<% # ' &bull; %>
<%= if can?(@conn, :index, Philomena.Bans.User) do %>
<%= link to: ~p"/admin/user_bans/new?#{[username: user.name]}" do %>
<i class="fa fa-fw fa-ban"></i>
Ban
<% end %>
<% end %>
<%= if can?(@conn, :edit, Philomena.ArtistLinks.ArtistLink) do %>
<%= link to: ~p"/profiles/#{user}/artist_links/new" do %>
<i class="fa fa-fw fa-link"></i>
Add link
<% end %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<div class="block__header block__header--light">
<%= pagination %>
</div>
</div>

View file

@ -1,94 +0,0 @@
h1 Users
= form_for :user, ~p"/admin/users", [method: "get", class: "hform"], fn f ->
.field
=> text_input f, :q, name: "q", class: "hform__text input", placeholder: "Search query"
= submit "Search", class: "button hform__button"
=> link "Site staff", to: ~p"/admin/users?#{[staff: 1]}"
' &bull;
=> link "2FA users", to: ~p"/admin/users?#{[twofactor: 1]}"
- route = fn p -> ~p"/admin/users?#{p}" end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @users, route: route, conn: @conn, params: page_params(@conn.params)
.block
.block__header
= pagination
.block__content
table.table
thead
tr
th Name
th Email
th Activated
th Role
th Created
th Options
tbody
= for user <- @users do
tr
td
= link user.name, to: ~p"/profiles/#{user}"
= cond do
- user.otp_required_for_login ->
span.banner__2fa.success
i.fas.fa-check>
' 2FA
- user.role != "user" and !user.otp_required_for_login ->
span.banner__2fa.danger
i.fas.fa-times>
' 2FA
- true ->
td
= if can?(@conn, :edit, Philomena.Users.User) do
= user.email
- else
i N/A
td
= cond do
- user.deleted_at ->
strong> Deactivated
= pretty_time user.deleted_at
- user.confirmed_at ->
' Active
- true ->
strong> Unconfirmed
td
= String.capitalize(user.role)
td
= pretty_time user.created_at
td
= if can?(@conn, :edit, user) do
=> link to: ~p"/admin/users/#{user}/edit" do
i.fa.fa-fw.fa-user-edit
' Edit
/= if user.deleted_at do
/ => link_to 'Reactivate', admin_user_activation_path(user), data: { confirm: t('are_you_sure') }, method: :create
/- else
/ => link_to 'Deactivate', admin_user_activation_path(user), data: { confirm: t('are_you_sure') }, method: :delete
/' &bull;
= if can?(@conn, :index, Philomena.Bans.User) do
=> link to: ~p"/admin/user_bans/new?#{[username: user.name]}" do
i.fa.fa-fw.fa-ban
' Ban
= if can?(@conn, :edit, Philomena.ArtistLinks.ArtistLink) do
=> link to: ~p"/profiles/#{user}/artist_links/new" do
i.fa.fa-fw.fa-link
' Add link
.block__header.block__header--light
= pagination

Some files were not shown because too many files have changed in this diff Show more