Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: itw-creative-works/ultimate-jekyll
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dc4a6d1e88992a233ff53abcd11de6026c2c31dd
Choose a base ref
..
head repository: itw-creative-works/ultimate-jekyll
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f649eb5bb8505eacf6c8428aa4a6322288f5c9b8
Choose a head ref
Showing with 48 additions and 4 deletions.
  1. +1 −0 .nvmrc copy
  2. +42 −3 _includes/master/modules/user/dashboard.html
  3. +4 −0 _layouts/master/placeholder/contact.html
  4. +1 −1 package.json
1 change: 1 addition & 0 deletions .nvmrc copy
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18/*
45 changes: 42 additions & 3 deletions _includes/master/modules/user/dashboard.html
Original file line number Diff line number Diff line change
@@ -124,6 +124,7 @@ <h4 class="text-white">Alert!</h4>
self._elements = ['input', 'textarea', 'select'];
self._events = ['change', 'keydown', 'cut', 'paste']
self._inputAndSubmit = 'input, textarea, select, button[type="submit"]';
self._autoFocused = false;

// Set global libraries
select = Manager.dom().select;
@@ -152,6 +153,7 @@ <h4 class="text-white">Alert!</h4>
options.showUnsavedPopup = typeof options.showUnsavedPopup === 'undefined' ? true : options.showUnsavedPopup;
options.checkboxReturnType = typeof options.checkboxReturnType === 'undefined' ? 'object' : options.checkboxReturnType;
options.allowMultipleSubmits = typeof options.allowMultipleSubmits === 'undefined' ? true : options.allowMultipleSubmits;
options.initialStatus = options.initialStatus || 'ready';

self.element.id = select(self.id);

@@ -178,11 +180,14 @@ <h4 class="text-white">Alert!</h4>
// Change handler
self._setEventListeners();

// Submit handler
self.element.id.get(0).addEventListener('submit', function (event) {
console.log('[Dashboard]', self.id, 'submit event', event);

// Change status
self.display('loading');

// Fire submit handler
self._handler.onSubmit(event, self.getFormData());
});

@@ -204,13 +209,21 @@ <h4 class="text-white">Alert!</h4>
});
});

// self.display('loading');
// Set status
self.display('initializing');

// Set options
self.options = options;

// Trigger initial event manually
if (!self._triggeredInitialOnChangeEvent) {
// Set initial on change handler
// This is so we can set the initial status
self._initialOnChangeHandler = function () {
self.setAllowLeave(true);
self.display(options.initialStatus);
}

if (self._$manualChangeTriggerElement) {
self.triggerOnChange();
}
@@ -274,12 +287,19 @@ <h4 class="text-white">Alert!</h4>
var isDisabledClass = el.classList.contains('disabled');
var isDisabledAttribute = el.hasAttribute('disabled');

// Determine if we should disable the element
if (isPending && (!isDisabledClass || !isDisabledAttribute)) {
$el.addClass('disabled').setAttribute('disabled', true);
} else if (!isPending && (isDisabledClass || isDisabledAttribute)){
$el.removeClass('disabled').removeAttribute('disabled');
}

// If the element has autofocus, select the entire text
if (status === 'ready' && !self._autoFocused && el.hasAttribute('autofocus')) {
self._autoFocused = true;
el.select();
}

// var isDisabledClass = el.classList.contains('disabled');
// var isDisabledAttribute = el.hasAttribute('disabled');
// if (isPending && (!isDisabledClass || !isDisabledAttribute)) {
@@ -365,6 +385,12 @@ <h4 class="text-white">Alert!</h4>
// Run onStatus
self._handler.onStatus(status, message);

// Set initial on change handler to null so it doesn't run again
// If the dev manually calls .display() then it wont set automatically call the initial on change handler with the options.initialStatus
// If the dev does not call .display() then it will automatically call the initial on change handler with the options.initialStatus
self._initialOnChangeHandler = null;

// Return
return self;
};

@@ -492,27 +518,40 @@ <h4 class="text-white">Alert!</h4>
Dashboard.prototype._changeHandler = function (event) {
var self = this;

// Delay the change event so that the form can update
setTimeout(function () {
// Prevent enter key from triggering change event so that it doesn't submit the form
if (event.key === 'Enter') {
return
return;
}

// Log
console.log('[Dashboard]', self.id, 'change event', event);

// Show unsaved popup if enabled
if (self.options.showUnsavedPopup) {
self.element.unsaved.parent.removeAttribute('hidden');
}

// Set allow leave to false
if (self.options.preventUnsavedNavigation) {
self.setAllowLeave(false);
}

self.display('ready');
// Trigger initial handler to set the initial status
if (self._initialOnChangeHandler) {
self._initialOnChangeHandler();
} else {
// Set status to ready so if there's an error it will go away when they start typing again
self.display('ready');
}

// Run on change with form data
self._handler.onChange(event, self.getFormData());
}, 1);
}

// Export to global
window.Dashboard = Dashboard;

// Log
4 changes: 4 additions & 0 deletions _layouts/master/placeholder/contact.html
Original file line number Diff line number Diff line change
@@ -35,6 +35,10 @@ <h1 class="display-4">{{ site.brand.name }}</h1>
<input type="email" class="form-control" id="slap_honey" name="slap_honey" aria-describedby="emailCatcher" placeholder="Enter email">
</div>

<div style="display: none;">
<input type="email" name="slap_honey" class="form-control" placeholder="Your Email">
</div>

<div class="form-group mb-3">
<label for="slap_replyto">Email address</label>
<input type="email" class="form-control" id="slap_replyto" name="slap_replyto" aria-describedby="emailHelp" placeholder="Enter email" required>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@
"through2": "4.0.2",
"ultimate-jekyll-poster": "1.0.1",
"vinyl-named": "1.1.0",
"web-manager": "3.2.56",
"web-manager": "3.2.61",
"webpack": "5.94.0",
"webpack-stream": "6.1.2",
"wonderful-fetch": "1.1.12",