forked from 0x2620/pandora
return of the document dialog at /document/<id>
This commit is contained in:
parent
b829faf5d6
commit
df60dca85f
9 changed files with 31 additions and 20 deletions
|
@ -1258,7 +1258,7 @@
|
|||
"page": "",
|
||||
"part": {
|
||||
"api": "",
|
||||
"documents": "",
|
||||
"document": "",
|
||||
"entities": "",
|
||||
"faq": "",
|
||||
"help": "",
|
||||
|
|
|
@ -1743,6 +1743,7 @@
|
|||
"page": "",
|
||||
"part": {
|
||||
"api": "",
|
||||
"document": "",
|
||||
"entities": "",
|
||||
"faq": "",
|
||||
"help": "",
|
||||
|
|
|
@ -1205,6 +1205,7 @@
|
|||
"page": "",
|
||||
"part": {
|
||||
"api": "",
|
||||
"document": "",
|
||||
"entities": "",
|
||||
"faq": "",
|
||||
"help": "",
|
||||
|
|
|
@ -1159,6 +1159,7 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
|
|||
"page": "",
|
||||
"part": {
|
||||
"api": "",
|
||||
"document": "",
|
||||
"entities": "",
|
||||
"faq": "",
|
||||
"help": "",
|
||||
|
|
|
@ -20,15 +20,13 @@ pandora.URL = (function() {
|
|||
Ox.contains(Object.keys(pandora.site.user.ui.part), state.page)
|
||||
) {
|
||||
state.part = pandora.user.ui.part[state.page];
|
||||
/*
|
||||
if (
|
||||
state.page == 'documents'
|
||||
state.page == 'document'
|
||||
&& pandora.user.ui.documents[state.part]
|
||||
&& pandora.user.ui.documents[state.part].position
|
||||
) {
|
||||
state.span = pandora.user.ui.documents[state.part].position;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -174,6 +172,9 @@ pandora.URL = (function() {
|
|||
) && state.part) {
|
||||
set['part.' + state.page] = state.part;
|
||||
}
|
||||
if (state.span) {
|
||||
set['documents.' + state.part] = {position: state.span};
|
||||
}
|
||||
pandora.UI.set(set);
|
||||
callback && callback();
|
||||
|
||||
|
@ -473,7 +474,7 @@ pandora.URL = (function() {
|
|||
getSort: pandora.getSort,
|
||||
getSpan: pandora.getSpan,
|
||||
pages: [].concat(
|
||||
['home', 'software', 'api', 'help', 'tv', 'entities'],
|
||||
['home', 'software', 'api', 'help', 'tv', 'document', 'entities'],
|
||||
pandora.site.sitePages.map(function(page) {
|
||||
return page.id;
|
||||
}),
|
||||
|
|
|
@ -71,10 +71,10 @@ pandora.ui.appPanel = function() {
|
|||
!pandora.$ui.appPanel ? 'showScreen' : 'fadeInScreen'
|
||||
]();
|
||||
pandora.$ui.home && pandora.$ui.tv.mute();
|
||||
} else if (page == 'documents') {
|
||||
if (pandora.user.ui.part.documents) {
|
||||
} else if (page == 'document') {
|
||||
if (pandora.user.ui.part.document) {
|
||||
pandora.openDocumentDialog({
|
||||
ids: [pandora.user.ui.part.documents.split('/')[0]]
|
||||
ids: [pandora.user.ui.part.document.split('/')[0]]
|
||||
});
|
||||
} else {
|
||||
pandora.UI.set({page: ''});
|
||||
|
|
|
@ -9,7 +9,7 @@ pandora.openDocumentDialog = function(options) {
|
|||
pandora.$ui.documentDialog && options.ids && options.ids.length == 1
|
||||
&& Ox.getObjectById(pandora.$ui.documentDialog.getItems(), options.ids[0])
|
||||
) {
|
||||
pandora.UI.set({'part.documents': options.ids[0]});
|
||||
pandora.UI.set({'part.document': options.ids[0]});
|
||||
} else if (options.ids) {
|
||||
pandora.api.findDocuments({
|
||||
query: {
|
||||
|
@ -37,7 +37,7 @@ pandora.openDocumentDialog = function(options) {
|
|||
})
|
||||
.bindEvent({
|
||||
close: function() {
|
||||
pandora.user.ui.page == 'documents' && pandora.UI.set({page: ''});
|
||||
pandora.user.ui.page == 'document' && pandora.UI.set({page: ''});
|
||||
}
|
||||
})
|
||||
.open();
|
||||
|
@ -48,8 +48,8 @@ pandora.openDocumentDialog = function(options) {
|
|||
});
|
||||
}
|
||||
pandora.UI.set({
|
||||
page: 'documents',
|
||||
'part.documents': options.documents[0].id
|
||||
page: 'document',
|
||||
'part.document': options.documents[0].id
|
||||
});
|
||||
return pandora.$ui.documentDialog;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ pandora.documentColumns = [
|
|||
format: function(value, data) {
|
||||
return Ox.isArray(value)
|
||||
? Ox.formatDimensions(value, 'px')
|
||||
: Ox.formatCount(value, data.extension == 'html' ? 'word' : 'page');
|
||||
: Ox.formatCount(value, (data && data.extension == 'html') ? 'word' : 'page');
|
||||
},
|
||||
id: 'dimensions',
|
||||
operator: '-',
|
||||
|
|
|
@ -1497,9 +1497,14 @@ pandora.getItem = function(state, str, callback) {
|
|||
}
|
||||
});
|
||||
} else if (state.type == 'documents') {
|
||||
pandora.api.getDocument({id: str, keys: ['id']}, function(result) {
|
||||
pandora.api.getDocument({
|
||||
id: str,
|
||||
// send keys so that subsequent request when parsing
|
||||
// page number etc. is already in the cache
|
||||
keys: ['dimensions', 'extension']
|
||||
}, function(result) {
|
||||
if (result.status.code == 200) {
|
||||
state.item = result.data.id;
|
||||
state.item = str;
|
||||
callback();
|
||||
} else {
|
||||
state.item = '';
|
||||
|
@ -1808,7 +1813,7 @@ pandora.getPart = function(state, str, callback) {
|
|||
} else {
|
||||
callback();
|
||||
}
|
||||
} else if (state.page == 'documents') {
|
||||
} else if (state.page == 'document') {
|
||||
var id = str.split('/')[0];
|
||||
if (id) {
|
||||
pandora.api.getDocument({
|
||||
|
@ -1963,10 +1968,12 @@ pandora.getSpan = function(state, val, callback) {
|
|||
// modify state.view.
|
||||
// fixme: "subtitles:23" is still missing
|
||||
Ox.Log('URL', 'getSpan', state, val);
|
||||
if (state.type == 'documents') {
|
||||
if (state.item) {
|
||||
if (state.page == 'document' || // document dialog
|
||||
state.type == 'documents' // document section
|
||||
) {
|
||||
if (state.page == 'document' || state.item) {
|
||||
pandora.api.getDocument({
|
||||
id: state.item,
|
||||
id: state.page == 'document' ? state.part : state.item,
|
||||
keys: ['dimensions', 'extension']
|
||||
}, function(result) {
|
||||
var dimensions = result.data.dimensions,
|
||||
|
|
Loading…
Reference in a new issue