Skip to content

Instantly share code, notes, and snippets.

@mikewadhera
Created January 19, 2011 21:01
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mikewadhera/786861 to your computer and use it in GitHub Desktop.
snippet of explorer.js
function buildPhotoPanel() {
photoPanel = new Ext.Panel({
html: '<canvas id="photos"></canvas>',
cls: 'card',
layout: 'fit'
});
// attach the panel listeners
photoPanel.addListener('afterrender', function() {
initPhotoGrid();
});
photoPanel.addListener('afterlayout', function() {
if (tiler) {
tiler.resize(this.getWidth(), this.getHeight());
} // if
});
} // initMapPanel
function buildTabList() {
smlTabList = new Ext.List({
tpl: '<tpl for="."><div class="tab-list-item">{page} - {name}</div></tpl>',
grouped: true,
store: SMLTabStore,
scroll: true,
layout: 'fit',
onItemDisclosure: function(record, button, index) {
tile = new T5.ImageTile({
photoIndex: index
});
viewTilePhoto(null, tile, null);
}
});
}
Ext.setup({
icon: '/icons/icon.png',
glossOnIcon: false,
onReady: function() {
buildToolbar();
buildPhotoPanel();
buildTabList();
overlay = new Ext.Panel({
floating: true,
modal: true,
centered: false,
width: 600,
height: 400,
styleHtmlContent: true,
scroll: 'vertical'
});
mainPanel = new Ext.TabPanel({
tabBar: {
dock: 'bottom',
layout: {
pack: 'center'
}
},
dockedItems: [actionBar],
fullscreen: true,
ui: 'light',
animation: {
type: 'cardslide',
cover: true
},
defaults: {
scroll: false
},
items: [{
id: 'photoContainer',
title: 'Grid',
iconCls: 'photos',
layout: 'card',
animation: {
type: 'slide'
},
items: [photoPanel, {
id: 'photoDetails',
cls: 'card',
scroll: 'vertical'
}],
listeners: {
cardswitch: function(container, newCard, oldCard, index, animated) {
var backButton = Ext.getCmp('goback');
if (backButton) {
backButton[index === 0 ? 'disable' : 'enable'].apply(backButton);
} // if
}
}
}, {
id: 'tabList',
title: 'List',
iconCls: 'details',
layout: 'card',
items: [smlTabList, { cls: 'card', scroll: 'vertical' }]
}, {
title: 'About',
contentEl: 'about',
iconCls: 'info',
cls: 'card'
}]
});
mainPanel.addListener('cardswitch', function(container, newCard, oldCard, index, animated) {
modeBar[index === 0 ? 'enable' : 'disable'].apply(modeBar);
if (index === 0) {
newCard.setCard(0);
}
});
// attach the panel listeners
mainPanel.addListener('afterrender', function() {
mapPanel.setWidth(this.getWidth());
mapPanel.setHeight(this.getHeight());
});
T5.Images.avgImageSize = 80;
buildGrid();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment