From 7b93db07605515ba224a1d1ac7d1d817fe298a4e Mon Sep 17 00:00:00 2001 From: Dan Sosedoff Date: Sun, 19 Oct 2014 09:06:35 -0600 Subject: [PATCH] Extract ACE editor initialization into separate method --- static/js/app.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/static/js/app.js b/static/js/app.js index 17b8060..6d47d9e 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -1,3 +1,5 @@ +var editor; + function apiCall(method, path, params, cb) { $.ajax({ url: path, @@ -247,13 +249,16 @@ function exportToCSV() { } } -var editor; - -$(document).ready(function() { +function initEditor() { editor = ace.edit("custom_query"); + editor.getSession().setMode("ace/mode/pgsql"); editor.getSession().setTabSize(2); editor.getSession().setUseSoftTabs(true); +} + +$(document).ready(function() { + initEditor(); $("#table_content").on("click", function() { showTableContent(); }); $("#table_structure").on("click", function() { showTableStructure(); });