diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-02-04 07:01:04 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-02-06 22:30:07 +0300 |
commit | 89b3ddd609063d93f39a02279f0f3e23b8b6b364 (patch) | |
tree | 4f36de052a6bbcfed2b884c860363037663601e7 /app/assets/javascripts/broadcast_message.js.coffee | |
parent | 26f3cc41fc41f2901cc560aaecf1fe49cadda7ca (diff) |
Allow limited Markdown in Broadcast Messages
Closes #11853
Diffstat (limited to 'app/assets/javascripts/broadcast_message.js.coffee')
-rw-r--r-- | app/assets/javascripts/broadcast_message.js.coffee | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/assets/javascripts/broadcast_message.js.coffee b/app/assets/javascripts/broadcast_message.js.coffee new file mode 100644 index 00000000000..a38a329c4c2 --- /dev/null +++ b/app/assets/javascripts/broadcast_message.js.coffee @@ -0,0 +1,22 @@ +$ -> + $('input#broadcast_message_color').on 'input', -> + previewColor = $(@).val() + $('div.broadcast-message-preview').css('background-color', previewColor) + + $('input#broadcast_message_font').on 'input', -> + previewColor = $(@).val() + $('div.broadcast-message-preview').css('color', previewColor) + + previewPath = $('textarea#broadcast_message_message').data('preview-path') + + $('textarea#broadcast_message_message').on 'input', -> + message = $(@).val() + + if message == '' + $('.js-broadcast-message-preview').text("Your message here") + else + $.ajax( + url: previewPath + type: "POST" + data: { broadcast_message: { message: message } } + ) |