1 // ### This works inefficiently by having multiple teams all run the
2 // same search against different sets of targets. A much better
3 // approach would be run a single search, with all these panels
4 // members of the same team, but picking out only the results relevant
5 // to them. That will be more work.
7 mkws.registerWidgetType('Credo', function() {
10 this.team.registerTemplate('CredoImage', '\
12 <a href="{{md-electronic-url}}" target="_blank">\
13 {{#mkws-first md-thumburl}}\
14 <img src="{{this}}" alt="{{../md-title}}"/>\
25 // Main panel: encylopaedia and images on the left, topics on the right
26 s.push('<tr class="front">');
28 s.push('<td class="main">');
29 s.push(section('encyclopaedia', 'Topic Page: ### title',
30 this.subwidget('Reference', { _team: 'ref' })));
31 // The Images widget needs to be in our team so we can set its template
32 s.push(section('image', 'Images',
33 this.subwidget('GoogleImage', { maxrecs: 4, template: 'CredoImage' })));
36 s.push('<td class="side">');
37 s.push(section('mindmap', 'Create a Mind Map for ### title',
38 '### Is there a way to make a mind-map?'));
39 s.push(section('topics', 'Related Topics',
40 this.subwidget('Facet', { _team: 'main', facet: 'subject' })));
45 s.push(sectionRow('entries', 'Credo Entries',
46 this.subwidget('Records', { _team: 'main' })));
47 s.push(sectionRow('articles', 'Articles',
48 1 || this.subwidget('Records', { /* ### config */ })));
49 s.push(sectionRow('books', 'Books',
50 1 || this.subwidget('Records', { /* ### config */ })));
51 s.push(sectionRow('news', 'News',
52 1 || this.subwidget('Records', { /* ### config */ })));
53 s.push(sectionRow('resources', 'Suggested Resources',
54 1 || this.subwidget('Records', { /* ### config */ })));
58 this.node.html(s.join(''));
61 function section(xclass, title, content) {
63 s.push('<div class="' + xclass + ' section">');
64 s.push('<div class="title">' + title + '</div>');
65 s.push('<div class="content">' + content + '</div>');
70 function sectionRow(xclass, title, content) {
73 s.push('<td colspan="2">');
74 s.push(section(xclass, title, content));