InfoPanel.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * @class Ext.chooser.InfoPanel
  3. * @extends Ext.panel.Panel
  4. * @author Ed Spencer
  5. *
  6. * This panel subclass just displays information about an image. We have a simple template set via the tpl property,
  7. * and a single function (loadRecord) which updates the contents with information about another image.
  8. */
  9. Ext.define('Ext.chooser.InfoPanel', {
  10. extend: 'Ext.panel.Panel',
  11. alias : 'widget.infopanel',
  12. id: 'img-detail-panel',
  13. width: 150,
  14. minWidth: 150,
  15. tpl: [
  16. '<div class="details">',
  17. '<tpl for=".">',
  18. (!Ext.isIE6? '<img src="icons/{thumb}" />' :
  19. '<div style="width:74px;height:74px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'icons/{thumb}\')"></div>'),
  20. '<div class="details-info">',
  21. '<b>Example Name:</b>',
  22. '<span>{name}</span>',
  23. '<b>Example URL:</b>',
  24. '<span><a href="http://dev.sencha.com/deploy/touch/examples/{url}" target="_blank">{url}.html</a></span>',
  25. '<b>Type:</b>',
  26. '<span>{type}</span>',
  27. '</div>',
  28. '</tpl>',
  29. '</div>'
  30. ],
  31. afterRender: function(){
  32. this.callParent();
  33. if (!Ext.isWebKit) {
  34. this.el.on('click', function(){
  35. alert('The Sencha Touch examples are intended to work on WebKit browsers. They may not display correctly in other browsers.');
  36. }, this, {delegate: 'a'});
  37. }
  38. },
  39. /**
  40. * Loads a given image record into the panel. Animates the newly-updated panel in from the left over 250ms.
  41. */
  42. loadRecord: function(image) {
  43. this.body.hide();
  44. this.tpl.overwrite(this.body, image.data);
  45. this.body.slideIn('l', {
  46. duration: 250
  47. });
  48. }
  49. });