Skip to content

Dan career form #1366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 12 additions & 0 deletions pgml-dashboard/src/api/cms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,17 @@ async fn get_careers(
CAREERS.render(&doc_file_path, &canonical, cluster).await
}

#[get("/careers/apply/<title>", rank = 4)]
pub async fn careers_apply(title: PathBuf, cluster: &Cluster) -> Result<ResponseOk, crate::responses::NotFound> {
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("-", " ");
let page = crate::components::pages::careers::Apply::new().job_title(&job_title);

Ok(ResponseOk(layout.render(page)))
}

#[get("/docs/<path..>", rank = 5)]
async fn get_docs(
path: PathBuf,
Expand Down Expand Up @@ -876,6 +887,7 @@ pub fn routes() -> Vec<Route> {
blog_landing_page,
docs_landing_page,
careers_landing_page,
careers_apply,
get_blog,
get_blog_asset,
get_careers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,17 @@ export default class extends Controller {
} else {
this.bodies[i].style.maxHeight = this.bodies[i].offsetHeight + "px";
}
}
}
}


titleClick(e) {
let target = e.currentTarget.getAttribute("data-value");
e.currentTarget.classList.add("selected");

let body = document.querySelector(`[data-accordian-target="${target}"]`);
body.classList.add("selected");
body.style.maxHeight = this.heights.get(body) + "px";

for (let i = 0; i < this.bodies.length; i++) {
if (body != this.bodies[i]) {
this.bodies[i].classList.remove("selected");
Expand Down
88 changes: 42 additions & 46 deletions pgml-dashboard/src/components/carousel/carousel_controller.js
Original file line number Diff line number Diff line change
@@ -1,91 +1,87 @@
import { Controller } from '@hotwired/stimulus'
import { Controller } from "@hotwired/stimulus";

export default class extends Controller {
static targets = [
"carousel", "carouselTimer", "template"
]
static targets = ["carousel", "carouselTimer", "template"];

initialize() {
this.paused = false
this.runtime = 0
this.paused = false;
this.runtime = 0;
this.times = 1;
}

connect() {
// dont cycle carousel if it only hase one item.
if ( this.templateTargets.length > 1 ) {
this.cycle()
// dont cycle carousel if it only hase one item.
if (this.templateTargets.length > 1) {
this.cycle();
}
}

changeFeatured(next) {
let current = this.carouselTarget.children[0]
let nextItem = next.content.cloneNode(true)

this.carouselTarget.appendChild(nextItem)
let current = this.carouselTarget.children[0];
let nextItem = next.content.cloneNode(true);

if( current ) {
this.carouselTarget.appendChild(nextItem);

if (current) {
current.style.marginLeft = "-100%";
setTimeout( () => {
this.carouselTarget.removeChild(current)
}, 700)
setTimeout(() => {
this.carouselTarget.removeChild(current);
}, 700);
}
}

changeIndicator(current, next) {
let timers = this.carouselTimerTargets;
let currentTimer = timers[current];
let nextTimer = timers[next]
let nextTimer = timers[next];

if ( currentTimer ) {
currentTimer.classList.remove("timer-active")
currentTimer.style.width = "1rem"
if (currentTimer) {
currentTimer.classList.remove("timer-active");
currentTimer.style.width = "1rem";
}
if (nextTimer) {
nextTimer.style.width = "4rem";
nextTimer.classList.add("timer-active");
}
if( nextTimer) {
nextTimer.style.width = "4rem"
nextTimer.classList.add("timer-active")
}
}

Pause() {
this.paused = true
this.paused = true;
}

Resume() {
this.paused = false
this.paused = false;
}

cycle() {
this.interval = setInterval(() => {
// maintain paused state through entire loop
let paused = this.paused
let paused = this.paused;

let activeTimer = document.getElementsByClassName("timer-active")[0]
if( paused ) {
if( activeTimer ) {
activeTimer.classList.add("timer-pause")
let activeTimer = document.getElementsByClassName("timer-active")[0];
if (paused) {
if (activeTimer) {
activeTimer.classList.add("timer-pause");
}
} else {
if( activeTimer && activeTimer.classList.contains("timer-pause")) {
activeTimer.classList.remove("timer-pause")
if (activeTimer && activeTimer.classList.contains("timer-pause")) {
activeTimer.classList.remove("timer-pause");
}
}

if( !paused && this.runtime % 5 == 0 ) {
let currentIndex = this.times % this.templateTargets.length
let nextIndex = (this.times + 1) % this.templateTargets.length

this.changeIndicator(currentIndex, nextIndex)
this.changeFeatured(
this.templateTargets[nextIndex]
)
this.times ++
if (!paused && this.runtime % 5 == 0) {
let currentIndex = this.times % this.templateTargets.length;
let nextIndex = (this.times + 1) % this.templateTargets.length;

this.changeIndicator(currentIndex, nextIndex);
this.changeFeatured(this.templateTargets[nextIndex]);
this.times++;
}

if( !paused ) {
this.runtime++
if (!paused) {
this.runtime++;
}
}, 1000)
}, 1000);
}

disconnect() {
Expand Down
Loading