From: Mike Taylor Date: Mon, 19 May 2014 16:10:32 +0000 (+0100) Subject: Rolling on the Credo JS. X-Git-Tag: 1.0.0~650 X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=commitdiff_plain;h=b8b83eb490e89e99620c933648147e11af9c0e12 Rolling on the Credo JS. --- diff --git a/examples/htdocs/mkws-widget-credo.js b/examples/htdocs/mkws-widget-credo.js index 7ea0169..2bb1b1a 100644 --- a/examples/htdocs/mkws-widget-credo.js +++ b/examples/htdocs/mkws-widget-credo.js @@ -1,51 +1,59 @@ mkws.registerWidgetType('Credo', function() { - s = [] + var that = this; + var s = [] s.push(''); // Main panel: encylopaedia and images on the left, topics on the right - s.push(''); + s.push(''); s.push(''); s.push(''); s.push(''); - s.push(''); - s.push(''); - s.push('
'); - s.push('
Credo Entries
'); - s.push(this.subwidget('Records', { /* ### config */ })); - s.push('
'); - s.push(''); - s.push(''); + s.push(sectionRow('entries', 'Credo Entries', + this.subwidget('Records', { /* ### config */ }))); + s.push(sectionRow('articles', 'Articles', + this.subwidget('Records', { /* ### config */ }))); + s.push(sectionRow('books', 'Books', + this.subwidget('Records', { /* ### config */ }))); + s.push(sectionRow('news', 'News', + this.subwidget('Records', { /* ### config */ }))); + s.push(sectionRow('resources', 'Suggested Resources', + this.subwidget('Records', { /* ### config */ }))); - // More TRs for Articles, Books, News, Suggested Resources s.push('
'); - - s.push('
'); - s.push('
Topic Page: ### title
'); - s.push(this.subwidget('Reference')); - s.push('
'); - - s.push('
'); - s.push('
Images
'); - s.push(this.subwidget('Images', { /* ### config */ } )); - s.push('
'); - + s.push(section('encyclopaedia', 'Topic Page: ### title', + this.subwidget('Reference'))); + s.push(section('image', 'Images', + this.subwidget('Images', { /* ### config */ }))); s.push('
'); - - s.push('
'); - s.push('
Create a Mind Map for ### title
'); - // ### Is there a way to make a mind-map? - s.push('
'); - - s.push('
'); - s.push('
Related Topics
'); - s.push(this.subwidget('Facet', { facet: 'subject' })); - s.push('
'); - + s.push(section('mindmap', 'Create a Mind Map for ### title', + '### Is there a way to make a mind-map?')); + s.push(section('topics', 'Related Topics', + this.subwidget('Facet', { facet: 'subject' }))); s.push('
'); this.node.html(s.join('')); + + + function section(xclass, title, content) { + var s = []; + s.push('
'); + s.push('
' + title + '
'); + s.push('
' + content + '
'); + s.push('
'); + return s.join(''); + } + + function sectionRow(xclass, title, content) { + var s = []; + s.push(''); + s.push(''); + s.push(section(xclass, title, content)); + s.push(''); + s.push(''); + return s.join(''); + } });