use crate::views::query_value; use forge_web_base::i18n::Lang; use topcoat::context::Cx; use topcoat::router::error::{SeeOther, see_other}; pub mod admin_runners; pub mod admin_users; pub mod ci_estimate; pub mod ci_fail; pub mod ci_job; pub mod ci_runs; pub mod code_live; pub mod edit_history; pub mod finder; pub mod issue_meta; pub mod issue_parts; pub mod issues_list; pub mod issues_live; pub mod notifications; pub mod pull_live; pub mod pull_reviews; pub mod ref_live; pub mod refs; pub mod releases; pub mod releases_live; pub mod repo; pub mod repo_ctx; pub mod repo_mirrors; pub mod repo_rename; pub mod repo_settings; pub mod repo_settings_live; pub mod repo_side; pub mod repo_transfer; pub mod star; pub mod tree; pub fn notice_redirect(href: &str, word: &str) -> SeeOther { see_other(format!("{href}?notice={word}")) } pub fn notice_from_query(cx: &Cx, table: &[(&str, K, bool)]) -> Option<(K, bool)> { let word = query_value(cx, "notice")?; table .iter() .find(|(name, _, _)| *name == word) .map(|(_, key, is_error)| (*key, *is_error)) } pub fn notice_text( cx: &Cx, lang: Lang, table: &[(&str, K, bool)], text: fn(Lang, K) -> &'static str, ) -> Option<(&'static str, bool)> { notice_from_query(cx, table).map(|(key, is_error)| (text(lang, key), is_error)) }