refactoring

This commit is contained in:
rolux 2014-02-14 16:49:42 +00:00
parent 9aa03a111b
commit 37c9fcb192

View file

@ -8,16 +8,13 @@ pandora.ui.embedPanel = function() {
ui = pandora.user.ui, ui = pandora.user.ui,
view = !ui.item ? ui.listView : ui.itemView; view = !ui.item ? ui.listView : ui.itemView;
if (ui.section != 'texts' && !ui.page) { if (!ui.page) {
if (ui.section == 'edits') { if (ui.section == 'items') {
that = pandora.ui.editPanel(true); if (!ui.item) {
} else if (!ui.item) {
if (view == 'grid') { if (view == 'grid') {
that = pandora.ui.embedGrid(); that = pandora.ui.embedGrid();
} else if (view == 'clip') { } else if (view == 'clip') {
that = pandora.ui.embedError(true); that = pandora.ui.embedError(true);
} else if (view == 'video') {
that = pandora.ui.videoView(true);
} else if (Ox.contains(['map', 'calendar'], view)) { } else if (Ox.contains(['map', 'calendar'], view)) {
that = pandora.ui.embedNavigation(view); that = pandora.ui.embedNavigation(view);
} }
@ -34,6 +31,14 @@ pandora.ui.embedPanel = function() {
that = pandora.ui.embedNavigation(view); that = pandora.ui.embedNavigation(view);
} }
} }
} 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);
} }
if (!that) { if (!that) {
that = pandora.ui.embedError(); that = pandora.ui.embedError();
@ -49,7 +54,7 @@ pandora.ui.embedPanel = function() {
return that; return that;
}; };
//only add reloadPanel if not defined by embed element // only add reloadPanel if not defined by embed element
that.reloadPanel = that.reloadPanel || function(data) { that.reloadPanel = that.reloadPanel || function(data) {
if (Ox.isUndefined(data) || data.value != data.previousValue) { if (Ox.isUndefined(data) || data.value != data.previousValue) {
pandora.$ui.embedPanel.replaceWith(pandora.$ui.embedPanel = pandora.ui.embedPanel()); pandora.$ui.embedPanel.replaceWith(pandora.$ui.embedPanel = pandora.ui.embedPanel());