Files
Umbra-Bookshelf/theme/page-contact.php
bdm 5b5303186a Establish Umbra-Bookshelf as the successor repository
Continues the Bookshelf history. The three plugins tracked there are
consolidated into umbra-bookshelf/ and this repository becomes the canonical
home for the plugin and the theme.

  bd-bookshelf/  ->  theme/     separate artifact, name unchanged
  (root specs)   ->  umbra-bookshelf/spec/  aligned to Umbra Bookshelf
  old plugin zips -> archive/pre-umbra-releases/

Adds a repository README and drops the Bookshelf closure notice.
2026-10-18 19:56:26 -07:00

103 lines
3.5 KiB
PHP

<?php
// Copyright 2026 Umbra Tools (umbratools.com)
// SPDX-License-Identifier: Apache-2.0
/**
* Template Name: Contact
*
* @package BD_Murphy
*/
get_header();
?>
<div class="contact-container">
<div class="contact-content">
<h1><?php esc_html_e('Contact', 'bd-bookshelf'); ?></h1>
<form id="contact-form" class="contact-form" novalidate>
<?php wp_nonce_field('bdm_contact', 'bdm_contact_nonce'); ?>
<div class="form-field">
<label for="name"><?php esc_html_e('Name', 'bd-bookshelf'); ?> *</label>
<input type="text" id="name" name="name" required>
</div>
<div class="form-field">
<label for="email"><?php esc_html_e('Email', 'bd-bookshelf'); ?> *</label>
<input type="email" id="email" name="email" required>
</div>
<div class="form-field">
<label for="subject"><?php esc_html_e('Subject', 'bd-bookshelf'); ?> *</label>
<input type="text" id="subject" name="subject" required>
</div>
<div class="form-field honeypot" aria-hidden="true">
<label for="website"><?php esc_html_e('Website', 'bd-bookshelf'); ?></label>
<input type="text" id="website" name="website" tabindex="-1" autocomplete="off">
</div>
<div class="form-field">
<label for="message"><?php esc_html_e('Message', 'bd-bookshelf'); ?> *</label>
<textarea id="message" name="message" rows="8" required></textarea>
</div>
<div class="form-submit">
<button type="submit" class="submit-btn"><?php esc_html_e('Send Message', 'bd-bookshelf'); ?></button>
</div>
</form>
<div id="contact-form-response" class="form-response" style="display:none;" role="alert" aria-live="polite"></div>
</div>
</div>
<script>
(function() {
'use strict';
var form = document.getElementById('contact-form');
if (!form) return;
form.addEventListener('submit', function(e) {
e.preventDefault();
var website = document.getElementById('website');
if (website && website.value !== '') {
return;
}
var formData = new FormData(form);
formData.append('action', 'bdm_contact_submit');
var responseDiv = document.getElementById('contact-form-response');
fetch('<?php echo admin_url('admin-ajax.php'); ?>', {
method: 'POST',
body: formData,
credentials: 'same-origin'
})
.then(function(response) {
return response.json();
})
.then(function(data) {
if (data.success) {
responseDiv.innerHTML = '<p class="success"><?php esc_html_e('Thank you for your message. We will get back to you soon.', 'bd-bookshelf'); ?></p>';
form.reset();
} else {
responseDiv.innerHTML = '<p class="error">' + (data.data ? data.data.message : '<?php esc_html_e('There was an error sending your message. Please try again.', 'bd-bookshelf'); ?>') + '</p>';
}
responseDiv.style.display = 'block';
responseDiv.scrollIntoView({ behavior: 'smooth' });
})
.catch(function() {
responseDiv.innerHTML = '<p class="error"><?php esc_html_e('There was an error sending your message. Please try again.', 'bd-bookshelf'); ?></p>';
responseDiv.style.display = 'block';
});
});
})();
</script>
<?php
get_footer();