🌐 AI搜索 & 代理 主页
Skip to content

Commit 5a3cbce

Browse files
committed
start
1 parent 0842673 commit 5a3cbce

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Controller } from '@hotwired/stimulus'
2+
3+
export default class extends Controller {
4+
5+
static targets = [
6+
'form',
7+
]
8+
9+
async submitRequest() {
10+
fetch(this.formTarget.action, {
11+
method: "POST",
12+
body: new FormData(this.formTarget),
13+
})
14+
.then(response => response.json())
15+
.then(rsp => console.log(rsp.rsp));
16+
17+
}
18+
}

pgml-dashboard/src/components/cards/newsletter_subscribe/template.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ <h3>Subscribe to our newsletter. (It’s better than you think)</h3>
55
<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>
66
</div>
77

8-
<form action="/newsletter_subscribe" class="d-flex flex-column justify-content-center align-items-center gap-3 w-100" style="flex: 3" method="post">
8+
<form action="/newsletter_subscribe" class="d-flex flex-column justify-content-center align-items-center gap-3 w-100" style="flex: 3" method="post" data-cards-newsletter-subscribe-target="form">
99
<div class="input-group p-1 ps-3 subscribe-input">
1010
<input type="email" class="form-control border-0" placeholder="hootareyou@email.com" name="email" autocomplete="off">
11-
<button type="submit" class="btn btn-primary rounded-2 d-none d-md-block">Subscribe</button>
11+
<!-- <button type="submit" class="btn btn-primary rounded-2 d-none d-md-block">Subscribe</button> -->
12+
<button type="button" class="btn btn-primary rounded-2 d-none d-md-block" data-action="cards-newsletter-subscribe#submitRequest">Subscribe</button>
1213
</div>
13-
<button type="submit" class="btn btn-primary rounded-2 d-md-none">Subscribe</button>
14+
<button type="submit" class="btn btn-primary rounded-2 d-md-none" data-action="cards-newsletter-subscribe#submitRequest">Subscribe</button>
1415
</form>
1516
</div>
1617
</div>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
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+
use crate::components::cards::NewsletterSubscribe;
67

78

89

@@ -36,6 +37,10 @@ <h1>PostgresML <span class="text-gradient-blue">Blog</span></h1>
3637
<%+ BlogSearchCall::new() %>
3738
</div>
3839

40+
<div class="mt-5 container">
41+
<%+ NewsletterSubscribe::new() %>
42+
</div>
43+
3944
<div class="mt-5">
4045
<%+ CommonResources::new().show(Vec::from([Cards::Contribute, Cards::Docs, Cards::Community])) %>
4146
</div>

0 commit comments

Comments
 (0)