Compare commits

..

No commits in common. "28fd7b468dd1a8a85fec85e3de66606a6049a2c0" and "5269dd7789d8918910c54d8e5f25a430232b0491" have entirely different histories.

2 changed files with 1 additions and 27 deletions

View File

@ -1,34 +1,9 @@
use askama_axum::Template; use askama_axum::Template;
use axum::{
async_trait,
extract::FromRequestParts,
http::{request::Parts, HeaderMap, StatusCode},
};
#[derive(Template)] #[derive(Template)]
#[template(path = "pages/cps.html")] #[template(path = "pages/cps.html")]
pub struct CpsTemplate; pub struct CpsTemplate;
pub struct ExtractHxRequest(bool); pub async fn cps() -> CpsTemplate {
#[async_trait]
impl<S> FromRequestParts<S> for ExtractHxRequest
where
S: Send + Sync,
{
type Rejection = (StatusCode, &'static str);
async fn from_request_parts(parts: &mut Parts, _state: &S) -> Result<Self, Self::Rejection> {
if parts.headers.get("HX-Request").is_some() {
Ok(ExtractHxRequest(true))
} else {
Ok(ExtractHxRequest(false))
}
}
}
pub async fn cps(headers: HeaderMap, hx_request: ExtractHxRequest) -> CpsTemplate {
println!("{:#?}", headers);
println!("{:#?}", hx_request.0);
CpsTemplate CpsTemplate
} }

View File

@ -5,7 +5,6 @@
hx-trigger="click" hx-trigger="click"
hx-target="#main-container" hx-target="#main-container"
hx-swap="innerHTML" hx-swap="innerHTML"
hx-push-url="true"
class="{{ Self::get_classes(self, item.current) }}" class="{{ Self::get_classes(self, item.current) }}"
aria-current="{% if item.current %}page{% endif %}" aria-current="{% if item.current %}page{% endif %}"
> >