diff --git a/pgml-dashboard/src/components/cards/newsletter_subscribe/mod.rs b/pgml-dashboard/src/components/cards/newsletter_subscribe/mod.rs
index bb352fae0..e9f29b059 100644
--- a/pgml-dashboard/src/components/cards/newsletter_subscribe/mod.rs
+++ b/pgml-dashboard/src/components/cards/newsletter_subscribe/mod.rs
@@ -3,11 +3,34 @@ use sailfish::TemplateOnce;
#[derive(TemplateOnce, Default)]
#[template(path = "cards/newsletter_subscribe/template.html")]
-pub struct NewsletterSubscribe {}
+pub struct NewsletterSubscribe {
+ success: Option,
+ error_message: Option,
+ email: Option,
+}
impl NewsletterSubscribe {
pub fn new() -> NewsletterSubscribe {
- NewsletterSubscribe {}
+ NewsletterSubscribe {
+ success: None,
+ error_message: None,
+ email: None,
+ }
+ }
+
+ pub fn success(mut self, success: bool) -> Self {
+ self.success = Some(success);
+ self
+ }
+
+ pub fn error_message(mut self, error_message: &str) -> Self {
+ self.error_message = Some(error_message.to_owned());
+ self
+ }
+
+ pub fn email(mut self, email: &str) -> Self {
+ self.email = Some(email.to_owned());
+ self
}
}
diff --git a/pgml-dashboard/src/components/cards/newsletter_subscribe/newsletter_subscribe.scss b/pgml-dashboard/src/components/cards/newsletter_subscribe/newsletter_subscribe.scss
index 5c3e9cfc5..39dc2d597 100644
--- a/pgml-dashboard/src/components/cards/newsletter_subscribe/newsletter_subscribe.scss
+++ b/pgml-dashboard/src/components/cards/newsletter_subscribe/newsletter_subscribe.scss
@@ -9,4 +9,17 @@ div[data-controller="cards-newsletter-subscribe"] {
background-image: url("/dashboard/static/images/newsletter_subscribe_background_mobile.png");
background-color: #{$pink};
}
+
+ .message {
+ display: none;
+
+ &.success, &.error {
+ display: block;
+ }
+
+ bottom: -3rem;
+ @include media-breakpoint-up(xl) {
+ left: 0px;
+ }
+ }
}
diff --git a/pgml-dashboard/src/components/cards/newsletter_subscribe/template.html b/pgml-dashboard/src/components/cards/newsletter_subscribe/template.html
index 0037a0228..5d4e844cd 100644
--- a/pgml-dashboard/src/components/cards/newsletter_subscribe/template.html
+++ b/pgml-dashboard/src/components/cards/newsletter_subscribe/template.html
@@ -1,16 +1,54 @@
-
-
-
-
Subscribe to our newsletter. (It’s better than you think)
-
No spam. No sales pitches. Just product updates. Keep up with all our articles and news. Join our newsletter and stay up to date!
-
+<%
+ use pgml_components::Component;
+
+ let success_class = match success {
+ Some(true) => "success",
+ Some(false) => "error",
+ None => ""
+ };
+
+ let message = match success {
+ Some(true) => "Success".to_string(),
+ Some(false) => error_message.unwrap_or("Something went wrong".to_string()),
+ None => String::new()
+ };
+
+ let error_icon = match success {
+ Some(false) => Component::from(r#"
warning"#),
+ _ => Component::from("")
+ };
-
-
+
<%- content.unwrap_or_else(|| String::new()) %>
diff --git a/pgml-dashboard/src/components/loading/message/mod.rs b/pgml-dashboard/src/components/loading/message/mod.rs
index eabb3ea2a..399b5b877 100644
--- a/pgml-dashboard/src/components/loading/message/mod.rs
+++ b/pgml-dashboard/src/components/loading/message/mod.rs
@@ -1,5 +1,5 @@
-use sailfish::TemplateOnce;
use pgml_components::component;
+use sailfish::TemplateOnce;
#[derive(TemplateOnce, Default)]
#[template(path = "loading/message/template.html")]
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..c52f1c628 100644
--- a/pgml-dashboard/src/components/pages/blog/landing_page/template.html
+++ b/pgml-dashboard/src/components/pages/blog/landing_page/template.html
@@ -3,8 +3,8 @@
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;
+ use crate::utils::config::standalone_dashboard;
let cards = featured_cards.iter().map(|card| {
ArticlePreview::new(card).featured().render_once().unwrap()
@@ -36,6 +36,13 @@
PostgresML Blog
<%+ BlogSearchCall::new() %>
+
+ <% if !standalone_dashboard() { %>
+
+ <%+ NewsletterSubscribe::new() %>
+
+ <% } %>
+
<%+ CommonResources::new().show(Vec::from([Cards::Contribute, Cards::Docs, Cards::Community])) %>
diff --git a/pgml-dashboard/src/components/pages/careers/landing_page/template.html b/pgml-dashboard/src/components/pages/careers/landing_page/template.html
index a9da14d45..d3ccdf150 100644
--- a/pgml-dashboard/src/components/pages/careers/landing_page/template.html
+++ b/pgml-dashboard/src/components/pages/careers/landing_page/template.html
@@ -1,6 +1,8 @@
<%
use crate::components::sections::common_resources::{CommonResources, Cards};
use crate::components::sections::EmploymentBenefits;
+ use crate::components::cards::NewsletterSubscribe;
+ use crate::utils::config::standalone_dashboard;
%>
@@ -84,7 +86,15 @@
Working with us
<%+ EmploymentBenefits::new() %>
- <%+ CommonResources::new().show(Vec::from([Cards::Contribute, Cards::Docs, Cards::Community])) %>
+ <% if !standalone_dashboard() { %>
+
+ <%+ NewsletterSubscribe::new() %>
+
+ <% } %>
+
+
+ <%+ CommonResources::new().show(Vec::from([Cards::Contribute, Cards::Docs, Cards::Community])) %>
+
diff --git a/pgml-dashboard/src/components/pages/docs/landing_page/template.html b/pgml-dashboard/src/components/pages/docs/landing_page/template.html
index 1111b6f92..c2cfc935c 100644
--- a/pgml-dashboard/src/components/pages/docs/landing_page/template.html
+++ b/pgml-dashboard/src/components/pages/docs/landing_page/template.html
@@ -131,7 +131,7 @@ Hosted PostgresML is a fully managed cloud service that provides all the capabilities of open source PostgresML without the need to run your own database infrastructure.
With hosted PostgresML, you get:
@@ -143,7 +143,7 @@
diff --git a/pgml-dashboard/static/css/scss/components/_forms.scss b/pgml-dashboard/static/css/scss/components/_forms.scss
index f0214d77f..d1554cab8 100644
--- a/pgml-dashboard/static/css/scss/components/_forms.scss
+++ b/pgml-dashboard/static/css/scss/components/_forms.scss
@@ -292,3 +292,13 @@
line-height: 24px;
letter-spacing: 0.18px;
}
+
+// fix autofill color for chrome
+input:-webkit-autofill,
+input:-webkit-autofill:hover,
+input:-webkit-autofill:focus,
+input:-webkit-autofill:active{
+ -webkit-background-clip: text;
+ -webkit-text-fill-color: white;
+ transition: background-color 5000s ease-in-out 0s;
+}