2017-01-10 18:02:20 -05:00
|
|
|
/* eslint-disable func-names, space-before-function-paren, prefer-arrow-callback, no-var, quotes, no-else-return, object-shorthand, comma-dangle, max-len */
|
2017-03-11 02:30:44 -05:00
|
|
|
|
|
|
|
$(function() {
|
|
|
|
var previewPath;
|
|
|
|
$('input#broadcast_message_color').on('input', function() {
|
|
|
|
var previewColor;
|
|
|
|
previewColor = $(this).val();
|
|
|
|
return $('div.broadcast-message-preview').css('background-color', previewColor);
|
|
|
|
});
|
|
|
|
$('input#broadcast_message_font').on('input', function() {
|
|
|
|
var previewColor;
|
|
|
|
previewColor = $(this).val();
|
|
|
|
return $('div.broadcast-message-preview').css('color', previewColor);
|
|
|
|
});
|
|
|
|
previewPath = $('textarea#broadcast_message_message').data('preview-path');
|
|
|
|
return $('textarea#broadcast_message_message').on('input', function() {
|
|
|
|
var message;
|
|
|
|
message = $(this).val();
|
|
|
|
if (message === '') {
|
|
|
|
return $('.js-broadcast-message-preview').text("Your message here");
|
|
|
|
} else {
|
|
|
|
return $.ajax({
|
|
|
|
url: previewPath,
|
|
|
|
type: "POST",
|
|
|
|
data: {
|
|
|
|
broadcast_message: {
|
|
|
|
message: message
|
2016-07-24 16:45:11 -04:00
|
|
|
}
|
2017-03-11 02:30:44 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2016-07-24 16:45:11 -04:00
|
|
|
});
|
2017-03-11 02:30:44 -05:00
|
|
|
});
|