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 this.subwidget('Mindmap', { _team: 'main', facet: 'subject' })));
39 s.push(section('topics', 'Related Topics',
40 this.subwidget('Facet', { _team: 'main', facet: 'subject' })));
45 s.push('<tr><td colspan="2"><hr class="divider"/></td></tr>');
47 s.push(sectionRow('entries', 'Credo Entries',
48 this.subwidget('Records', { _team: 'main' })));
49 s.push(sectionRow('articles', 'Articles',
50 1 || this.subwidget('Records', { /* ### config */ })));
51 s.push(sectionRow('books', 'Books',
52 1 || this.subwidget('Records', { /* ### config */ })));
53 s.push(sectionRow('news', 'News',
54 1 || this.subwidget('Records', { /* ### config */ })));
55 s.push(sectionRow('resources', 'Suggested Resources',
56 1 || this.subwidget('Records', { /* ### config */ })));
60 this.node.html(s.join(''));
63 function section(xclass, title, content) {
65 s.push('<div class="' + xclass + ' section">');
66 s.push('<div class="title">' + title + '</div>');
67 s.push('<div class="content">' + content + '</div>');
72 function sectionRow(xclass, title, content) {
75 s.push('<td colspan="2">');
76 s.push(section(xclass, title, content));
84 mkws.registerWidgetType('Mindmap', function() {
85 this.node.html("### We do not yet have a Mindmap widget");