refactoring

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

View file

@ -8,32 +8,37 @@ pandora.ui.embedPanel = function() {
ui = pandora.user.ui,
view = !ui.item ? ui.listView : ui.itemView;
if (ui.section != 'texts' && !ui.page) {
if (ui.section == 'edits') {
if (!ui.page) {
if (ui.section == 'items') {
if (!ui.item) {
if (view == 'grid') {
that = pandora.ui.embedGrid();
} else if (view == 'clip') {
that = pandora.ui.embedError(true);
} else if (Ox.contains(['map', 'calendar'], view)) {
that = pandora.ui.embedNavigation(view);
}
} else {
if (view == 'info') {
that = pandora.ui.embedInfo();
} else if (Ox.contains(['player', 'editor'], view)) {
that = pandora.ui.embedPlayer();
} else if (view == 'timeline') {
that = pandora.ui.embedTimeline();
} else if (view == 'clips') {
that = pandora.ui.embedError(true);
} else if (Ox.contains(['map', 'calendar'], view)) {
that = pandora.ui.embedNavigation(view);
}
}
} else if (ui.section == 'edits') {
// FIXME: this is non-standard, see above!
that = pandora.ui.editPanel(true);
} else if (!ui.item) {
if (view == 'grid') {
that = pandora.ui.embedGrid();
} else if (view == 'clip') {
that = pandora.ui.embedError(true);
} else if (view == 'video') {
that = pandora.ui.videoView(true);
} else if (Ox.contains(['map', 'calendar'], view)) {
that = pandora.ui.embedNavigation(view);
}
} else {
if (view == 'info') {
that = pandora.ui.embedInfo();
} else if (Ox.contains(['player', 'editor'], view)) {
that = pandora.ui.embedPlayer();
} else if (view == 'timeline') {
that = pandora.ui.embedTimeline();
} else if (view == 'clips') {
that = pandora.ui.embedError(true);
} else if (Ox.contains(['map', 'calendar'], view)) {
that = pandora.ui.embedNavigation(view);
}
that = pandora.ui.embedError(true)
}
} else if (ui.page == 'documents' && ui.document) {
that = pandora.ui.embedError(true);
}
if (!that) {
that = pandora.ui.embedError();
@ -49,7 +54,7 @@ pandora.ui.embedPanel = function() {
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) {
if (Ox.isUndefined(data) || data.value != data.previousValue) {
pandora.$ui.embedPanel.replaceWith(pandora.$ui.embedPanel = pandora.ui.embedPanel());