Skip to content
Browse files

Reformat the template, and annotate with comments.

  • Loading branch information...
1 parent c4221e0 commit 41b73af31a470a42b6b829b160aacfdc8e3dbfc3 @nelstrom committed Feb 17, 2011
Showing with 18 additions and 11 deletions.
  1. +18 −11 public/app/views/tracks.js
View
29 public/app/views/tracks.js
@@ -4,21 +4,28 @@ NestedListDemo.views.Tracks = Ext.extend(Ext.NestedList, {
getItemTextTpl: function() {
var tplConstructor = '{text}' +
'<tpl if="model === \'Artist\'">'+
- ' <div class="metadata">{[values.items.length]} albums</div>' +
+ '<div class="metadata">' +
+ ' {[values.items.length]} albums' +
+ '</div>' +
'</tpl>' +
'<tpl if="model === \'Album\'">'+
- '<div class="metadata">' +
- ' {[values.items.length]} tracks' +
- // ideally, want to sum the duration of all tracks
- ' Running time: {[values.items]}' +
- '</div>' +
+ '<div class="metadata">' +
+ ' {[values.items.length]} tracks' +
+ // ideally, want to sum the duration of all tracks
+ ' Running time: {[values.items]}' +
+ '</div>' +
'</tpl>' +
'<tpl if="model === \'Track\'">'+
- '<div class="metadata">' +
- ' Running time: {duration} seconds' +
- '</div>' +
- '</tpl>' +
- '';
+ '<div class="metadata">' +
+ ' Running time: {duration} seconds' +
+ '</div>' +
+ '</tpl>';
+
+ // If I use construct an XTemplate here and return it,
+ // the template breaks
+ //return new Ext.XTemplate(tplConstructor);
+
+ // If I return the string, the template works
return tplConstructor;
},
store: NestedListDemo.tracks_store,

0 comments on commit 41b73af

Please sign in to comment.
Something went wrong with that request. Please try again.