update print view

This commit is contained in:
rolux 2013-03-09 04:24:00 +00:00
parent ec3ffee3db
commit 9d65ac96f6
3 changed files with 77 additions and 10 deletions

View file

@ -105,6 +105,8 @@ pandora.URL = (function() {
if (state.hash.query) {
if (state.hash.query.embed === true) {
// ...
} else if (state.hash.query.print == true) {
// ...
} else {
state.hash.query.forEach(function(kv) {
set[kv.key] = kv.value;

View file

@ -12,31 +12,58 @@ pandora.ui.printView = function(data) {
}),
keys = ['director', 'year', 'title'];
Ox.$body.css({
background: 'rgb(255, 255, 255)',
overflow: 'auto'
});
Ox.LoadingScreen().appendTo(that);
pandora.api.find({
keys: keys.concat(['id']),
keys: keys.concat(['id', 'summary']),
query: pandora.user.ui.find,
range: [0, 1000000],
sort: keys.map(function(key) {
return {
key: key,
operator: Ox.getObjectById(pandora.site.itemKeys, 'year').operator
operator: Ox.getObjectById(pandora.site.itemKeys, key).operator
};
})
}, function(result) {
var padding;
that.empty();
$('<div>')
.css({
height: '16px'
})
.html(
'<b>' + pandora.site.site.name + ' - '
+ (pandora.user.ui._list || 'All ' + pandora.site.itemName.plural)
+ '</b>'
)
.appendTo(that);
$('<div>').css({height: '16px'}).appendTo(that);
result.data.items && result.data.items.forEach(function(item) {
var url = (pandora.site.https ? 'https://' : 'http://')
+ pandora.site.url + '/' + item.id;
+ pandora.site.site.url + '/' + item.id;
$('<div>')
.attr({title: url})
.css({
height: '16px',
overflow: 'hidden',
textOverflow: 'ellipsis'
textAlign: 'justify',
textOverflow: 'ellipsis',
overflow: 'hidden'
})
.html(
(item.director ? item.director.join(', ') + ': ' : '')
+ '<b>' + item.title + '</b>'
+ (item.year ? ' (' + item.year + ')' : '')
+ (
item.summary
? ' <span style="color: rgb(128, 128, 128)">'
+ item.summary + '</span>'
: ''
)
)
.on({
click: function() {
@ -45,8 +72,33 @@ pandora.ui.printView = function(data) {
})
.appendTo(that);
});
if (result.data.items.length) {
$('<div>').css({height: '16px'}).appendTo(that);
}
$('<div>')
.css({
height: '16px'
})
.html(
Ox.formatCount(
result.data.items.length,
pandora.site.itemName.singular,
pandora.site.itemName.plural
).toLowerCase()
)
.appendTo(that);
});
that.display = function() {
// fixme: move animation into Ox.App
var animate = $('.OxScreen').length == 0;
Ox.Log('', 'ANIMATE?', animate)
animate && pandora.$ui.body.css({opacity: 0});
that.appendTo(pandora.$ui.body);
animate && pandora.$ui.body.animate({opacity: 1}, 1000);
return that;
};
return that;
};

View file

@ -652,6 +652,11 @@ pandora.getHash = function(state, callback) {
&& Ox.indexOf(state.hash.query, function(condition) {
return Ox.isEqual(condition, {key: 'embed', value: true});
}) > -1,
isPrint = state.hash && state.hash.query
&& Ox.indexOf(state.hash.query, function(condition) {
return Ox.isEqual(condition, {key: 'print', value: true});
}) > -1,
printKeys = ['print'],
removeKeys = [];
if (state.hash && state.hash.anchor) {
if (state.page == 'help') {
@ -672,6 +677,12 @@ pandora.getHash = function(state, callback) {
removeKeys.push(condition.key);
}
});
} else if (isPrint) {
state.hash.query.forEach(function(condition) {
if (!Ox.contains(printKeys, condition.key)) {
removeKeys.push(condition.key);
}
});
} else {
state.hash.query.forEach(function(condition) {
var key = condition.key.split('.')[0];
@ -1313,6 +1324,8 @@ pandora.resizeFolders = function() {
pandora.resizeWindow = function() {
if (pandora.$ui.embedPanel) {
pandora.$ui.embedPanel.resizePanel();
}
if (pandora.$ui.embedPanel || pandora.$ui.printView) {
return;
}
// FIXME: a lot of this throws errors on load