Server: Use toolkit for edit submission page images
Update buttons to latest toolkit api
This commit is contained in:
parent
58a6289c6c
commit
8fbf77cfe4
|
@ -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 {
|
||||
|
|
|
@ -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<Button> {
|
||||
pub(crate) fn nav(&self) -> Vec<Button> {
|
||||
let mut buttons = vec![];
|
||||
|
||||
if let Some(id) = self.submission_page.prev {
|
||||
buttons.push(
|
||||
Button::secondary("Previous")
|
||||
.href(&self.min_path(id))
|
||||
.dark(dark),
|
||||
);
|
||||
buttons.push(Button::secondary("Previous").href(&self.min_path(id)));
|
||||
}
|
||||
|
||||
if let Some(id) = self.submission_page.next {
|
||||
buttons.push(
|
||||
Button::secondary("Next")
|
||||
.href(&self.max_path(id))
|
||||
.dark(dark),
|
||||
);
|
||||
buttons.push(Button::secondary("Next").href(&self.max_path(id)));
|
||||
}
|
||||
|
||||
buttons
|
||||
|
|
|
@ -111,27 +111,19 @@ impl ViewHomeState {
|
|||
.collect()
|
||||
}
|
||||
|
||||
pub(crate) fn nav(&self, dark: bool) -> Vec<Button> {
|
||||
pub(crate) fn nav(&self) -> Vec<Button> {
|
||||
let mut nav = vec![];
|
||||
|
||||
if let Some(prev) = self.previous_id {
|
||||
nav.push(
|
||||
Button::secondary("Previous")
|
||||
.href(&format!("{}?min={}", self.path, prev))
|
||||
.dark(dark),
|
||||
);
|
||||
nav.push(Button::secondary("Previous").href(&format!("{}?min={}", self.path, prev)));
|
||||
}
|
||||
|
||||
if let Some(next) = self.next_id {
|
||||
nav.push(
|
||||
Button::secondary("Next")
|
||||
.href(&format!("{}?max={}", self.path, next))
|
||||
.dark(dark),
|
||||
);
|
||||
nav.push(Button::secondary("Next").href(&format!("{}?max={}", self.path, next)));
|
||||
}
|
||||
|
||||
if self.reset {
|
||||
nav.push(Button::secondary("Reset").href(&self.path).dark(dark));
|
||||
nav.push(Button::secondary("Reset").href(&self.path));
|
||||
}
|
||||
|
||||
nav
|
||||
|
|
|
@ -35,63 +35,31 @@ impl FromRequest for NavState {
|
|||
let mut nav = vec![];
|
||||
|
||||
if let Some(logout_state) = logout {
|
||||
nav.push(
|
||||
Button::primary("New Submission")
|
||||
.href("/submissions/create")
|
||||
.dark(dark),
|
||||
);
|
||||
nav.push(Button::primary("New Submission").href("/submissions/create"));
|
||||
|
||||
if let Some(profile) = profile.as_ref() {
|
||||
nav.push(
|
||||
Button::secondary("Profile")
|
||||
.href(&profile.view_path())
|
||||
.dark(dark),
|
||||
);
|
||||
nav.push(Button::secondary("Profile").href(&profile.view_path()));
|
||||
} else {
|
||||
nav.push(
|
||||
Button::secondary("Switch Profile")
|
||||
.href("/profiles/change")
|
||||
.dark(dark),
|
||||
);
|
||||
nav.push(Button::secondary("Switch Profile").href("/profiles/change"));
|
||||
};
|
||||
|
||||
if let Some(profile) = profile.as_ref() {
|
||||
if let Ok(count) = total_for_profile(profile.id(), &state).await {
|
||||
if count > 0 {
|
||||
nav.push(
|
||||
Button::secondary("Notifications")
|
||||
.href("/notifications")
|
||||
.dark(dark),
|
||||
);
|
||||
nav.push(Button::secondary("Notifications").href("/notifications"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nav.push(
|
||||
Button::secondary("Account")
|
||||
.href("/session/account")
|
||||
.dark(dark),
|
||||
);
|
||||
nav.push(Button::secondary("Account").href("/session/account"));
|
||||
|
||||
if admin.is_some() {
|
||||
nav.push(Button::secondary("Admin").href("/admin").dark(dark));
|
||||
nav.push(Button::secondary("Admin").href("/admin"));
|
||||
}
|
||||
nav.push(
|
||||
logout_state
|
||||
.button(Button::primary_outline("Logout"))
|
||||
.dark(dark),
|
||||
);
|
||||
nav.push(logout_state.button(Button::primary_outline("Logout")));
|
||||
} else {
|
||||
nav.push(
|
||||
Button::primary_outline("Login")
|
||||
.href("/session/auth/login")
|
||||
.dark(dark),
|
||||
);
|
||||
nav.push(
|
||||
Button::primary_outline("Register")
|
||||
.href("/session/auth/register")
|
||||
.dark(dark),
|
||||
);
|
||||
nav.push(Button::primary_outline("Login").href("/session/auth/login"));
|
||||
nav.push(Button::primary_outline("Register").href("/session/auth/register"));
|
||||
}
|
||||
|
||||
if let Some(query) = query {
|
||||
|
|
|
@ -277,21 +277,18 @@ impl<'a> CommentView<'a> {
|
|||
format!("/comments/{}", self.comment.id())
|
||||
}
|
||||
|
||||
pub(crate) fn view_button(&self, dark: bool) -> Button {
|
||||
pub(crate) fn view_button(&self) -> Button {
|
||||
Button::secondary("View")
|
||||
.href(&self.comment_path())
|
||||
.new_tab()
|
||||
.dark(dark)
|
||||
}
|
||||
|
||||
fn remove_path(&self) -> String {
|
||||
format!("/notifications/comments/{}/remove", self.id)
|
||||
}
|
||||
|
||||
pub(crate) fn remove_button(&self, dark: bool) -> Button {
|
||||
Button::secondary("Remove")
|
||||
.form(&self.remove_path())
|
||||
.dark(dark)
|
||||
pub(crate) fn remove_button(&self) -> Button {
|
||||
Button::secondary("Remove").form(&self.remove_path())
|
||||
}
|
||||
|
||||
pub(crate) fn author_name(&self) -> String {
|
||||
|
@ -310,22 +307,18 @@ pub(crate) struct FollowRequestView<'a> {
|
|||
}
|
||||
|
||||
impl<'a> FollowRequestView<'a> {
|
||||
pub(crate) fn accept_button(&self, dark: bool) -> Button {
|
||||
Button::secondary("Accept")
|
||||
.form(&format!(
|
||||
"/notifications/follow-requests/{}/accept",
|
||||
self.id
|
||||
))
|
||||
.dark(dark)
|
||||
pub(crate) fn accept_button(&self) -> Button {
|
||||
Button::secondary("Accept").form(&format!(
|
||||
"/notifications/follow-requests/{}/accept",
|
||||
self.id
|
||||
))
|
||||
}
|
||||
|
||||
pub(crate) fn reject_button(&self, dark: bool) -> Button {
|
||||
Button::secondary("Reject")
|
||||
.form(&format!(
|
||||
"/notifications/follow-requests/{}/reject",
|
||||
self.id
|
||||
))
|
||||
.dark(dark)
|
||||
pub(crate) fn reject_button(&self) -> Button {
|
||||
Button::secondary("Reject").form(&format!(
|
||||
"/notifications/follow-requests/{}/reject",
|
||||
self.id
|
||||
))
|
||||
}
|
||||
|
||||
pub(crate) fn view(&self) -> OwnedProfileView {
|
||||
|
@ -389,40 +382,32 @@ impl NotificationsView {
|
|||
"/notifications/clear"
|
||||
}
|
||||
|
||||
pub(crate) fn clear_button(&self, dark: bool) -> Button {
|
||||
Button::primary("Clear All")
|
||||
.form(self.clear_path())
|
||||
.dark(dark)
|
||||
pub(crate) fn clear_button(&self) -> Button {
|
||||
Button::primary("Clear All").form(self.clear_path())
|
||||
}
|
||||
|
||||
fn reject_path(&self) -> &'static str {
|
||||
"/notifications/follow-requests/reject-all"
|
||||
}
|
||||
|
||||
pub(crate) fn reject_all_button(&self, dark: bool) -> Button {
|
||||
Button::primary_outline("Reject All")
|
||||
.form(self.reject_path())
|
||||
.dark(dark)
|
||||
pub(crate) fn reject_all_button(&self) -> Button {
|
||||
Button::primary_outline("Reject All").form(self.reject_path())
|
||||
}
|
||||
|
||||
fn accept_path(&self) -> &'static str {
|
||||
"/notifications/follow-requests/accept-all"
|
||||
}
|
||||
|
||||
pub(crate) fn accept_all_button(&self, dark: bool) -> Button {
|
||||
Button::primary("Accept All")
|
||||
.form(self.accept_path())
|
||||
.dark(dark)
|
||||
pub(crate) fn accept_all_button(&self) -> Button {
|
||||
Button::primary("Accept All").form(self.accept_path())
|
||||
}
|
||||
|
||||
fn clear_comments_path(&self) -> &'static str {
|
||||
"/notifications/comments/clear-all"
|
||||
}
|
||||
|
||||
pub(crate) fn clear_comments_button(&self, dark: bool) -> Button {
|
||||
Button::primary("Clear Comments")
|
||||
.form(self.clear_comments_path())
|
||||
.dark(dark)
|
||||
pub(crate) fn clear_comments_button(&self) -> Button {
|
||||
Button::primary("Clear Comments").form(self.clear_comments_path())
|
||||
}
|
||||
|
||||
pub(crate) fn count(&self) -> u64 {
|
||||
|
|
|
@ -100,126 +100,52 @@ impl ViewProfileState {
|
|||
.collect()
|
||||
}
|
||||
|
||||
pub(crate) fn buttons(&self, dark: bool) -> Vec<Button> {
|
||||
pub(crate) fn buttons(&self) -> Vec<Button> {
|
||||
let mut btns = vec![];
|
||||
|
||||
if self.is_self && self.drafts {
|
||||
btns.push(
|
||||
Button::secondary("View Profile")
|
||||
.href(&self.unwrap_profile().view_path())
|
||||
.dark(dark),
|
||||
);
|
||||
btns.push(
|
||||
Button::secondary("Edit Profile")
|
||||
.href("/profiles/current")
|
||||
.dark(dark),
|
||||
);
|
||||
btns.push(
|
||||
Button::secondary("Switch Profile")
|
||||
.href("/profiles/change")
|
||||
.dark(dark),
|
||||
);
|
||||
btns.push(Button::secondary("View Profile").href(&self.unwrap_profile().view_path()));
|
||||
btns.push(Button::secondary("Edit Profile").href("/profiles/current"));
|
||||
btns.push(Button::secondary("Switch Profile").href("/profiles/change"));
|
||||
} else if self.is_self {
|
||||
btns.push(
|
||||
Button::secondary("View Drafts")
|
||||
.href("/profiles/drafts")
|
||||
.dark(dark),
|
||||
);
|
||||
btns.push(
|
||||
Button::secondary("Edit Profile")
|
||||
.href("/profiles/current")
|
||||
.dark(dark),
|
||||
);
|
||||
btns.push(
|
||||
Button::secondary("Switch Profile")
|
||||
.href("/profiles/change")
|
||||
.dark(dark),
|
||||
);
|
||||
btns.push(Button::secondary("View Drafts").href("/profiles/drafts"));
|
||||
btns.push(Button::secondary("Edit Profile").href("/profiles/current"));
|
||||
btns.push(Button::secondary("Switch Profile").href("/profiles/change"));
|
||||
} else if self.is_follow_requested {
|
||||
btns.push(
|
||||
Button::secondary("Remove Request")
|
||||
.form(&self.unwrap_profile().unfollow_path())
|
||||
.dark(dark),
|
||||
);
|
||||
btns.push(
|
||||
Button::secondary("Block")
|
||||
.form(&self.unwrap_profile().block_path())
|
||||
.dark(dark),
|
||||
);
|
||||
btns.push(
|
||||
Button::secondary("Report")
|
||||
.href(&self.unwrap_profile().report_path())
|
||||
.dark(dark),
|
||||
Button::secondary("Remove Request").form(&self.unwrap_profile().unfollow_path()),
|
||||
);
|
||||
btns.push(Button::secondary("Block").form(&self.unwrap_profile().block_path()));
|
||||
btns.push(Button::secondary("Report").href(&self.unwrap_profile().report_path()));
|
||||
} else if self.is_followed {
|
||||
btns.push(
|
||||
Button::secondary("Unfollow")
|
||||
.form(&self.unwrap_profile().unfollow_path())
|
||||
.dark(dark),
|
||||
);
|
||||
btns.push(
|
||||
Button::secondary("Block")
|
||||
.form(&self.unwrap_profile().block_path())
|
||||
.dark(dark),
|
||||
);
|
||||
btns.push(
|
||||
Button::secondary("Report")
|
||||
.href(&self.unwrap_profile().report_path())
|
||||
.dark(dark),
|
||||
);
|
||||
btns.push(Button::secondary("Unfollow").form(&self.unwrap_profile().unfollow_path()));
|
||||
btns.push(Button::secondary("Block").form(&self.unwrap_profile().block_path()));
|
||||
btns.push(Button::secondary("Report").href(&self.unwrap_profile().report_path()));
|
||||
} else if self.is_blocked {
|
||||
btns.push(
|
||||
Button::secondary("Unblock")
|
||||
.form(&self.unwrap_profile().unblock_path())
|
||||
.dark(dark),
|
||||
);
|
||||
btns.push(
|
||||
Button::secondary("Report")
|
||||
.href(&self.unwrap_profile().report_path())
|
||||
.dark(dark),
|
||||
);
|
||||
btns.push(Button::secondary("Unblock").form(&self.unwrap_profile().unblock_path()));
|
||||
btns.push(Button::secondary("Report").href(&self.unwrap_profile().report_path()));
|
||||
} else if self.viewer_exists {
|
||||
btns.push(
|
||||
Button::secondary("Follow")
|
||||
.form(&self.unwrap_profile().follow_path())
|
||||
.dark(dark),
|
||||
);
|
||||
btns.push(
|
||||
Button::secondary("Block")
|
||||
.form(&self.unwrap_profile().block_path())
|
||||
.dark(dark),
|
||||
);
|
||||
btns.push(
|
||||
Button::secondary("Report")
|
||||
.href(&self.unwrap_profile().report_path())
|
||||
.dark(dark),
|
||||
);
|
||||
btns.push(Button::secondary("Follow").form(&self.unwrap_profile().follow_path()));
|
||||
btns.push(Button::secondary("Block").form(&self.unwrap_profile().block_path()));
|
||||
btns.push(Button::secondary("Report").href(&self.unwrap_profile().report_path()));
|
||||
}
|
||||
|
||||
return btns;
|
||||
}
|
||||
|
||||
pub(crate) fn nav(&self, dark: bool) -> Vec<Button> {
|
||||
pub(crate) fn nav(&self) -> Vec<Button> {
|
||||
let mut nav = vec![];
|
||||
|
||||
if let Some(prev) = self.previous_id {
|
||||
nav.push(
|
||||
Button::secondary("Previous")
|
||||
.href(&format!("{}?min={}", self.path, prev))
|
||||
.dark(dark),
|
||||
);
|
||||
nav.push(Button::secondary("Previous").href(&format!("{}?min={}", self.path, prev)));
|
||||
}
|
||||
|
||||
if let Some(next) = self.next_id {
|
||||
nav.push(
|
||||
Button::secondary("Next")
|
||||
.href(&format!("{}?max={}", self.path, next))
|
||||
.dark(dark),
|
||||
);
|
||||
nav.push(Button::secondary("Next").href(&format!("{}?max={}", self.path, next)));
|
||||
}
|
||||
|
||||
if self.reset {
|
||||
nav.push(Button::secondary("Reset").href(&self.path).dark(dark));
|
||||
nav.push(Button::secondary("Reset").href(&self.path));
|
||||
}
|
||||
|
||||
nav
|
||||
|
|
|
@ -343,11 +343,18 @@ impl SubmissionState {
|
|||
format!("/submissions/{}/delete", self.submission.id())
|
||||
}
|
||||
|
||||
pub(crate) fn files<'a>(&'a self) -> impl Iterator<Item = &'a File> {
|
||||
pub(crate) fn images<'a>(&'a self) -> impl Iterator<Item = (Uuid, FullImage)> + 'a {
|
||||
self.submission
|
||||
.files()
|
||||
.iter()
|
||||
.filter_map(move |file_id| self.files.get(file_id))
|
||||
.filter_map(|file| Some((file.id(), file.pictrs_key()?)))
|
||||
.enumerate()
|
||||
.map(move |(index, (id, key))| {
|
||||
let title = format!("{} file {}", self.submission.title_text(), index + 1);
|
||||
|
||||
(id, FullImage::new(key, &title))
|
||||
})
|
||||
}
|
||||
|
||||
fn title(self, text: &str) -> Self {
|
||||
|
@ -619,7 +626,6 @@ fn submission_nav(
|
|||
next_submission: Option<Uuid>,
|
||||
previous_submission: Option<Uuid>,
|
||||
files: &HashMap<Uuid, File>,
|
||||
nav_state: &NavState,
|
||||
) -> (Vec<Button>, Uuid) {
|
||||
let file_count = submission.files().len();
|
||||
let file_num: usize = if let Some(page) = page {
|
||||
|
@ -633,30 +639,14 @@ fn submission_nav(
|
|||
|
||||
let mut nav = vec![];
|
||||
if let Some(prev) = previous_submission {
|
||||
nav.push(
|
||||
Button::secondary("Previous")
|
||||
.href(&format!("/submissions/{}", prev))
|
||||
.dark(nav_state.dark()),
|
||||
);
|
||||
nav.push(Button::secondary("Previous").href(&format!("/submissions/{}", prev)));
|
||||
}
|
||||
if let Some(key) = current_file.and_then(|file| file.pictrs_key()) {
|
||||
nav.push(
|
||||
Button::secondary("Download")
|
||||
.href(&largest_image(key, ImageType::Png))
|
||||
.dark(nav_state.dark()),
|
||||
);
|
||||
nav.push(Button::secondary("Download").href(&largest_image(key, ImageType::Png)));
|
||||
}
|
||||
nav.push(
|
||||
Button::primary_outline("Report")
|
||||
.href(&submission.report_path())
|
||||
.dark(nav_state.dark()),
|
||||
);
|
||||
nav.push(Button::primary_outline("Report").href(&submission.report_path()));
|
||||
if let Some(next) = next_submission {
|
||||
nav.push(
|
||||
Button::secondary("Next")
|
||||
.href(&format!("/submissions/{}", next))
|
||||
.dark(nav_state.dark()),
|
||||
);
|
||||
nav.push(Button::secondary("Next").href(&format!("/submissions/{}", next)));
|
||||
}
|
||||
|
||||
(nav, current_file_id)
|
||||
|
@ -742,7 +732,6 @@ async fn submission_page(
|
|||
next_submission,
|
||||
previous_submission,
|
||||
&cache.files,
|
||||
&nav_state,
|
||||
);
|
||||
|
||||
let (comments, cache) =
|
||||
|
@ -873,7 +862,6 @@ async fn create_comment(
|
|||
next_submission,
|
||||
previous_submission,
|
||||
&cache.files,
|
||||
&nav_state,
|
||||
);
|
||||
|
||||
let (comments, cache) =
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
}
|
||||
<div class="button-section report-actions">
|
||||
@:button_group(&[
|
||||
Button::secondary("View").href(&reports_view.view_path(report)).dark(nav_state.dark()),
|
||||
Button::secondary("View").href(&reports_view.view_path(report)),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
@ -108,9 +108,9 @@
|
|||
@:server_box(s.server, {})
|
||||
<div class="button-section">
|
||||
@:button_group(&[
|
||||
s.accept(nav_state.dark()),
|
||||
s.reject(nav_state.dark()),
|
||||
s.block(nav_state.dark()),
|
||||
s.accept(),
|
||||
s.reject(),
|
||||
s.block(),
|
||||
])
|
||||
</div>
|
||||
})
|
||||
|
@ -123,8 +123,8 @@
|
|||
@:server_box(s.server, {})
|
||||
<div class="button-section">
|
||||
@:button_group(&[
|
||||
s.cancel(nav_state.dark()),
|
||||
s.block(nav_state.dark()),
|
||||
s.cancel(),
|
||||
s.block(),
|
||||
])
|
||||
</div>
|
||||
})
|
||||
|
@ -137,8 +137,8 @@
|
|||
@:server_box(s.server, {})
|
||||
<div class="button-section">
|
||||
@:button_group(&[
|
||||
s.defederate(nav_state.dark()),
|
||||
s.block(nav_state.dark()),
|
||||
s.defederate(),
|
||||
s.block(),
|
||||
])
|
||||
</div>
|
||||
})
|
||||
|
@ -151,7 +151,7 @@
|
|||
@:server_box(s.server, {})
|
||||
<div class="button-section">
|
||||
@:button_group(&[
|
||||
s.unblock(nav_state.dark()),
|
||||
s.unblock(),
|
||||
])
|
||||
</div>
|
||||
})
|
||||
|
@ -164,8 +164,8 @@
|
|||
@:server_box(s.server, {})
|
||||
<div class="button-section">
|
||||
@:button_group(&[
|
||||
s.federate(nav_state.dark()),
|
||||
s.block(nav_state.dark()),
|
||||
s.federate(),
|
||||
s.block(),
|
||||
])
|
||||
</div>
|
||||
})
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
})
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::primary("Update").dark(nav_state.dark()),
|
||||
Button::secondary("Back to Submission").href(&view.submission_path()).dark(nav_state.dark()),
|
||||
Button::primary("Update"),
|
||||
Button::secondary("Back to Submission").href(&view.submission_path()),
|
||||
])
|
||||
})
|
||||
</form>
|
||||
|
|
|
@ -41,15 +41,15 @@
|
|||
@:text_input(&view.input)
|
||||
<div class="button-section">
|
||||
@:button_group(&[
|
||||
Button::primary("Reply").dark(nav_state.dark()),
|
||||
Button::secondary("Back to Submission").href(&view.submission_path()).dark(nav_state.dark()),
|
||||
Button::primary_outline("Report").href(&crate::comments::report_path(comment)).dark(nav_state.dark()),
|
||||
Button::primary("Reply"),
|
||||
Button::secondary("Back to Submission").href(&view.submission_path()),
|
||||
Button::primary_outline("Report").href(&crate::comments::report_path(comment)),
|
||||
])
|
||||
</div>
|
||||
</form>
|
||||
} else {
|
||||
@:button_group(&[
|
||||
Button::secondary("Back to Submission").href(&view.submission_path()).dark(nav_state.dark()),
|
||||
Button::secondary("Back to Submission").href(&view.submission_path()),
|
||||
])
|
||||
}
|
||||
})
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
@:text_input(&view.input)
|
||||
<div class="button-section">
|
||||
@:button_group(&[
|
||||
Button::primary("Report").dark(nav_state.dark()),
|
||||
Button::secondary("Back to Comment").href(&view.comment_path()).dark(nav_state.dark()),
|
||||
Button::primary("Report"),
|
||||
Button::secondary("Back to Comment").href(&view.comment_path()),
|
||||
])
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
@:card_title({ Comment Reported })
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::secondary("Back to Comment").href(&view.comment_path()).dark(nav_state.dark()),
|
||||
Button::secondary("Back to Comment").href(&view.comment_path()),
|
||||
])
|
||||
})
|
||||
})
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
})
|
||||
@if state.has_nav() {
|
||||
@:card_body({
|
||||
@:button_group(&state.nav(nav_state.dark()))
|
||||
@:button_group(&state.nav())
|
||||
})
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
}
|
||||
})
|
||||
})
|
||||
@if home_view.nav(nav_state.dark()).len() > 0 {
|
||||
@if home_view.nav().len() > 0 {
|
||||
@:card_body({
|
||||
@:button_group(&home_view.nav(nav_state.dark()))
|
||||
@:button_group(&home_view.nav())
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
@:card_body({
|
||||
<div class="nav-link">
|
||||
@:button_group(&[
|
||||
Button::primary_outline("Close").href(nav_state.href()).dark(nav_state.dark()),
|
||||
Button::primary_outline("Close").href(nav_state.href()),
|
||||
])
|
||||
</div>
|
||||
})
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
})
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
view.clear_button(nav_state.dark()),
|
||||
view.clear_button(),
|
||||
])
|
||||
})
|
||||
})
|
||||
|
@ -31,16 +31,16 @@
|
|||
@:profile_box(&fr.view(), None, nav_state.dark(), {})
|
||||
<div class="button-section">
|
||||
@:button_group(&[
|
||||
fr.accept_button(nav_state.dark()),
|
||||
fr.reject_button(nav_state.dark()),
|
||||
fr.accept_button(),
|
||||
fr.reject_button(),
|
||||
])
|
||||
</div>
|
||||
})
|
||||
}
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
view.accept_all_button(nav_state.dark()),
|
||||
view.reject_all_button(nav_state.dark()),
|
||||
view.accept_all_button(),
|
||||
view.reject_all_button(),
|
||||
])
|
||||
})
|
||||
})
|
||||
|
@ -63,15 +63,15 @@
|
|||
}
|
||||
<div class="button-section">
|
||||
@:button_group(&[
|
||||
c.view_button(nav_state.dark()),
|
||||
c.remove_button(nav_state.dark()),
|
||||
c.view_button(),
|
||||
c.remove_button(),
|
||||
])
|
||||
</div>
|
||||
})
|
||||
}
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
view.clear_comments_button(nav_state.dark()),
|
||||
view.clear_comments_button(),
|
||||
])
|
||||
})
|
||||
})
|
||||
|
|
|
@ -31,10 +31,10 @@
|
|||
})
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::primary("Next").dark(nav_state.dark()),
|
||||
Button::outline("Back").href("/profiles/create/icon").dark(nav_state.dark()),
|
||||
Button::primary_outline("Skip").href("/profiles/create/require-login").dark(nav_state.dark()),
|
||||
Button::primary_outline("Skip All").href("/profiles/create/done").dark(nav_state.dark()),
|
||||
Button::primary("Next"),
|
||||
Button::outline("Back").href("/profiles/create/icon"),
|
||||
Button::primary_outline("Skip").href("/profiles/create/require-login"),
|
||||
Button::primary_outline("Skip All").href("/profiles/create/done"),
|
||||
])
|
||||
})
|
||||
</form>
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
})
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::primary("Next").dark(nav_state.dark()),
|
||||
Button::primary_outline("Skip").href("/profiles/create/icon").dark(nav_state.dark()),
|
||||
Button::primary_outline("Skip All").href("/profiles/create/done").dark(nav_state.dark()),
|
||||
Button::primary("Next"),
|
||||
Button::primary_outline("Skip").href("/profiles/create/icon"),
|
||||
Button::primary_outline("Skip All").href("/profiles/create/done"),
|
||||
])
|
||||
})
|
||||
</form>
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
})
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::primary("Return Home").href("/").dark(nav_state.dark()),
|
||||
Button::outline("Back").href("/profiles/create/require-login").dark(nav_state.dark()),
|
||||
Button::primary("Return Home").href("/"),
|
||||
Button::outline("Back").href("/profiles/create/require-login"),
|
||||
])
|
||||
})
|
||||
})
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
})
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::primary("Next").dark(nav_state.dark()),
|
||||
Button::primary("Next"),
|
||||
])
|
||||
})
|
||||
</form>
|
||||
|
|
|
@ -32,10 +32,10 @@
|
|||
})
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::primary("Next").dark(nav_state.dark()),
|
||||
Button::outline("Back").href("/profiles/create/bio").dark(nav_state.dark()),
|
||||
Button::primary_outline("Skip").href("/profiles/create/banner").dark(nav_state.dark()),
|
||||
Button::primary_outline("Skip All").href("/profiles/create/done").dark(nav_state.dark()),
|
||||
Button::primary("Next"),
|
||||
Button::outline("Back").href("/profiles/create/bio"),
|
||||
Button::primary_outline("Skip").href("/profiles/create/banner"),
|
||||
Button::primary_outline("Skip All").href("/profiles/create/done"),
|
||||
])
|
||||
})
|
||||
</form>
|
||||
|
|
|
@ -44,9 +44,9 @@
|
|||
})
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::primary("Next").dark(nav_state.dark()),
|
||||
Button::outline("Back").href("/profiles/create/banner").dark(nav_state.dark()),
|
||||
Button::primary_outline("Skip").href("/profiles/create/done").dark(nav_state.dark()),
|
||||
Button::primary("Next"),
|
||||
Button::outline("Back").href("/profiles/create/banner"),
|
||||
Button::primary_outline("Skip").href("/profiles/create/done"),
|
||||
])
|
||||
})
|
||||
</form>
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
@:card_title({ Profile Actions })
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::secondary("View Profile").href(&state.profile.view_path()).dark(nav_state.dark()),
|
||||
Button::secondary("Switch Profile").href("/profiles/change").dark(nav_state.dark()),
|
||||
Button::secondary("View Profile").href(&state.profile.view_path()),
|
||||
Button::secondary("Switch Profile").href("/profiles/change"),
|
||||
])
|
||||
})
|
||||
})
|
||||
|
@ -44,7 +44,7 @@
|
|||
@:text_input(&state.description(nav_state.dark()))
|
||||
<div class="button-section">
|
||||
@:button_group(&[
|
||||
Button::primary("Save").dark(nav_state.dark()),
|
||||
Button::primary("Save"),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
@ -77,7 +77,7 @@
|
|||
<div class="button-section">
|
||||
<div class="toolkit-button-group">
|
||||
@:file_input(&state.icon(nav_state.dark()))
|
||||
@:button(&Button::primary("Save").dark(nav_state.dark()))
|
||||
@:button(&Button::primary("Save"))
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -109,7 +109,7 @@
|
|||
<div class="button-section">
|
||||
<div class="toolkit-button-group">
|
||||
@:file_input(&state.banner(nav_state.dark()))
|
||||
@:button(&Button::primary("Save").dark(nav_state.dark()))
|
||||
@:button(&Button::primary("Save"))
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -147,7 +147,7 @@
|
|||
</div>
|
||||
<div class="button-section">
|
||||
@:button_group(&[
|
||||
Button::primary("Save").dark(nav_state.dark()),
|
||||
Button::primary("Save"),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
@ -159,7 +159,7 @@
|
|||
@:card_title({ Danger })
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::primary_outline("Delete Profile").href("/profiles/delete").dark(nav_state.dark()),
|
||||
Button::primary_outline("Delete Profile").href("/profiles/delete"),
|
||||
])
|
||||
})
|
||||
})
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
})
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::primary("Delete Profile").dark(nav_state.dark()),
|
||||
Button::primary("Delete Profile"),
|
||||
])
|
||||
})
|
||||
</form>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
@:card(&Card::full_width().dark(nav_state.dark()), {
|
||||
@:card_title({ Profile Actions })
|
||||
@:card_body({
|
||||
@:button_group(&pview.buttons(nav_state.dark()))
|
||||
@:button_group(&pview.buttons())
|
||||
})
|
||||
})
|
||||
@:card(&Card::full_width().dark(nav_state.dark()), {
|
||||
|
@ -28,9 +28,9 @@
|
|||
}
|
||||
})
|
||||
})
|
||||
@if pview.nav(nav_state.dark()).len() > 0 {
|
||||
@if pview.nav().len() > 0 {
|
||||
@:card_body({
|
||||
@:button_group(&pview.nav(nav_state.dark()))
|
||||
@:button_group(&pview.nav())
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<form method="POST" action="/profiles/change">
|
||||
<input type="hidden" name="profile_id" value="@pview.profile.id()" />
|
||||
@:button_group(&[
|
||||
Button::primary(&format!("Select {}", pview.profile.name())).dark(nav_state.dark()),
|
||||
Button::primary(&format!("Select {}", pview.profile.name())),
|
||||
])
|
||||
</form>
|
||||
})
|
||||
|
@ -26,7 +26,7 @@
|
|||
@:card_title({ Create a New Profile })
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::primary_outline("Create").href("/profiles/create/handle").dark(nav_state.dark()),
|
||||
Button::primary_outline("Create").href("/profiles/create/handle"),
|
||||
])
|
||||
})
|
||||
})
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
@:card(&Card::full_width().dark(nav_state.dark()), {
|
||||
@:profile(&pview.profile().heading().dark(nav_state.dark()))
|
||||
})
|
||||
@if !pview.buttons(nav_state.dark()).is_empty() {
|
||||
@if !pview.buttons().is_empty() {
|
||||
@:card(&Card::full_width().dark(nav_state.dark()), {
|
||||
@:card_title({ Profile Actions })
|
||||
@:card_body({
|
||||
@:button_group(&pview.buttons(nav_state.dark()))
|
||||
@:button_group(&pview.buttons())
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -31,9 +31,9 @@
|
|||
}
|
||||
})
|
||||
})
|
||||
@if pview.nav(nav_state.dark()).len() > 0 {
|
||||
@if pview.nav().len() > 0 {
|
||||
@:card_body({
|
||||
@:button_group(&pview.nav(nav_state.dark()))
|
||||
@:button_group(&pview.nav())
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
})
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::primary("Report").dark(nav_state.dark()),
|
||||
Button::secondary("Back to Profile").href(&rview.profile.view_path()).dark(nav_state.dark()),
|
||||
Button::primary("Report"),
|
||||
Button::secondary("Back to Profile").href(&rview.profile.view_path()),
|
||||
])
|
||||
})
|
||||
</form>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
@:card_title({ Profile Reported })
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::secondary("Back to Profile").href(&view.profile.view_path()).dark(nav_state.dark()),
|
||||
Button::secondary("Back to Profile").href(&view.profile.view_path()),
|
||||
])
|
||||
})
|
||||
})
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
@:card(&Card::full_width().dark(nav_state.dark()), {
|
||||
@:card_title({ Danger })
|
||||
@:card_body({
|
||||
@:button(&Button::primary("Delete Account").href("/session/account/delete").dark(nav_state.dark()))
|
||||
@:button(&Button::primary("Delete Account").href("/session/account/delete"))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
})
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::primary("Next").dark(nav_state.dark()),
|
||||
Button::primary("Next"),
|
||||
])
|
||||
})
|
||||
</form>
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
@use crate::images::{image_srcset, largest_image, ImageType};
|
||||
|
||||
@(key: &str, title: &str, num: usize)
|
||||
|
||||
<picture>
|
||||
<source
|
||||
type="image/webp"
|
||||
srcset="@image_srcset(key, ImageType::Webp)"
|
||||
/>
|
||||
<source
|
||||
type="image/png"
|
||||
srcset="@image_srcset(key, ImageType::Png)"
|
||||
/>
|
||||
<img
|
||||
href="@largest_image(key, ImageType::Png)"
|
||||
title="@title file @num"
|
||||
alt="@title file @num"
|
||||
/>
|
||||
</picture>
|
|
@ -30,8 +30,8 @@
|
|||
})
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::primary("Report").dark(nav_state.dark()),
|
||||
Button::secondary("Back to Submission").href(&view.submission.view_path()).dark(nav_state.dark()),
|
||||
Button::primary("Report"),
|
||||
Button::secondary("Back to Submission").href(&view.submission.view_path()),
|
||||
])
|
||||
})
|
||||
})
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
@:card_title({ Submission Reported })
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::secondary("Back to Submission").href(&view.submission.view_path()).dark(nav_state.dark()),
|
||||
Button::secondary("Back to Submission").href(&view.submission.view_path()),
|
||||
])
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
@use crate::templates::{button_js, file_js};
|
||||
@use crate::{templates::{layouts::home, submissions::image}, nav::NavState, submissions::SubmissionState};
|
||||
@use crate::{templates::layouts::home, nav::NavState, submissions::SubmissionState};
|
||||
@use hyaenidae_toolkit::{templates::{button_group, card, card_body, card_title, file_input, text_input}, Button, Card};
|
||||
@use hyaenidae_toolkit::templates::image;
|
||||
|
||||
@(state: &SubmissionState, nav_state: &NavState)
|
||||
|
||||
|
@ -20,7 +21,7 @@
|
|||
}
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::primary("Publish").dark(nav_state.dark()),
|
||||
Button::primary("Publish"),
|
||||
])
|
||||
})
|
||||
</form>
|
||||
|
@ -35,37 +36,35 @@
|
|||
})
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::primary("Save").dark(nav_state.dark()),
|
||||
Button::primary("Save"),
|
||||
])
|
||||
})
|
||||
</form>
|
||||
})
|
||||
@:card(&Card::full_width().dark(nav_state.dark()), {
|
||||
@:card_title({ Remove Files })
|
||||
@for tup in state.files().enumerate() {
|
||||
@if let Some(file) = tup.1.pictrs() {
|
||||
<form method="POST" action="@state.remove_file_path()">
|
||||
@:card_body({
|
||||
<div class="columns">
|
||||
<div class="columns--column">
|
||||
@:image(file.key(), &state.submission.title(), tup.0)
|
||||
</div>
|
||||
<div class="columns--column">
|
||||
<h3>Remove Image From Submission</h3>
|
||||
@if let Some(error) = state.remove_file_error.get(&tup.1.id()) {
|
||||
<p class="error">@error</p>
|
||||
}
|
||||
<input type="hidden" name="file_id" value="@tup.1.id()" />
|
||||
<div class="button-section">
|
||||
@:button_group(&[
|
||||
Button::primary("Remove").dark(nav_state.dark()),
|
||||
])
|
||||
</div>
|
||||
@for (id, img) in state.images() {
|
||||
<form method="POST" action="@state.remove_file_path()">
|
||||
@:card_body({
|
||||
<div class="columns">
|
||||
<div class="columns--column">
|
||||
@:image(&img)
|
||||
</div>
|
||||
<div class="columns--column">
|
||||
<h3>Remove Image From Submission</h3>
|
||||
@if let Some(error) = state.remove_file_error.get(&id) {
|
||||
<p class="error">@error</p>
|
||||
}
|
||||
<input type="hidden" name="file_id" value="@id" />
|
||||
<div class="button-section">
|
||||
@:button_group(&[
|
||||
Button::primary("Remove"),
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
})
|
||||
</form>
|
||||
}
|
||||
</div>
|
||||
})
|
||||
</form>
|
||||
}
|
||||
})
|
||||
@:card(&Card::full_width().dark(nav_state.dark()), {
|
||||
|
@ -76,7 +75,7 @@
|
|||
})
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::primary("Submit").dark(nav_state.dark()),
|
||||
Button::primary("Submit"),
|
||||
])
|
||||
})
|
||||
</form>
|
||||
|
@ -85,7 +84,7 @@
|
|||
@:card_title({ View Submission })
|
||||
@:card_body({
|
||||
@:button_group(&[
|
||||
Button::primary("View").href(&state.view_path()).dark(nav_state.dark()),
|
||||
Button::primary("View").href(&state.view_path()),
|
||||
])
|
||||
})
|
||||
})
|
||||
|
@ -97,7 +96,7 @@
|
|||
@:card_body({
|
||||
<form method="POST" action="@state.delete_path()">
|
||||
@:button_group(&[
|
||||
Button::primary_outline("Delete Submission").dark(nav_state.dark()),
|
||||
Button::primary_outline("Delete Submission"),
|
||||
])
|
||||
</form>
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue