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) {
if (state.hash.query.embed === true) { if (state.hash.query.embed === true) {
// ... // ...
} else if (state.hash.query.print == true) {
// ...
} else { } else {
state.hash.query.forEach(function(kv) { state.hash.query.forEach(function(kv) {
set[kv.key] = kv.value; set[kv.key] = kv.value;

View file

@ -5,38 +5,65 @@
pandora.ui.printView = function(data) { pandora.ui.printView = function(data) {
var that = Ox.Element() var that = Ox.Element()
.css({ .css({
padding: '64px 128px', padding: '64px 128px',
backgroundColor: 'rgb(255, 255, 255)', backgroundColor: 'rgb(255, 255, 255)',
color: 'rgb(0, 0, 0)' color: 'rgb(0, 0, 0)'
}), }),
keys = ['director', 'year', 'title']; keys = ['director', 'year', 'title'];
Ox.$body.css({
background: 'rgb(255, 255, 255)',
overflow: 'auto'
});
Ox.LoadingScreen().appendTo(that);
pandora.api.find({ pandora.api.find({
keys: keys.concat(['id']), keys: keys.concat(['id', 'summary']),
query: pandora.user.ui.find, query: pandora.user.ui.find,
range: [0, 1000000], range: [0, 1000000],
sort: keys.map(function(key) { sort: keys.map(function(key) {
return { return {
key: key, key: key,
operator: Ox.getObjectById(pandora.site.itemKeys, 'year').operator operator: Ox.getObjectById(pandora.site.itemKeys, key).operator
}; };
}) })
}, function(result) { }, 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) { result.data.items && result.data.items.forEach(function(item) {
var url = (pandora.site.https ? 'https://' : 'http://') var url = (pandora.site.https ? 'https://' : 'http://')
+ pandora.site.url + '/' + item.id; + pandora.site.site.url + '/' + item.id;
$('<div>') $('<div>')
.attr({title: url}) .attr({title: url})
.css({ .css({
height: '16px', height: '16px',
overflow: 'hidden', textAlign: 'justify',
textOverflow: 'ellipsis' textOverflow: 'ellipsis',
overflow: 'hidden'
}) })
.html( .html(
(item.director ? item.director.join(', ') + ': ' : '') (item.director ? item.director.join(', ') + ': ' : '')
+ '<b>' + item.title + '</b>' + '<b>' + item.title + '</b>'
+ (item.year ? ' (' + item.year + ')' : '') + (item.year ? ' (' + item.year + ')' : '')
+ (
item.summary
? ' <span style="color: rgb(128, 128, 128)">'
+ item.summary + '</span>'
: ''
)
) )
.on({ .on({
click: function() { click: function() {
@ -45,8 +72,33 @@ pandora.ui.printView = function(data) {
}) })
.appendTo(that); .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; return that;
}; };

View file

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