Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcf60ae3

Browse files
Subscribe module (#1367)
1 parent189af54 commitcf60ae3

File tree

9 files changed

+123
-22
lines changed

9 files changed

+123
-22
lines changed

‎pgml-dashboard/src/components/cards/newsletter_subscribe/mod.rs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,34 @@ use sailfish::TemplateOnce;
33

44
#[derive(TemplateOnce,Default)]
55
#[template(path ="cards/newsletter_subscribe/template.html")]
6-
pubstructNewsletterSubscribe{}
6+
pubstructNewsletterSubscribe{
7+
success:Option<bool>,
8+
error_message:Option<String>,
9+
email:Option<String>,
10+
}
711

812
implNewsletterSubscribe{
913
pubfnnew() ->NewsletterSubscribe{
10-
NewsletterSubscribe{}
14+
NewsletterSubscribe{
15+
success:None,
16+
error_message:None,
17+
email:None,
18+
}
19+
}
20+
21+
pubfnsuccess(mutself,success:bool) ->Self{
22+
self.success =Some(success);
23+
self
24+
}
25+
26+
pubfnerror_message(mutself,error_message:&str) ->Self{
27+
self.error_message =Some(error_message.to_owned());
28+
self
29+
}
30+
31+
pubfnemail(mutself,email:&str) ->Self{
32+
self.email =Some(email.to_owned());
33+
self
1134
}
1235
}
1336

‎pgml-dashboard/src/components/cards/newsletter_subscribe/newsletter_subscribe.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,17 @@ div[data-controller="cards-newsletter-subscribe"] {
99
background-image:url("/dashboard/static/images/newsletter_subscribe_background_mobile.png");
1010
background-color:#{$pink};
1111
}
12+
13+
.message {
14+
display:none;
15+
16+
&.success,&.error {
17+
display:block;
18+
}
19+
20+
bottom:-3rem;
21+
@includemedia-breakpoint-up(xl) {
22+
left:0px;
23+
}
24+
}
1225
}
Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,54 @@
1-
<divdata-controller="cards-newsletter-subscribe">
2-
<divclass="d-flex flex-column flex-lg-row gap-4 justify-content-center align-items-center newsletter-subscribe-container p-5 rounded-4">
3-
<divclass="d-flex flex-column gap-4 text-center text-md-start"style="flex: 4">
4-
<h3>Subscribe to our newsletter. (It’s better than you think)</h3>
5-
<p>No spam. No sales pitches. Just product updates. Keep up with all our articles and news. Join our newsletter and stay up to date!</p>
6-
</div>
1+
<%
2+
use pgml_components::Component;
3+
4+
let success_class = match success {
5+
Some(true) => "success",
6+
Some(false) => "error",
7+
None => ""
8+
};
9+
10+
let message = match success {
11+
Some(true) => "Success".to_string(),
12+
Some(false) => error_message.unwrap_or("Something went wrong".to_string()),
13+
None => String::new()
14+
};
15+
16+
let error_icon = match success {
17+
Some(false) => Component::from(r#"<spanclass="material-symbols-outlined m-auto pe-2 text-error">warning</span>"#),
18+
_ => Component::from("")
19+
};
720

8-
<formaction="/newsletter_subscribe"class="d-flex flex-column justify-content-center align-items-center gap-3 w-100"style="flex: 3"method="post">
9-
<divclass="input-group p-1 ps-3 subscribe-input">
10-
<inputtype="email"class="form-control border-0"placeholder="hootareyou@email.com"name="email"autocomplete="off">
11-
<buttontype="submit"class="btn btn-primary rounded-2 d-none d-md-block">Subscribe</button>
21+
let email_placeholder = match &email {
22+
Some(email) => email.clone().to_string(),
23+
None => {
24+
let message = match success {
25+
Some(true) => "Add Another Email".to_string(),
26+
_ => "hootareyou@email.com".to_string()
27+
};
28+
message
29+
}
30+
};
31+
%>
32+
33+
<turbo-frameid="newsletter-subscribe-frame">
34+
<divdata-controller="cards-newsletter-subscribe">
35+
<divclass="d-flex flex-column flex-lg-row gap-5 justify-content-between align-items-center newsletter-subscribe-container py-5 ps-xl-5 px-3 rounded-4">
36+
<divclass="d-flex flex-column gap-4 text-center text-md-start w-100">
37+
<h3>Subscribe to our newsletter.<br> (It’s better than you think)</h3>
38+
<p>No spam. No sales pitches. Just product updates. Keep up with all our articles and news. Join our newsletter and stay up to date!</p>
39+
</div>
40+
41+
<divclass="d-flex flex-column justify-content-center align-items-xl-end align-items-center gap-3 w-100 position-relative"style="max-width: 27rem;">
42+
<formaction="/newsletter_subscribe"class="d-flex flex-lg-row flex-column gap-3 w-100"method="post">
43+
<divclass="input-group p-1 ps-3 subscribe-input d-flex flex-row gap-1">
44+
<inputtype="email"class="form-control border-0"placeholder="<%- email_placeholder %>"name="email"autocomplete="off"<% if email.is_some() {%>value="<%- email.unwrap() %><% } %>">
45+
<%+ error_icon %>
46+
<buttontype="submit"class="btn btn-primary rounded-2 d-none d-md-block">Subscribe</button>
47+
</div>
48+
<buttontype="submit"class="btn btn-primary rounded-2 d-md-none mx-auto">Subscribe</button>
49+
</form>
50+
<pclass="message <%- success_class %> position-absolute body-small-text"><%- message %></p>
1251
</div>
13-
<buttontype="submit"class="btn btn-primary rounded-2 d-md-none">Subscribe</button>
14-
</form>
52+
</div>
1553
</div>
16-
</div>
54+
</turbo-frame>

‎pgml-dashboard/src/components/layouts/docs/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<%+ IndexNav::new(&index).for_mobile() %>
2727
</div>
2828

29-
<div>
29+
<divclass="pb-5 mb-5">
3030
<%- content.unwrap_or_else(|| String::new()) %>
3131
</div>
3232
</div>

‎pgml-dashboard/src/components/loading/message/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use sailfish::TemplateOnce;
21
use pgml_components::component;
2+
use sailfish::TemplateOnce;
33

44
#[derive(TemplateOnce,Default)]
55
#[template(path ="loading/message/template.html")]

‎pgml-dashboard/src/components/pages/blog/landing_page/template.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use crate::components::cards::blog::ArticlePreview;
44
use crate::components::sections::common_resources::{Cards, CommonResources};
55
use crate::components::pages::blog::blog_search::call::Call as BlogSearchCall;
6-
7-
6+
use crate::components::cards::NewsletterSubscribe;
7+
use crate::utils::config::standalone_dashboard;
88

99
let cards = featured_cards.iter().map(|card| {
1010
ArticlePreview::new(card).featured().render_once().unwrap()
@@ -36,6 +36,13 @@ <h1>PostgresML <span class="text-gradient-blue">Blog</span></h1>
3636
<%+ BlogSearchCall::new() %>
3737
</div>
3838

39+
40+
<% if !standalone_dashboard() { %>
41+
<divclass="mt-5 container">
42+
<%+ NewsletterSubscribe::new() %>
43+
</div>
44+
<% } %>
45+
3946
<divclass="mt-5">
4047
<%+ CommonResources::new().show(Vec::from([Cards::Contribute, Cards::Docs, Cards::Community])) %>
4148
</div>

‎pgml-dashboard/src/components/pages/careers/landing_page/template.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<%
22
use crate::components::sections::common_resources::{CommonResources, Cards};
33
use crate::components::sections::EmploymentBenefits;
4+
use crate::components::cards::NewsletterSubscribe;
5+
use crate::utils::config::standalone_dashboard;
46
%>
57

68
<divdata-controller="pages-careers-landing-page"class="overflow-hidden tuck-under-navbar">
@@ -84,7 +86,15 @@ <h2>Working with us</h2>
8486
<%+ EmploymentBenefits::new() %>
8587
</div>
8688

87-
<%+ CommonResources::new().show(Vec::from([Cards::Contribute, Cards::Docs, Cards::Community])) %>
89+
<% if !standalone_dashboard() { %>
90+
<divclass="mt-5 container">
91+
<%+ NewsletterSubscribe::new() %>
92+
</div>
93+
<% } %>
94+
95+
<divclass="mt-5">
96+
<%+ CommonResources::new().show(Vec::from([Cards::Contribute, Cards::Docs, Cards::Community])) %>
97+
</div>
8898

8999
</div>
90100
</div>

‎pgml-dashboard/src/components/pages/docs/landing_page/template.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ <h1 class="text-center text-xl-start mb-5 mb-xl-0 mx-auto" style="width: fit-con
131131
&accordian_paragraph("PostgresML installs as extensions in Postgres. It provides SQL API functions for each step of the ML workflow like importing data, transforming features, training models, making predictions, etc. Models are stored back into Postgres tables. This unified approach eliminates complexity."),
132132
&accordian_paragraph("Benefits include faster development cycles, reduced latency, tighter integration between ML and applications, leveraging Postgres' reliability and ACID transactions, and horizontal scaling."),
133133
&accordian_paragraph("PostgresML requires using Postgres as the database. If your data currently resides in a different database, there would be some upfront effort required to migrate the data into Postgres in order to utilize PostgresML's capabilities."),
134-
r##"
134+
&accordian_paragraph(r##"
135135
<p>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.</p>
136136
<p>With hosted PostgresML, you get:</p>
137137
<ul>
@@ -143,7 +143,7 @@ <h1 class="text-center text-xl-start mb-5 mb-xl-0 mx-auto" style="width: fit-con
143143
<li>Monitoring dashboard with metrics and logs</li>
144144
</ul>
145145
<p>In summary, hosted PostgresML removes the operational burden so you can focus on developing machine learning applications, while still getting the benefits of the unified PostgresML architecture.</p>
146-
"##
146+
"##)
147147
])
148148
%>
149149
</div>

‎pgml-dashboard/static/css/scss/components/_forms.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,3 +292,13 @@
292292
line-height:24px;
293293
letter-spacing:0.18px;
294294
}
295+
296+
// fix autofill color for chrome
297+
input:-webkit-autofill,
298+
input:-webkit-autofill:hover,
299+
input:-webkit-autofill:focus,
300+
input:-webkit-autofill:active{
301+
-webkit-background-clip:text;
302+
-webkit-text-fill-color:white;
303+
transition:background-color5000sease-in-out0s;
304+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp