filters and communications

This commit is contained in:
Luna D. 2024-07-02 20:09:30 +02:00
parent b329f6d5aa
commit bb45fcc651
No known key found for this signature in database
GPG key ID: 4B1C63448394F688
10 changed files with 194 additions and 55 deletions

View file

@ -64,3 +64,23 @@
color var(--transition-animation-duration) ease, color var(--transition-animation-duration) ease,
background var(--transition-animation-duration) ease; background var(--transition-animation-duration) ease;
} }
@define-mixin no-bottom-border-radius {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
@define-mixin no-top-border-radius {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
@define-mixin first-last-child-border-radius $classname {
.$(classname) > *:first-child {
@mixin no-top-border-radius;
}
$(classname) > *:last-child {
@mixin no-bottom-border-radius;
}
}

View file

@ -103,7 +103,7 @@
width: fit-content; width: fit-content;
font-weight: bold; font-weight: bold;
font-size: var(--font-size); font-size: var(--font-size);
background: var(--primary-muted-color); background: var(--secondary-dark-color);
color: var(--link-color); color: var(--link-color);
border-radius: var(--border-radius-inner); border-radius: var(--border-radius-inner);
padding: 0 var(--padding-small); padding: 0 var(--padding-small);
@ -117,7 +117,7 @@
.button:active { .button:active {
@mixin animated-transition; @mixin animated-transition;
color: var(--text-color); color: var(--text-color);
background: var(--primary-dark-color); background: var(--secondary-muted-color);
border-radius: var(--border-radius-inner); border-radius: var(--border-radius-inner);
cursor: pointer; cursor: pointer;
} }

View file

@ -1,10 +1,23 @@
ul, ul,
ol { ol {
padding: 0; display: flex;
list-style-type: none; flex-flow: column;
gap: var(--padding-small);
margin: 0;
margin-left: var(--padding-small);
padding-inline-start: var(--padding-normal);
}
li > ul,
li > ol {
padding-top: var(--padding-small);
} }
.horizontal-list { .horizontal-list {
display: flex; display: flex;
flex-flow: row;
gap: var(--padding-normal); gap: var(--padding-normal);
list-style-type: none;
padding: 0;
margin: 0;
} }

View file

@ -110,6 +110,7 @@
.image-container { .image-container {
display: flex; display: flex;
position: relative;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;

View file

@ -1,27 +1,59 @@
.table { .table,
.communication__body__text table {
border-collapse: collapse; border-collapse: collapse;
width: 100%; width: 100%;
} }
.table > thead { .table thead,
border-radius: var(--border-radius-inner); .communication__body__text table thead {
border-bottom-left-radius: 0; background: var(--secondary-muted-color);
border-bottom-right-radius: 0;
}
.table > tbody {
border-radius: var(--border-radius-inner);
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.table td,
th {
padding: var(--padding-small);
border: 1px solid var(--secondary-muted-color);
text-align: left;
} }
.table th { .table th {
background: var(--secondary-color); background: var(--secondary-color);
padding: var(--padding-normal) var(--padding-small);
}
.table td,
.table th {
padding: var(--padding-small);
text-align: left;
}
.communication__body__text table th {
background: var(--secondary-color);
padding: var(--padding-normal) var(--padding-small);
}
.communication__body__text table td,
.communication__body__text table th {
padding: var(--padding-small);
text-align: left;
}
.table tr,
.communication__body__text table tr {
border-bottom: 1px solid var(--secondary-muted-color);
}
.table thead th:last-child {
border-top-right-radius: var(--border-radius-inner);
}
.table thead th:first-child {
border-top-left-radius: var(--border-radius-inner);
}
.communication__body__text table thead th:first-child {
border-top-left-radius: var(--border-radius-inner);
}
.communication__body__text table thead th:last-child {
border-top-right-radius: var(--border-radius-inner);
}
.table tbody,
.communication__body__text table tbody {
border-top: 2px solid var(--secondary-muted-color);
border-bottom: 2px solid var(--secondary-muted-color);
} }

View file

@ -31,3 +31,43 @@
.walloftext { .walloftext {
line-height: var(--readable-line-height); line-height: var(--readable-line-height);
} }
pre,
code {
font-family: var(--font-family-monospace);
background: var(--background-color);
border: 1px solid var(--primary-border-color);
border-radius: var(--border-radius-inner);
padding: calc(var(--padding-tiny) / 2) var(--padding-tiny);
}
pre {
padding: var(--padding-small);
line-height: var(--readable-line-height);
margin: var(--padding-small);
margin-right: 0;
}
pre code {
border: 0;
background: 0;
padding: 0;
}
blockquote {
position: relative;
margin: 0;
padding: var(--padding-normal);
}
blockquote:before {
content: "";
display: block;
position: absolute;
background: var(--secondary-color);
border-radius: var(--border-radius-inner);
width: var(--padding-tiny);
height: 100%;
left: 0;
top: 0;
}

View file

@ -1,39 +1,59 @@
.filter .block
h3 .block__content
= @filter.name h3 = @filter.name
= if @filter.user do .flex.flex--row
p .button__group--standalone
' Maintained by = link to: ~p"/filters/#{@filter}" do
= render PhilomenaWeb.UserAttributionView, "_user.html", object: @filter, conn: @conn i.fa.fa-eye>
| View this filter
.separator--vertical
= link to: ~p"/filters/new?#{[based_on: @filter]}" do
i.fa.fa-copy>
| Copy and customize
= if @filter.system do
p
' Maintained by staff
.filter-options
ul
li
' Spoilers
= length(@filter.spoilered_tag_ids)
' , hides
= length(@filter.hidden_tag_ids)
li
= link "View this filter", to: ~p"/filters/#{@filter}", class: "button"
li
= link "Copy and Customize", to: ~p"/filters/new?#{[based_on: @filter]}", class: "button"
= if can?(@conn, :edit, @filter) do = if can?(@conn, :edit, @filter) do
li .button__group--standalone.button__group--warning
= link "Edit this filter", to: ~p"/filters/#{@filter}/edit", class: "button" = link to: ~p"/filters/#{@filter}/edit" do
i.fa.fa-edit>
| Edit this filter
= if @filter.id == @conn.assigns.current_filter.id do = if @filter.id == @conn.assigns.current_filter.id do
li .button__group--standalone.button__group--success
strong Your current filter a
i.fa.fa-check>
| Your current filter
- else - else
li .button__group--standalone
= button_to "Use this filter", ~p"/filters/current?#{[id: @filter]}", method: "put", class: "button" = button_to ~p"/filters/current?#{[id: @filter]}", method: "put", class: "button" do
i.fa.fa-arrow-right-to-bracket>
| Use this filter
= cond do
- @filter.user ->
p p
i.fa.fa-wrench.icon--fixed>
' Maintained by
= render PhilomenaWeb.UserAttributionView, "_user.html", object: @filter, conn: @conn
- @filter.system ->
p
i.fa.fa-wrench.icon--fixed>
' Maintained by site staff
- true ->
p
' Unknown maintainer
p
i.fa.fa-shield.icon--fixed>
' Spoilers
=> length(@filter.spoilered_tag_ids)
' tag(s)
p
i.fa.fa-eye-slash.icon--fixed>
' Hides
=> length(@filter.hidden_tag_ids)
' tag(s)
p
i.fa.fa-circle-info.icon--fixed>
em em
= @filter.description = @filter.description

View file

@ -27,12 +27,15 @@
= if !@conn.params["fq"] do = if !@conn.params["fq"] do
h2 My Filters h2 My Filters
= if @current_user do = if @current_user do
p = link to: ~p"/filters/new", class: "button" do
= link("Click here to make a new filter from scratch", to: ~p"/filters/new") i.fa.fa-plus>
| Click here to make a new filter from scratch
br
= for filter <- @my_filters do = for filter <- @my_filters do
= render PhilomenaWeb.FilterView, "_filter.html", conn: @conn, filter: filter = render PhilomenaWeb.FilterView, "_filter.html", conn: @conn, filter: filter
- else - else
p p
i.fa.fa-circle-info.icon--fixed>
' If you're logged in, you can create and maintain custom filters here. ' If you're logged in, you can create and maintain custom filters here.
h2 Global Filters h2 Global Filters

View file

@ -2,7 +2,7 @@
strong<> strong<>
- icon = user_icon(@object.user) - icon = user_icon(@object.user)
= if icon do = if icon do
i class="fa #{icon}"> i> class="fa #{icon}"
= link(@object.user.name, to: ~p"/profiles/#{@object.user}") = link(@object.user.name, to: ~p"/profiles/#{@object.user}")
= if assigns[:awards] do = if assigns[:awards] do
= render PhilomenaWeb.ProfileView, "_awards.html", awards: @object.user.awards = render PhilomenaWeb.ProfileView, "_awards.html", awards: @object.user.awards

View file

@ -102,7 +102,17 @@ defmodule PhilomenaWeb.AppView do
end end
end end
def button_to(text, route, args \\ []) do def button_to(route, args \\ [], do: fun) do
method = Keyword.get(args, :method, "get")
class = Keyword.get(args, :class, nil)
data = Keyword.get(args, :data, [])
form_for(nil, route, [method: method, class: "button_to"], fn _f ->
submit([class: class, data: data], do: fun)
end)
end
def button_to(text, route, args) do
method = Keyword.get(args, :method, "get") method = Keyword.get(args, :method, "get")
class = Keyword.get(args, :class, nil) class = Keyword.get(args, :class, nil)
data = Keyword.get(args, :data, []) data = Keyword.get(args, :data, [])