From b03ee802565df3947bdd171faf064d8f7e7d1a9b Mon Sep 17 00:00:00 2001 From: Jacob Hilker Date: Sun, 9 Mar 2014 19:30:28 -0400 Subject: [PATCH] add ability to view original file --- karmaworld/assets/js/note-detail.js | 45 ++++++++++++--------- karmaworld/templates/notes/note_detail.html | 7 ++-- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/karmaworld/assets/js/note-detail.js b/karmaworld/assets/js/note-detail.js index d450531..772419b 100644 --- a/karmaworld/assets/js/note-detail.js +++ b/karmaworld/assets/js/note-detail.js @@ -133,28 +133,33 @@ $(function() { // Embed the converted markdown if it is on the page, else default to the iframe if ($('#note-markdown').length > 0) { $('#note-markdown').html(marked($('#note-markdown').data('markdown'))); - } else { - $.ajax(note_contents_url, { - type: 'GET', - xhrFields: { - onprogress: function (progress) { - var percentage = Math.floor((progress.loaded / progress.total) * 100); - writeNoteFrame("

" + percentage + "%

"); - } - }, - success: function(data, textStatus, jqXHR) { - writeNoteFrame(data); - autoResize('noteframe'); - if (pdfControls == true) { - setupPdfViewer(); - } - }, - error: function(data, textStatus, jqXHR) { - writeNoteFrame("

Sorry, your note could not be retrieved.

"); - } - }); } + $('#note-iframe-toggle').click(function(){ + $('#noteframe').slideToggle(); + autoResize('noteframe'); + }); + + $.ajax(note_contents_url, { + type: 'GET', + xhrFields: { + onprogress: function (progress) { + var percentage = Math.floor((progress.loaded / progress.total) * 100); + writeNoteFrame("

" + percentage + "%

"); + } + }, + success: function(data, textStatus, jqXHR) { + writeNoteFrame(data); + autoResize('noteframe'); + if (pdfControls == true) { + setupPdfViewer(); + } + }, + error: function(data, textStatus, jqXHR) { + writeNoteFrame("

Sorry, your note could not be retrieved.

"); + } + }); + $('#edit_note_tags').click(function(event) { $('#note_tags_form').slideToggle(); }); diff --git a/karmaworld/templates/notes/note_detail.html b/karmaworld/templates/notes/note_detail.html index 38db821..415576e 100644 --- a/karmaworld/templates/notes/note_detail.html +++ b/karmaworld/templates/notes/note_detail.html @@ -193,10 +193,11 @@
{% if note.has_markdown %} - {% else %} - + Show original document {% endif %} + -- 2.25.1