From b8b83eb490e89e99620c933648147e11af9c0e12 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Mon, 19 May 2014 17:10:32 +0100 Subject: [PATCH] Rolling on the Credo JS. --- examples/htdocs/mkws-widget-credo.js | 74 +++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 33 deletions(-) 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(''); + } }); -- 1.7.10.4