🌐 AI搜索 & 代理 主页
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove dead code, add turbo-frame for career form fail and success, u…
…se new split page
  • Loading branch information
chillenberger committed Mar 12, 2024
commit 326e6c28a9fde4d9d3856e36007171316b1b6b0d
2 changes: 1 addition & 1 deletion pgml-dashboard/src/api/cms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ async fn get_careers(

#[get("/careers/apply/<title>", rank = 4)]
pub async fn careers_apply(title: PathBuf, cluster: &Cluster) -> Result<ResponseOk, crate::responses::NotFound> {
let mut layout =
let layout =
crate::components::layouts::marketing::Base::new("Apply for a career", Some(&cluster)).no_transparent_nav();

let job_title = title.display().to_string().replace("-", " ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@
doc.title.clone()
};

let career_apply_path = if !document_not_found{
format!("/careers/apply/{}", doc.title.clone())
} else {
String::from("careers")
};

let career_apply_url = if is_career {
let mut path = doc.url.split("/").collect::<Vec<&str>>();
path.insert(path.len()-1, "apply");
Expand Down
7 changes: 7 additions & 0 deletions pgml-dashboard/src/components/pages/careers/apply/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,26 @@ use sailfish::TemplateOnce;
#[template(path = "pages/careers/apply/template.html")]
pub struct Apply {
job_title: String,
success: Option<bool>,
}

impl Apply {
pub fn new() -> Apply {
Apply {
job_title: String::from(""),
success: None,
}
}

pub fn job_title(mut self, job_title: &str) -> Apply {
self.job_title = job_title.to_owned();
self
}

pub fn success(mut self, success: bool) -> Apply {
self.success = Some(success);
self
}
}

component!(Apply);
144 changes: 87 additions & 57 deletions pgml-dashboard/src/components/pages/careers/apply/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,75 +3,105 @@
use pgml_components::Component;
use crate::components::sections::Split;
use crate::components::PostgresLogo;

let back_link = format!("/careers/{}", "job_title");
use crate::utils::config::site_domain;

let eyebrow_formated = r#"<span class="text-white-300">APPLY NOW</span>"#;

let display_area = format!(r#"
<div class="card border-1">
<div class="card-body">
<form action="/careers/apply" method="post">
<div class="d-flex flex-column justify-content-center align-items-center gap-4">
let path = format!("/careers/apply/{}",job_title.replace(" ", "-").to_lowercase());

let form = format!(r#"
<form action="{}" method="post" enctype="multipart/form-data">
<div class="d-flex flex-column justify-content-center align-items-center gap-4">

<div class="d-flex justify-content-center">
{}
</div>

<div class="w-100 d-flex justify-content-start">
<button class="btn btn-tertiary ps-0" onclick="history.back()">
<span class="material-symbols-outlined icon-back-btn" style="font-size: 22px">
arrow_back
</span>
Back
</button>
</div>

<div class="d-flex justify-content-center">
{}
<div class="d-flex flex-column gap-3">
<div class="mb-3">
<label class="form-label">Full Name</label>
<input class="form-control" type="text" name="name" placeholder="Owl Hootington" size="42" required>
</div>

<div class="w-100 d-flex justify-content-start">
<button class="btn btn-tertiary ps-0" onclick="history.back()">
<span class="material-symbols-outlined icon-back-btn" style="font-size: 22px">
arrow_back
</span>
Back
</button>
<div class="mb-3">
<label class="form-label">Email</label>
<input class="form-control" type="email" name="email" placeholder="example@email.com" size="42" required>
</div>

<div class="d-flex flex-column gap-3">
<div class="mb-3">
<label class="form-label">Full Name</label>
<input class="form-control" type="text" name="name" placeholder="Owl Hootington" size="42" required>
</div>

<div class="mb-3">
<label class="form-label">Email</label>
<input class="form-control" type="email" name="email" placeholder="example@email.com" size="42" required>
</div>

<div class="mb-3">
<label class="form-label">Phone Number</label>
<input class="form-control" type="phone" name="phone" placeholder="(415)123-4567" size="42" required>
</div>

<div class="mb-3">
<label class="form-label">LinkedIn URL</label>
<input class="form-control" type="email" name="linkedin" placeholder="PostgresML" size="42" required>
</div>

<div class="mb-3 w-100">
<label class="form-label">Resume</label>
<input class="form-control" type="file" name="resume" placeholder="my_resume" required>
</div>

<div class="mb-3">
<label class="form-label">Github/Portfolio URL</label>
<input class="form-control" type="text" name="portfolio" placeholder="mywebsite.com" size="42">
</div>

<div class="mb-3 w-100">
<label class="form-label">Note</label>
<textarea class="form-control" name="note" maxlength="1000" aria-label="With textarea" placeholder="Tell us about yourself"></textarea>
</div>

<button class="btn btn-primary-web-app">Apply</button>
<div class="mb-3">
<label class="form-label">Phone Number</label>
<input class="form-control" type="phone" name="phone" placeholder="(415)123-4567" size="42">
</div>

<div class="mb-3">
<label class="form-label">LinkedIn URL</label>
<input class="form-control" type="linkedin" name="linkedin" placeholder="PostgresML" size="42">
</div>

<div class="mb-3 w-100">
<label class="form-label">Resume <span class="legal-text text-white-300">(.pdf)</span></label>
<input class="form-control" type="file" name="resume" accept=".pdf" required="true" placeholder=".pdf">
</div>

<div class="mb-3">
<label class="form-label">Github/Portfolio URL</label>
<input class="form-control" type="text" name="portfolio" placeholder="mywebsite.com" size="42">
</div>

<div class="mb-3 w-100">
<label class="form-label">Note</label>
<textarea class="form-control" name="note" maxlength="1000" aria-label="With textarea" placeholder="Tell us about yourself"></textarea>
</div>

<input type="hidden" name="position" value="{}">

<button class="btn btn-primary-web-app" type="submit">Apply</button>
</div>
</form>
</div>
</form>
"#,
path,
PostgresLogo::new("/").bigger().render_once().unwrap(),
job_title
);

let success_message = format!(r#"
<div class="d-flex flex-column gap-2 p-2">
<p class="text-center">You have successfully applied for the <span class="text-capitalize">{}</span> role! We’ll be in contract with you shortly. </p>
<a class="btn btn-primary-web-app mx-auto" href="/careers" data-turbo-frame="_top">Careers</a>
</div>
"#, job_title);

let failure_message = format!(r#"
<div class="d-flex flex-column gap-2 p-2">
<p class="text-center">Something went wrong!</p>
<a class="btn btn-primary-web-app mx-auto" href="/careers" data-turbo-frame="_top">Careers</a>
</div>
"#);

let display_area = format!(r#"
<div class="card border-1">
<div class="card-body">
<turbo-frame id="career-display-area">
{}
</turbo-frame>
</div>
</div>
"#,
PostgresLogo::new("/").bigger().render_once().unwrap()
);
"#,
match success {
Some(true) => &success_message,
Some(false) => &failure_message,
None => &form
});
%>

<%+
Expand Down