From 094dc972364f4854591c7da0f48d8aa7d4506a8d Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 16 Dec 2014 17:23:53 +0000 Subject: [PATCH] update API dialog (first pass) --- static/js/apiDialog.js | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/static/js/apiDialog.js b/static/js/apiDialog.js index ba49ba1e..6294e9fb 100644 --- a/static/js/apiDialog.js +++ b/static/js/apiDialog.js @@ -169,35 +169,26 @@ pandora.ui.apiDialog = function() { if (id && actions[id]) { $text.html('

' + id + '


'); var code = actions[id].code[1], - f = actions[id].code[0], - line = Math.round(Ox.last(f.split(':')) || 0), + source = actions[id].code[0], + line = Math.round(Ox.last(source.split(':')) || 0), doc = actions[id].doc.replace('/\n/
\n/g'), $code, $doc; - $doc = Ox.SyntaxHighlighter({ source: doc, }) .appendTo($text); - - Ox.Button({ - title: Ox._('Source ({0})', [f]), - }).bindEvent({ - click: function() { - $code.toggle(); - } - }) - .css({ - margin: '4px' - }) + $('
') + .html('' + source + '') .appendTo($text); $code = Ox.SyntaxHighlighter({ - showLineNumbers: true, - source: code, - offset: line - }) - .css({ - borderWidth: '1px', - }).appendTo($text); + showLineNumbers: true, + source: code.replace(/\s+?'''.+?'''\n/g, ''), + offset: line + }) + .css({ + borderWidth: '1px', + }) + .appendTo($text); } else { $text.empty().append(getIndex()); }