From 8fbf77cfe4bf0109269fb84094d3e22903e86916 Mon Sep 17 00:00:00 2001 From: asonix Date: Sun, 24 Jan 2021 15:30:02 -0600 Subject: [PATCH] Server: Use toolkit for edit submission page images Update buttons to latest toolkit api --- server/src/admin.rs | 60 +++------ server/src/feed.rs | 14 +-- server/src/home.rs | 16 +-- server/src/nav.rs | 50 ++------ server/src/notifications.rs | 57 ++++----- server/src/profiles/state.rs | 118 ++++-------------- server/src/submissions.rs | 36 ++---- server/templates/admin/index.rs.html | 22 ++-- server/templates/comments/edit.rs.html | 4 +- server/templates/comments/public.rs.html | 8 +- server/templates/comments/report.rs.html | 4 +- .../templates/comments/report_success.rs.html | 2 +- server/templates/feed/index.rs.html | 2 +- server/templates/index.rs.html | 4 +- server/templates/layouts/home.rs.html | 2 +- server/templates/notifications/index.rs.html | 16 +-- .../templates/profiles/create/banner.rs.html | 8 +- server/templates/profiles/create/bio.rs.html | 6 +- server/templates/profiles/create/done.rs.html | 4 +- .../templates/profiles/create/handle.rs.html | 2 +- server/templates/profiles/create/icon.rs.html | 8 +- .../profiles/create/require_login.rs.html | 6 +- server/templates/profiles/current.rs.html | 14 +-- server/templates/profiles/delete.rs.html | 2 +- server/templates/profiles/drafts.rs.html | 6 +- server/templates/profiles/list.rs.html | 4 +- server/templates/profiles/public.rs.html | 8 +- server/templates/profiles/report.rs.html | 4 +- .../templates/profiles/report_success.rs.html | 2 +- server/templates/session/account.rs.html | 2 +- server/templates/submissions/create.rs.html | 2 +- server/templates/submissions/image.rs.html | 19 --- server/templates/submissions/report.rs.html | 4 +- .../submissions/report_success.rs.html | 2 +- server/templates/submissions/update.rs.html | 55 ++++---- 35 files changed, 192 insertions(+), 381 deletions(-) delete mode 100644 server/templates/submissions/image.rs.html diff --git a/server/src/admin.rs b/server/src/admin.rs index a9be890..e6cc210 100644 --- a/server/src/admin.rs +++ b/server/src/admin.rs @@ -395,10 +395,8 @@ pub(crate) struct BlockView<'a> { } impl<'a> BlockView<'a> { - pub(crate) fn unblock(&self, dark: bool) -> Button { - Button::secondary("Unblock") - .form(&self.unblock_path()) - .dark(dark) + pub(crate) fn unblock(&self) -> Button { + Button::secondary("Unblock").form(&self.unblock_path()) } fn unblock_path(&self) -> String { @@ -411,16 +409,12 @@ pub(crate) struct FederatedView<'a> { } impl<'a> FederatedView<'a> { - pub(crate) fn defederate(&self, dark: bool) -> Button { - Button::secondary("Defederate") - .form(&self.defederate_path()) - .dark(dark) + pub(crate) fn defederate(&self) -> Button { + Button::secondary("Defederate").form(&self.defederate_path()) } - pub(crate) fn block(&self, dark: bool) -> Button { - Button::secondary("Block") - .form(&self.block_path()) - .dark(dark) + pub(crate) fn block(&self) -> Button { + Button::secondary("Block").form(&self.block_path()) } fn defederate_path(&self) -> String { @@ -437,22 +431,16 @@ pub(crate) struct InboundRequestView<'a> { } impl<'a> InboundRequestView<'a> { - pub(crate) fn accept(&self, dark: bool) -> Button { - Button::secondary("Accept") - .form(&self.accept_path()) - .dark(dark) + pub(crate) fn accept(&self) -> Button { + Button::secondary("Accept").form(&self.accept_path()) } - pub(crate) fn reject(&self, dark: bool) -> Button { - Button::secondary("Reject") - .form(&self.reject_path()) - .dark(dark) + pub(crate) fn reject(&self) -> Button { + Button::secondary("Reject").form(&self.reject_path()) } - pub(crate) fn block(&self, dark: bool) -> Button { - Button::secondary("Block") - .form(&self.block_path()) - .dark(dark) + pub(crate) fn block(&self) -> Button { + Button::secondary("Block").form(&self.block_path()) } fn accept_path(&self) -> String { @@ -473,16 +461,12 @@ pub(crate) struct OutboundRequestView<'a> { } impl<'a> OutboundRequestView<'a> { - pub(crate) fn cancel(&self, dark: bool) -> Button { - Button::secondary("Cancel") - .form(&self.cancel_path()) - .dark(dark) + pub(crate) fn cancel(&self) -> Button { + Button::secondary("Cancel").form(&self.cancel_path()) } - pub(crate) fn block(&self, dark: bool) -> Button { - Button::secondary("Block") - .form(&self.block_path()) - .dark(dark) + pub(crate) fn block(&self) -> Button { + Button::secondary("Block").form(&self.block_path()) } fn cancel_path(&self) -> String { @@ -499,16 +483,12 @@ pub(crate) struct KnownView<'a> { } impl<'a> KnownView<'a> { - pub(crate) fn federate(&self, dark: bool) -> Button { - Button::secondary("Request Federation") - .form(&self.federate_path()) - .dark(dark) + pub(crate) fn federate(&self) -> Button { + Button::secondary("Request Federation").form(&self.federate_path()) } - pub(crate) fn block(&self, dark: bool) -> Button { - Button::secondary("Block") - .form(&self.block_path()) - .dark(dark) + pub(crate) fn block(&self) -> Button { + Button::secondary("Block").form(&self.block_path()) } fn federate_path(&self) -> String { diff --git a/server/src/feed.rs b/server/src/feed.rs index 734f49a..8381390 100644 --- a/server/src/feed.rs +++ b/server/src/feed.rs @@ -99,23 +99,15 @@ impl ViewFeedState { self.submission_page.next.is_some() || self.submission_page.prev.is_some() } - pub(crate) fn nav(&self, dark: bool) -> Vec