From: Jason Skomorowski Date: Mon, 7 Jul 2014 23:53:47 +0000 (-0400) Subject: Tidy up bootstrap example. X-Git-Tag: 1.0.0~324^2~57 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=3c89b69ca104e7a52af85835b3187b717e29d847;p=mkws-moved-to-github.git Tidy up bootstrap example. --- diff --git a/examples/htdocs/mkws-widget-credo-bs.js b/examples/htdocs/mkws-widget-credo-bs.js deleted file mode 100644 index 49651ea..0000000 --- a/examples/htdocs/mkws-widget-credo-bs.js +++ /dev/null @@ -1,109 +0,0 @@ -// The Google Images database returns links like: -// http://images.google.com/url?q=http://eofdreams.com/fish.html&sa=U&ei=RAB-U9XNDo2Dqga1o4L4Bw&ved=0CC4Q9QEwAA&usg=AFQjCNFhRtn6GMevHbpITZ6kfx6rsHV2ow -// This Handlebars helper avoids a pointless redirect by transforming -// this to the URL of the underling page, in this case -// http://eofdreams.com/fish.html -// -Handlebars.registerHelper('mkws-googleurl', function(obj) { - if (!obj) { - return "obj undefined"; - } else if (!obj[0]) { - return "obj[0] undefined, JSON=" + $.toJSON(obj); - } else { - return mkws.getParameterByName('q', obj[0]); - } -}); - - -// ### This works inefficiently by having multiple teams all run the -// same search against different sets of targets. A much better -// approach would be run a single search, with all these panels -// members of the same team, but picking out only the results relevant -// to them. That will be more work. - -mkws.registerWidgetType('Credo', function() { - var that = this; - - this.team.registerTemplate('CredoImage', '\ -
\ - \ - {{#mkws-first md-thumburl}}\ - {{../md-title}}\ - {{/mkws-first}}\ -
\ -
\ -

{{{md-title}}}

\ -
\ -'); - - var s = [] - // Main panel: encylopaedia and images on the left, topics on the right - s.push('
'); - - s.push('
'); - //s.push(section('encyclopaedia', 'Topic Page: ', - s.push(this.subwidget('Reference', { _team: 'ref', paragraphs: 1 })); - // The Images widget needs to be in our team so we can set its template - s.push('
'); - - s.push('
'); - s.push(section('topics', 'Related Topics', - this.subwidget('Facet', { _team: 'main', facet: 'subject' }))); - s.push('
'); - - s.push('
'); - - s.push('
'); - s.push(section('image col-md-12', 'Images', this.subwidget('GoogleImage', { maxrecs: 4, template: 'CredoImage', target: 'google_images_js' }))); - s.push('
'); - - - s.push('
'); - s.push(section('entries clearfix col-md-4 col-sm-6', 'News', - this.subwidget('Records', { _team: 'news', targetfilter: 'categories=news', perpage: 10 }))); - s.push(section('articles clearfix col-md-4 col-sm-6', 'Articles', - this.subwidget('Records', { _team: 'articles', targetfilter: 'categories=articles', perpage: 10 }))); - s.push(section('books clearfix col-md-4 col-sm-6', 'Books', - this.subwidget('Records', { _team: 'books', targetfilter: 'categories=books', perpage: 10 }))); - s.push(section('news col-md-4 col-sm-6', 'Results from all targets', - this.subwidget('Records', { _team: 'main' }))); - s.push('
'); - this.node.html(s.join('')); - - // Fill in the titles from the query once widgets have all been prepared - var that = this; - this.team.queue("ready").subscribe(function() { - var query = toTitleCase(that.config.query); - that.log("got query '" + query + "' from team config"); - mkws.$('.x-mkws-title').html(query); - mkws.$('title').html("MKWS: " + query); - - mkws.$(".mkwsSummary img").addClass("media-object"); - console.log(mkws.$("body").html()); - - // Derived from http://stackoverflow.com/questions/196972/convert-string-to-title-case-with-javascript - function toTitleCase(str) { - return str.replace(/\w\S*/g, function(txt) { - return txt.charAt(0).toUpperCase() + txt.substr(1); - }); - } - }); - - - 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(section(xclass, title, content)); - s.push('
'); - return s.join(''); - } -}); diff --git a/examples/htdocs/ref-bootstrap.html b/examples/htdocs/ref-bootstrap.html deleted file mode 100644 index 503a8fe..0000000 --- a/examples/htdocs/ref-bootstrap.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - MKWS demo: Compound reference widget - - - - - - - - - - - - - - - diff --git a/examples/htdocs/topic-bootstrap-reorganise.html b/examples/htdocs/topic-bootstrap-reorganise.html deleted file mode 100644 index 4cb3e7d..0000000 --- a/examples/htdocs/topic-bootstrap-reorganise.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - MKWS demo: Compound reference widget, Bootstrap edition - - - - - - - - - - - - - - - - diff --git a/examples/htdocs/topic-bootstrap.html b/examples/htdocs/topic-bootstrap.html index 7c11553..d72aa70 100644 --- a/examples/htdocs/topic-bootstrap.html +++ b/examples/htdocs/topic-bootstrap.html @@ -16,8 +16,8 @@ - - + +