mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 14:11:13 -05:00
- Created a base email template (base.html) for consistent styling across all emails. - Added moderation approval email template (moderation_approved.html) to notify users of approved submissions. - Added moderation rejection email template (moderation_rejected.html) to inform users of required changes for their submissions. - Created password reset email template (password_reset.html) for users requesting to reset their passwords. - Developed a welcome email template (welcome.html) to greet new users and provide account details and tips for using ThrillWiki.
44 lines
1.5 KiB
JavaScript
44 lines
1.5 KiB
JavaScript
/*global URLify*/
|
|
'use strict';
|
|
{
|
|
const $ = django.jQuery;
|
|
$.fn.prepopulate = function(dependencies, maxLength, allowUnicode) {
|
|
/*
|
|
Depends on urlify.js
|
|
Populates a selected field with the values of the dependent fields,
|
|
URLifies and shortens the string.
|
|
dependencies - array of dependent fields ids
|
|
maxLength - maximum length of the URLify'd string
|
|
allowUnicode - Unicode support of the URLify'd string
|
|
*/
|
|
return this.each(function() {
|
|
const prepopulatedField = $(this);
|
|
|
|
const populate = function() {
|
|
// Bail if the field's value has been changed by the user
|
|
if (prepopulatedField.data('_changed')) {
|
|
return;
|
|
}
|
|
|
|
const values = [];
|
|
$.each(dependencies, function(i, field) {
|
|
field = $(field);
|
|
if (field.val().length > 0) {
|
|
values.push(field.val());
|
|
}
|
|
});
|
|
prepopulatedField.val(URLify(values.join(' '), maxLength, allowUnicode));
|
|
};
|
|
|
|
prepopulatedField.data('_changed', false);
|
|
prepopulatedField.on('change', function() {
|
|
prepopulatedField.data('_changed', true);
|
|
});
|
|
|
|
if (!prepopulatedField.val()) {
|
|
$(dependencies.join(',')).on('keyup change focus', populate);
|
|
}
|
|
});
|
|
};
|
|
}
|