From 5a3cbce8117b6f17d17d0d39658dfd87aad76a3a Mon Sep 17 00:00:00 2001 From: Dan <39170265+chillenberger@users.noreply.github.com> Date: Thu, 7 Mar 2024 11:17:59 -0700 Subject: [PATCH 1/4] start --- .../newsletter_subscribe_controller.js | 18 ++++++++++++++++++ .../cards/newsletter_subscribe/template.html | 7 ++++--- .../pages/blog/landing_page/template.html | 5 +++++ 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 pgml-dashboard/src/components/cards/newsletter_subscribe/newsletter_subscribe_controller.js diff --git a/pgml-dashboard/src/components/cards/newsletter_subscribe/newsletter_subscribe_controller.js b/pgml-dashboard/src/components/cards/newsletter_subscribe/newsletter_subscribe_controller.js new file mode 100644 index 000000000..59bf8779d --- /dev/null +++ b/pgml-dashboard/src/components/cards/newsletter_subscribe/newsletter_subscribe_controller.js @@ -0,0 +1,18 @@ +import { Controller } from '@hotwired/stimulus' + +export default class extends Controller { + + static targets = [ + 'form', + ] + + async submitRequest() { + fetch(this.formTarget.action, { + method: "POST", + body: new FormData(this.formTarget), + }) + .then(response => response.json()) + .then(rsp => console.log(rsp.rsp)); + + } +} diff --git a/pgml-dashboard/src/components/cards/newsletter_subscribe/template.html b/pgml-dashboard/src/components/cards/newsletter_subscribe/template.html index 0037a0228..876dfa99d 100644 --- a/pgml-dashboard/src/components/cards/newsletter_subscribe/template.html +++ b/pgml-dashboard/src/components/cards/newsletter_subscribe/template.html @@ -5,12 +5,13 @@
No spam. No sales pitches. Just product updates. Keep up with all our articles and news. Join our newsletter and stay up to date!
- diff --git a/pgml-dashboard/src/components/pages/blog/landing_page/template.html b/pgml-dashboard/src/components/pages/blog/landing_page/template.html index cdabe3541..876b1eaad 100644 --- a/pgml-dashboard/src/components/pages/blog/landing_page/template.html +++ b/pgml-dashboard/src/components/pages/blog/landing_page/template.html @@ -3,6 +3,7 @@ use crate::components::cards::blog::ArticlePreview; use crate::components::sections::common_resources::{Cards, CommonResources}; use crate::components::pages::blog::blog_search::call::Call as BlogSearchCall; + use crate::components::cards::NewsletterSubscribe; @@ -36,6 +37,10 @@With hosted PostgresML, you get: