cablegates/static/js/pandora/ui/sectionButtons.js

33 lines
1.2 KiB
JavaScript
Raw Normal View History

2011-05-25 19:42:45 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=js
pandora.ui.sectionButtons = function() {
2011-06-19 17:49:25 +00:00
var that = Ox.ButtonGroup({
2011-05-25 19:42:45 +00:00
buttons: [
2011-06-06 15:48:11 +00:00
{id: 'site', selected: pandora.user.ui.section == 'site', title: pandora.site.site.name},
{id: 'items', selected: pandora.user.ui.section == 'items', title: pandora.site.itemName.plural},
{id: 'texts', selected: pandora.user.ui.section == 'texts', title: 'Texts'},
{id: 'admin', selected: pandora.user.ui.section == 'admin', title: 'Admin'}
2011-05-25 19:42:45 +00:00
],
id: 'sectionButtons',
selectable: true
}).css({
float: 'left',
margin: '4px'
})
.bindEvent({
change: function(event, data) {
var section = data.selected[0];
if (section == 'site') {
2011-06-06 15:48:11 +00:00
pandora.URL.set(pandora.user.ui.sitePage);
2011-05-25 19:42:45 +00:00
} else if (section == 'items') {
pandora.URL.set(pandora.Query.toString());
2011-05-28 11:18:28 +00:00
} else if (section == 'texts') {
pandora.URL.set('texts');
} else if (section == 'admin') {
pandora.URL.set('admin');
2011-05-25 19:42:45 +00:00
}
}
});
return that;
};