Changeset 173
- Timestamp:
- 08/21/08 14:24:55 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/microfacts/public/behaviour/app/controllers/threadfactlets_controller.js
r171 r173 1 1 var ThreadFactletsController = new Class({ 2 2 Extends: Controller, 3 4 // factletSummaryTemplate = [ 5 //'<div id="factlet-<%= c.id %>" class="factlet">', 6 //' <%= this.partial({url: baseurl+'/title.ejs'}) %>', 7 //'</div>', 8 // ].join('\n'); 3 9 4 initialize: function ( ) {10 initialize: function (element) { 5 11 this.parent.apply(this, arguments); 6 12 // this.model = DomainObject.Resource('Factlet', this.id()); … … 9 15 // this.addDefaultListeners(); 10 16 this.factlets = []; 17 this.selectedFactletId = null; 18 }, 19 20 // Name is relative to app/views directory, without an .ejs extension. 21 renderView: function (name, data) { 22 // return new EJS({url: '/app/views/'+name+'.ejs'}).render({'c': data}); 23 }, 24 25 generateFactletElement: function (factlet) { 26 // var html = this.renderView('factlet/summary', factlet.data); 27 html = null; 28 return html; 11 29 }, 12 30 … … 14 32 console.log("ThreadFactletsController saw factletSelect event"); 15 33 console.log(this.factletDivsKeyedById); 34 this.selectedFactletId = factlet.id; 16 35 // TODO: unselect any selected element ... 17 36 this.factletDivsKeyedById.each(function(value, key) { … … 38 57 }, 39 58 59 onRemoveSelectedFactlet: function() { 60 this.thread.factlets.erase(this.selectedFactletId); 61 this.thread.save(); 62 }, 63 40 64 controls: { 41 65 '.factlet click': function (e) { trunk/microfacts/public/behaviour/load.js
r171 r173 15 15 16 16 loader.addModule({ 17 name: "ejs", 18 type: "js", 19 path: "vendor/ejs/ejs.js", 20 varName: "EJS" // Pick last class to be defined in Mootools Core. 21 }); 22 23 loader.addModule({ 17 24 name: "extensions", 18 25 type: "js", … … 130 137 type: "js", 131 138 path: "app/controllers/threadfactlets_controller.js?" + Math.random(), 132 requires: ['controller', 'thread' ],139 requires: ['controller', 'thread', 'ejs'], 133 140 varName: "ThreadFactletsController" 134 141 }); trunk/microfacts/public/test/index.html
r154 r173 26 26 visibility: hidden; 27 27 } 28 29 .thread-factlets { 30 position: absolute; 31 bottom: 0; 32 } 28 33 </style> 29 34 … … 45 50 46 51 <script type="text/javascript" src="spec/model_spec.js?123"></script> 47 <script type="text/javascript" src="spec/controller_spec.js?123"></script>52 <script type="text/javascript" src="spec/controller_spec.js?123"></script> 48 53 <script type="text/javascript" src="spec/view_spec.js?123"></script> 54 <script type="text/javascript" src="spec/threadfactletscontroller_spec.js?123"></script> 55 <!-- 49 56 <script type="text/javascript" src="spec/mapcontroller_spec.js?123"></script> 50 57 <script type="text/javascript" src="spec/timelinecontroller_spec.js?123"></script> 58 --> 51 59 52 60 <!-- … … 81 89 82 90 <div id="view"></div> 91 92 <div class="thread-factlets"> 93 <div id="factlet-101" class="factlet"> 94 <h3 class="factlet-title">My Factlet</h3> 95 </div> 96 <div id="factlet-102" class="factlet"> 97 <h3 class="factlet-title">Your Factlet</h3> 98 </div> 99 </div> 83 100 84 101 </body>
