mirror of
https://github.com/projekteuler/projekteuler.git
synced 2026-01-27 10:38:50 +01:00
Improve translation creation form by using codemirror
This commit is contained in:
@@ -1,3 +1,20 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
|
||||
cm = null
|
||||
|
||||
loadCodeMirror = ->
|
||||
$('#translationNav li:first').addClass('active')
|
||||
$("textarea").each ->
|
||||
cm = CodeMirror.fromTextArea($(this).get(0), {
|
||||
lineNumbers: false,
|
||||
lineWrapping: true,
|
||||
mode: "text/html"
|
||||
})
|
||||
|
||||
$(document).ready loadCodeMirror
|
||||
$(document).on "page:load", loadCodeMirror
|
||||
|
||||
$(document).on "click", '#translationNav a[href="#preview"]', ->
|
||||
$('#preview .problem-content').html(cm.getValue())
|
||||
Reference in New Issue
Block a user