inital version of document urls

This commit is contained in:
j 2014-01-17 13:49:11 +00:00
parent dada4cbf4c
commit 880aa60945
9 changed files with 76 additions and 24 deletions

View file

@ -813,6 +813,7 @@
"page": "", "page": "",
"part": { "part": {
"api": "", "api": "",
"documents": "",
"faq": "", "faq": "",
"help": "", "help": "",
"news": "", "news": "",

View file

@ -829,6 +829,7 @@
"page": "", "page": "",
"part": { "part": {
"api": "", "api": "",
"documents": "",
"faq": "", "faq": "",
"help": "", "help": "",
"news": "", "news": "",

View file

@ -703,6 +703,7 @@
"page": "", "page": "",
"part": { "part": {
"api": "", "api": "",
"documents": "",
"faq": "", "faq": "",
"help": "", "help": "",
"news": "", "news": "",

View file

@ -622,6 +622,7 @@
"page": "", "page": "",
"part": { "part": {
"api": "", "api": "",
"documents": "",
"faq": "", "faq": "",
"help": "", "help": "",
"news": "", "news": "",

View file

@ -378,7 +378,7 @@ pandora.URL = (function() {
getPart: pandora.getPart, getPart: pandora.getPart,
getSpan: pandora.getSpan, getSpan: pandora.getSpan,
pages: [].concat( pages: [].concat(
['home', 'software', 'api', 'help', 'tv'], ['home', 'software', 'api', 'help', 'tv', 'documents'],
pandora.site.sitePages.map(function(page) { pandora.site.sitePages.map(function(page) {
return page.id; return page.id;
}), }),

View file

@ -71,6 +71,12 @@ pandora.ui.appPanel = function() {
!pandora.$ui.appPanel ? 'showScreen' : 'fadeInScreen' !pandora.$ui.appPanel ? 'showScreen' : 'fadeInScreen'
](); ]();
pandora.$ui.home && pandora.$ui.tv.mute(); pandora.$ui.home && pandora.$ui.tv.mute();
} else if (page == 'documents') {
if (pandora.user.ui.part.documents) {
pandora.openDocumentDialog([pandora.user.ui.part.documents.split('/')[0]]);
} else {
pandora.UI.set({page: ''});
}
} else { } else {
// open dialog // open dialog
Ox.forEach(dialogPages, function(pages, dialog) { Ox.forEach(dialogPages, function(pages, dialog) {

View file

@ -2,6 +2,45 @@
'use strict'; 'use strict';
pandora.openDocumentDialog = function(ids) {
pandora.api.findDocuments({
query: {
conditions: ids.map(function(id) {
return {key: 'id', value: id, operator: '=='}
}),
operator: '|'
},
keys: ['description', 'dimensions', 'extension', 'id', 'name']
}, function(result) {
var i = 0, documents = result.data.items.map(function(document) {
return Ox.extend({index: i++}, document);
});
if (!pandora.$ui.documentDialog) {
pandora.$ui.documentDialog = pandora.ui.documentDialog({
index: 0,
items: documents,
})
.bindEvent({
close: function() {
pandora.user.ui.page == 'documents' && pandora.UI.set({page: ''});
}
})
.open();
} else {
pandora.$ui.documentDialog.update({
index: 0,
items: documents,
});
}
pandora.UI.set({
page: 'documents',
'part.documents': documents[0].id
});
});
};
pandora.ui.documentDialog = function(options) { pandora.ui.documentDialog = function(options) {
var dialogHeight = Math.round((window.innerHeight - 48) * 0.9) + 24, var dialogHeight = Math.round((window.innerHeight - 48) * 0.9) + 24,

View file

@ -5,7 +5,7 @@
pandora.ui.documentsPanel = function(options) { pandora.ui.documentsPanel = function(options) {
var ui = pandora.user.ui, var ui = pandora.user.ui,
hasItemView = false, hasItemView = false, // FIXME
isItemView = options.isItemView, isItemView = options.isItemView,
columns = [ columns = [
@ -396,7 +396,8 @@ pandora.ui.documentsPanel = function(options) {
//fixme just upload list here //fixme just upload list here
//self.$documentsList.reloadList(); //self.$documentsList.reloadList();
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.contentPanel.replaceElement(1,
pandora.$ui.item = pandora.ui.item()); pandora.$ui.item = pandora.ui.item()
);
} }
}); });
} }
@ -450,27 +451,7 @@ pandora.ui.documentsPanel = function(options) {
} }
function openDocuments() { function openDocuments() {
if (!pandora.$ui.documentDialog) { pandora.openDocumentDialog($list.options('selected'));
pandora.$ui.documentDialog = pandora.ui.documentDialog({
index: 0,
items: $list.options('selected').map(function(id) {
return $list.value(id);
})
})
.bindEvent({
close: function() {
$list.closePreview();
}
})
.open();
} else {
pandora.$ui.documentDialog.update({
index: 0,
items: $list.options('selected').map(function(id) {
return $list.value(id);
})
});
}
} }
function openDocumentsDialog() { function openDocumentsDialog() {

View file

@ -1407,6 +1407,28 @@ pandora.getPart = function(state, str, callback) {
} else { } else {
callback(); callback();
} }
} else if (state.page == 'documents') {
var split = str.split('/')[0],
id = split[0];
if (id) {
pandora.api.findDocuments({
query: {
conditions: [{key: 'id', value: id, operator: '=='}],
operator: '&'
}
}, function(result) {
if (result.data.items) {
state.part = str;
//fixme set page/zoom/center here
} else {
state.page = '';
}
callback();
});
} else {
state.page = '';
callback();
}
} else { } else {
callback(); callback();
} }