X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=tools%2Fhtdocs%2Fmkws.js;h=b6f0e0e3ffbe805d121514f06a51ed284d1f26e8;hb=42ca1c4a0ca09e45e4cc56e91f1cf69584839d94;hp=b3cd04a6c3616d5b288befa865c997b468d0985d;hpb=d253f36a0c449b2d933105421485daf6617022f6;p=mkws-moved-to-github.git diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index b3cd04a..b6f0e0e 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -158,21 +158,22 @@ function widget($, team, type, node) { var M = mkws.M; - if (type === 'Targets') { - promoteTargets(); - } else if (type === 'Stat') { - promoteStat(); - } else if (type === 'Termlists') { - promoteTermlists(); - } else if (type === 'Pager') { - promotePager(); - } else if (type === 'Records') { - promoteRecords(); + var type2fn = { + Targets: promoteTargets, + Stat: promoteStat, + Termlists: promoteTermlists, + Pager: promotePager, + Records: promoteRecords + }; + + var promote = type2fn[type]; + if (promote) { + promote(); + team.debug("made " + type + " widget(node=" + node + ")"); } else { - // ### Handle other types here + team.debug("made UNENCAPSULATED widget(type=" + type + ", node=" + node + ")"); } - team.debug("made widget(type=" + type + ", node=" + node); return that; @@ -355,7 +356,7 @@ function widget($, team, type, node) { // from the team object into this widget. if (hit.recid == team.currentRecordId()) { if (team.currentRecordData()) - html.push(renderDetails(team.currentRecordData())); + html.push(team.renderDetails(team.currentRecordData())); } } $(node).html(html.join('')); @@ -1069,6 +1070,7 @@ function team($, teamName) { var details = template(data); return '
' + details + '
'; } + that.renderDetails = renderDetails; function loadTemplate(name)