From 1905f6843b16337e1921a2a4c52fc60a94c21866 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 5 Mar 2018 16:55:03 +0530 Subject: [PATCH] embed document, fixes #2960 --- static/js/document.js | 2 +- static/js/embedDocument.js | 9 +++++++++ static/js/embedPanel.js | 9 +++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 static/js/embedDocument.js diff --git a/static/js/document.js b/static/js/document.js index 72669aa9..8370cce5 100644 --- a/static/js/document.js +++ b/static/js/document.js @@ -40,7 +40,7 @@ pandora.ui.document = function() { item = result.data; var documentTitle = pandora.getWindowTitle(item); document.title = pandora.getPageTitle(document.location.pathname) || documentTitle; - pandora.$ui.itemTitle + pandora.$ui.itemTitle && pandora.$ui.itemTitle .options({title: '' + (pandora.getDocumentTitle(item)) + ''}) .show(); diff --git a/static/js/embedDocument.js b/static/js/embedDocument.js new file mode 100644 index 00000000..bab72606 --- /dev/null +++ b/static/js/embedDocument.js @@ -0,0 +1,9 @@ +// vim: et:ts=4:sw=4:sts=4:ft=javascript + +'use strict'; + +pandora.ui.embedDocument = function() { + var that = Ox.Element(); + pandora.ui.document().appendTo(that) + return that; +}; diff --git a/static/js/embedPanel.js b/static/js/embedPanel.js index 381a487c..1a997dfd 100644 --- a/static/js/embedPanel.js +++ b/static/js/embedPanel.js @@ -31,14 +31,19 @@ pandora.ui.embedPanel = function() { that = pandora.ui.embedNavigation(view); } } + } else if (ui.section == 'documents') { + that = pandora.ui.embedDocument() } else if (ui.section == 'edits') { // FIXME: this is non-standard, see above! that = pandora.ui.editPanel(true); } else { that = pandora.ui.embedError(true) } - } else if (ui.page == 'documents' && ui.document) { - that = pandora.ui.embedError(true); + } else if (ui.page == 'document' && ui.part.document) { + ui.document = ui.part.document + ui.section = 'documents' + ui.page = '' + that = pandora.ui.embedDocument() } if (!that) { that = pandora.ui.embedError();