Skip to content

Commit

Permalink
fix ace_editor auto saving problem, update card type for bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
chuenlok committed Jun 27, 2015
1 parent f0891cc commit 6fd54a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
@@ -0,0 +1,7 @@
# -*- encoding : utf-8 -*-

class FixScriptBootstrapCardType < Card::CoreMigration
def up
Card[:script_bootstrap].update_attributes! :type_id=>Card::JavaScriptID
end
end
10 changes: 5 additions & 5 deletions card/mod/03_machines/lib/javascript/wagn_mod.js.coffee
Expand Up @@ -5,6 +5,7 @@ window.wagn ||= {} #needed to run w/o *head. eg. jasmine
$.extend wagn,
editorContentFunctionMap: {
'.tinymce-textarea' : -> tinyMCE.get(@[0].id).getContent()
'.ace_editor' : -> ace_editor_content this[0]
'.pointer-select' : -> pointerContent @val()
'.pointer-multiselect' : -> pointerContent @val()
'.pointer-radio-list' : -> pointerContent @find('input:checked').val()
Expand Down Expand Up @@ -54,7 +55,6 @@ $.extend wagn,
position: "absolute"
width: textarea.width()
height: textarea.height()
class: textarea.attr("class")
).insertBefore(textarea)
textarea.css "visibility", "hidden"
textarea.css "height", "0px"
Expand All @@ -69,10 +69,6 @@ $.extend wagn,
editor.getSession().setUseSoftTabs true
editor.setOptions maxLines: 30

textarea.closest("form").submit ->
textarea.val editor.getSession().getValue()
return

return


Expand Down Expand Up @@ -317,6 +313,10 @@ pointerContent = (vals) ->
list = $.map $.makeArray(vals), (v)-> if v then '[[' + v + ']]'
$.makeArray(list).join "\n"

ace_editor_content = (element) ->
editor = ace.edit(element)
editor.getSession().getValue()

#navbox mod
reqIndex = 0 #prevents race conditions

Expand Down

0 comments on commit 6fd54a6

Please sign in to comment.