Skip to content

Commit 18a2c39

Browse files
Fixed no email in Subscribe input area
1 parent 8ce80b6 commit 18a2c39

File tree

2 files changed

+22
-3
lines changed
  • content/archives/old-tech-blog/entries/gsoc-cc-wordpress-plugin-weekly-report-4
  • themes/vocabulary_theme/templates

2 files changed

+22
-3
lines changed

content/archives/old-tech-blog/entries/gsoc-cc-wordpress-plugin-weekly-report-4/contents.lr

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ author: erlehmann
99
---
1010
body:
1111

12-
As some of you may have noticed, this report about the [Wordpress CC plugin](/archives/old-tech-blog/entries/gsoc-project-introduction-cc-wordpress-plugin/) is several days late. This is because I was unable to produce new substantial features and have hit a roadblock with the one that is most important right now: A filter.
12+
As some of you may have noticed, this report about the [Wordpress CC plugin](/archives/old-tech-blog/entries/gsoc-project-introduction-cc-wordpress-plugin/) is several days late. This is because I was unable to produce new tantial features and have hit a roadblock with the one that is most important right now: A filter.
1313

1414
In its current state, the plugin works fairly straightforward; it generates the markup and inserts it into the post. When planning it, I thought that would suffic — however, Nathan Kinkade advised me that several use cases would break this simple behaviour: If, for example, the chosen license is changed, there is no way to update all posts containing the already generated markup.
1515

themes/vocabulary_theme/templates/layout.html

+21-2
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,28 @@
234234
<div class="subscription">
235235
<h5 class="b-header">Subscribe to our newsletter</h5>
236236
<form class="newsletter">
237-
<input type="text" class="input" placeholder="Your email">
237+
<input type="text" id="emailInput" class="input" placeholder="Your email">
238238
<input type="submit" value="subscribe" class="button small">
239-
</form>
239+
<span id="emailError" style="color: white;"></span>
240+
</form>
241+
<style>
242+
#emailError {
243+
margin-left: 10px;
244+
}
245+
</style>
246+
<script>
247+
document.querySelector('.newsletter').addEventListener('submit', function(event) {
248+
const emailInput = document.getElementById('emailInput');
249+
const emailError = document.getElementById('emailError');
250+
251+
if (emailInput.value.trim() === '') {
252+
event.preventDefault();
253+
emailError.textContent = 'Please enter your email!';
254+
} else {
255+
emailError.textContent = '';
256+
}
257+
});
258+
</script>
240259
</div>
241260
<div class="attribution margin-top-bigger">
242261
<p class="caption">

0 commit comments

Comments
 (0)