pandora/static/js/pandora/clipsView.js

75 lines
2.6 KiB
JavaScript
Raw Normal View History

2011-10-30 16:00:21 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=javascript
2011-11-05 17:04:10 +00:00
'use strict';
2011-10-30 15:36:14 +00:00
pandora.ui.clipsView = function(videoRatio) {
var $status = $('<div>')
.css({
width: '100%',
marginTop: '2px',
fontSize: '9px',
textAlign: 'center'
})
.html('Loading...'),
that = Ox.SplitPanel({
2011-10-30 15:36:14 +00:00
elements: [
{
element: Ox.Bar({size: 24})
.append(
pandora.$ui.sortSelect = pandora.ui.sortSelect()
)
.append(
pandora.$ui.orderButton = pandora.ui.orderButton()
)
2011-10-30 16:00:21 +00:00
.append(
Ox.Input({
clear: true,
placeholder: 'Find Clips',
2012-02-01 12:01:39 +00:00
value: pandora.user.ui.itemFind,
2011-10-30 16:00:21 +00:00
width: 192
})
.css({float: 'right', margin: '4px'})
.bindEvent({
submit: function(data) {
$status.html('Loading...');
2012-02-01 12:01:39 +00:00
pandora.UI.set('itemFind', data.value);
2011-10-30 16:00:21 +00:00
// since this is the only way itemFind can change,
// there's no need for an event handler
that.replaceElement(1,
pandora.$ui.clipList = getClipList()
2011-10-30 16:00:21 +00:00
);
}
})
),
size: 24
2011-10-30 15:36:14 +00:00
},
{
element: pandora.$ui.clipList = getClipList()
},
{
2012-06-30 22:12:04 +00:00
element: Ox.Bar({size: 16}).append($status),
size: 16
2011-10-30 15:36:14 +00:00
}
],
orientation: 'vertical'
});
function getClipList() {
return pandora.ui.clipList(videoRatio)
.bindEvent({
init: function(data) {
var items = data.items;
$status.html(
(items ? Ox.formatNumber(items) : 'No')
+ ' Clip' + (items == 1 ? '' : 's')
);
}
});
}
2011-10-30 15:36:14 +00:00
return that;
};