exports.loadData = function(cb) { // {{{2 /** * Has a new list widget created and appends it to the main pagelet * element. It also calls the "Ose.ui.dashboard()" * method. "Ose.ui.dashboard()" governs what is diaplayed on the * dashboard. * * @method loadData */ if (cb) { this.doAfterDisplay = cb; } this.$('header').html('Dashboard'); this.$() .empty() .append(this.newWidget('list', 'list')) ; if (Ose.ui.configData.dashboard) { this.addContents(Ose.ui.configData.dashboard); } if (Ose.ui.dashboard) { Ose.ui.dashboard(this, this.afterDisplay.bind(this)); } else { this.afterDisplay(); } };
function showQRCode() { // {{{2 this.leftBox.hide(true); var url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search + '#' + encodeURIComponent(JSON.stringify(this.getStateObj())); var dialog = Ose.ui.newDialog('info', { // caption: 'URL QR Code', caption: url }); var section = dialog.$(' section'); section.on('click', dialog.close.bind(dialog)); new QRCode(section[0], { text: url, width: '200', height: '200', colorDark : '#000000', colorLight : '#ffffff', correctLevel : QRCode.CorrectLevel.H }); dialog.$(' img').css({ 'border-style': 'solid' }); section.css({ 'text-align': 'center' }); };
exports.show = function() { // {{{2 /** * Shows box * * @method show */ this.hidden = false; var that = this; var val = parseInt(this.width) * $('body').width() / 100; setTimeout(function() { $('#contentBox').css({left: val}); }, 100); Ose.ui.newHistory(); Ose.ui.updateHistory(); };
exports.addContent = function(caption, stateObj) { // {{{2 /** * Adds an item to the dashboard. * * @param caption {String} Text to be displayed * @param stateObj {Object} State object that should be displayed when the user taps on this item. */ return this.addItem(caption, Ose.ui.bindContent(stateObj)); };
exports.show = function() { // {{{2 /** * Shows search form * * @method show */ Ose.ui.newHistory(); Ose.ui.updateHistory(); var that = this; var header = this.box.$(' > header'); var searchbox = this.box.$(' > form'); header.hide(); searchbox.find('input').val(''); searchbox.show(); setTimeout(function() { searchbox.find('input').focus(); }, 0); };
function onClick(ev) { if (pin.entry) { Ose.ui.display({ content: { pagelet: 'detail', entry: pin.entry.entry, space: pin.entry.space, shard: pin.entry.shard, dialog: true } }); } else { M.log.unhandled('Missing pin.entry.'); } return false; }
exports.close = function() { Ose.ui.closeDialog(this.$()); return false; };
return function(ev) { Ose.ui.display({content: stateObj}, 'user'); // ev.ctrlkey return false; };