Skip to content

Commit

Permalink
Merge remote-tracking branch 'philo/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Meow committed Jun 2, 2023
2 parents 333740f + 41349ac commit 2c1bbb0
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 36 deletions.
12 changes: 12 additions & 0 deletions assets/css/common/_blocks.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ a.block__header--single-item, .block__header a {
padding: 0 ($header_spacing * 0.5) 0 $header_spacing;
}

.block__header__buttons {
display: flex;
flex-direction: row;
line-height: 100%;
align-items: center;
background: 0;
}

.block__tagbox {
padding-top: $block_spacing + 5px;
}

.block__header--light {
background: $block_header_light_color;
a, .header__span {
Expand Down
11 changes: 11 additions & 0 deletions assets/css/common/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
}
}

.button--inline {
padding: 0.25rem;
border: 0;
border-radius: 0.25rem;
font-weight: 100;
}

.button--bold {
font-weight: bold;
}
Expand Down Expand Up @@ -88,4 +95,8 @@
background-color: $button_danger_hover_background;
border-color: $button_danger_hover_border;
}

&.button--inline {
color: $button_danger_hover_border !important;
}
}
7 changes: 7 additions & 0 deletions assets/css/views/_approval.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
margin-bottom: auto;
}

.approval-items__details {
display: grid;
grid-template-columns: auto auto;
gap: var(--padding-normal);
line-height: 100%;
}

@media (max-width: $min_px_width_for_desktop_layout) {
.approval-grid {
grid-template-columns: 1fr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
.approval-grid
.approval-items--main
span = link ">>#{image.id}", to: Routes.image_path(@conn, :show, image)
span = image_thumb(@conn, 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: Routes.profile_path(@conn, :show, image.user)
Expand Down
11 changes: 6 additions & 5 deletions lib/philomena_web/templates/image/_description.html.slime
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
.block
.block__header
.block__header.flex
span.block__header__title
i.fas.fa-file-lines>
' Description
= if can?(@conn, :edit_description, @image) do
.block__header__buttons
a.button.button--inline#edit-description href="#" data-click-focus="#description" data-click-hide=".image-description" data-click-show="#description-form" title="Edit description" accessKey="d"
i.fas.fa-edit>
' Edit
.block__content
p
= if String.length(@body) > 0 do
== @body
- else
em No description provided.
= if can?(@conn, :edit_description, @image) do
a.button#edit-description href="#" data-click-focus="#description" data-click-hide=".image-description" data-click-show="#description-form" title="Edit description" accessKey="d"
i.fas.fa-edit>
' Edit
40 changes: 21 additions & 19 deletions lib/philomena_web/templates/image/_source.html.slime
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,33 @@
' You can't edit the source on this image.

.block#image-source
.block__header
.block__header.flex
span.block__header__title
i.fas.fa-link>
= if !has_sources || length(@image.sources) == 1 do
' Source
- else
' Sources

.block__header__buttons
a.button.button--inline#edit-source data-click-focus=".js-image-source" data-click-hide="#image-source" data-click-show="#source-form" title="Edit source" accessKey="s"
i.fas.fa-edit
= if has_sources do
' Add/Edit
- else
' Add
= if @source_change_count > 0 do
a.button.button--link.button--inline href=Routes.image_source_change_path(@conn, :index, @image) title="Source history"
i.fa.fa-history>
spanspan.hide-mobile> History
| (
= @source_change_count
| )
= if can?(@conn, :hide, @image) and not hide_staff_tools?(@conn) do
= form_for @changeset, Routes.image_source_history_path(@conn, :delete, @image), [method: "delete"], fn _f ->
a.button.button--state-danger.button--inline type="submit" data-confirm="Are you really, really sure?" title="Wipe sources"
i.fas.fa-eraser>
' Wipe
.block__content.flex.flex--wrap.flex--column
.image_sources
= if has_sources do
Expand All @@ -65,21 +85,3 @@
i.fa.fa-unlink
.image_source__link
em> not provided yet
.flex
a.button#edit-source data-click-focus=".js-image-source" data-click-hide="#image-source" data-click-show="#source-form" title="Edit source" accessKey="s"
i.fas.fa-edit>
= if has_sources do
' Add/Edit
- else
' Add
= if @source_change_count > 0 do
a.button.button--link.button--separate-left href=Routes.image_source_change_path(@conn, :index, @image) title="Source history"
i.fa.fa-history>
| History (
= @source_change_count
| )
= if can?(@conn, :hide, @image) and not hide_staff_tools?(@conn) do
= form_for @changeset, Routes.image_source_history_path(@conn, :delete, @image), [method: "delete"], fn _f ->
button.button.button--state-danger.button--separate-left type="submit" data-confirm="Are you really, really sure?" title="Wipe sources"
i.fas.fa-eraser>
' Wipe
23 changes: 12 additions & 11 deletions lib/philomena_web/templates/image/_tags.html.slime
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,19 @@
' You can't edit the tags on this image.

.block.tagsauce
.block__header
.block__header.flex
span.block__header__title
i.fas.fa-tag>
' Tags
.block__content
.block__header__buttons
a.button.button--inline.js-tag-sauce-toggle#edit-tags data-click-toggle=".tagsauce, .js-imageform" data-click-focus=".js-taginput-plain:not(.hidden), .js-taginput-input" title="Edit tags" accessKey="t"
i.fas.fa-edit>
' Edit
= if @tag_change_count > 0 do
a.button.button--link.button--inline href=Routes.image_tag_change_path(@conn, :index, @image) title="Tag history"
i.fa.fa-history>
| History (
= @tag_change_count
| )
.block__content.block__tagbox
= render PhilomenaWeb.TagView, "_tag_list.html", tags: tags, conn: @conn
a.button.js-tag-sauce-toggle#edit-tags data-click-toggle=".tagsauce, .js-imageform" data-click-focus=".js-taginput-plain:not(.hidden), .js-taginput-input" title="Edit tags" accessKey="t"
i.fas.fa-edit>
' Edit
= if @tag_change_count > 0 do
a.button.button--link.button--separate-left href=Routes.image_tag_change_path(@conn, :index, @image) title="Tag history"
i.fa.fa-history>
| History (
= @tag_change_count
| )
22 changes: 22 additions & 0 deletions lib/philomena_web/views/admin/approval_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,26 @@ defmodule PhilomenaWeb.Admin.ApprovalView do
conn: conn
)
end

def class_for_image(%{processed: false}), do: "block--warning"
def class_for_image(%{thumbnails_generated: false}), do: "block--warning"

def class_for_image(%{image_is_animated: a, image_duration: d, image_format: "png"})
when a or d > 0.04,
do: "block--danger"

def class_for_image(%{image_format: "svg"}), do: "block--warning"
def class_for_image(%{image_format: f}) when f in ["webm", "gif"], do: "block--danger"
def class_for_image(_), do: ""

def warning_text(%{processed: false}), do: "(not processed)"
def warning_text(%{thumbnails_generated: false}), do: "(not processed)"

def warning_text(%{image_is_animated: a, image_duration: d, image_format: "png"})
when a or d > 0.04,
do: "(animated png)"

def warning_text(%{image_format: "svg"}), do: "(svg)"
def warning_text(%{image_format: f}) when f in ["webm", "gif"], do: "(video)"
def warning_text(_), do: ""
end

0 comments on commit 2c1bbb0

Please sign in to comment.