forge
Explore
Log in

Don't you dare go Hollow

forge

Clone
★ 0

0 watching0 forksRustAGPL-3.010.5 MiB7aca449Tahinli1 hour ago336 commits

mod.rs62 lines, 1.4 KiBHistoryRawDownload
1use crate::views::query_value;
2use forge_web_base::i18n::Lang;
3use topcoat::context::Cx;
4use topcoat::router::error::{SeeOther, see_other};
5
6pub mod admin_runners;
7pub mod admin_users;
8pub mod ci_estimate;
9pub mod ci_fail;
10pub mod ci_job;
11pub mod ci_runs;
12pub mod code_live;
13pub mod discussion_settings;
14pub mod edit_history;
15pub mod finder;
16pub mod issue_meta;
17pub mod issue_parts;
18pub mod issues_list;
19pub mod issues_live;
20pub mod notifications;
21pub mod packages;
22pub mod packages_oci;
23pub mod pull_live;
24pub mod pull_reviews;
25pub mod ref_live;
26pub mod refs;
27pub mod releases;
28pub mod releases_live;
29pub mod repo;
30pub mod repo_ctx;
31pub mod repo_mirrors;
32pub mod repo_rename;
33pub mod repo_security;
34pub mod repo_settings;
35pub mod repo_settings_live;
36pub mod repo_side;
37pub mod repo_transfer;
38pub mod star;
39pub mod tree;
40pub mod wiki;
41pub mod wiki_live;
42
43pub fn notice_redirect(href: &str, word: &str) -> SeeOther {
44 see_other(format!("{href}?notice={word}"))
45}
46
47pub fn notice_from_query<K: Copy>(cx: &Cx, table: &[(&str, K, bool)]) -> Option<(K, bool)> {
48 let word = query_value(cx, "notice")?;
49 table
50 .iter()
51 .find(|(name, _, _)| *name == word)
52 .map(|(_, key, is_error)| (*key, *is_error))
53}
54
55pub fn notice_text<K: Copy>(
56 cx: &Cx,
57 lang: Lang,
58 table: &[(&str, K, bool)],
59 text: fn(Lang, K) -> &'static str,
60) -> Option<(&'static str, bool)> {
61 notice_from_query(cx, table).map(|(key, is_error)| (text(lang, key), is_error))
62}