X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=blobdiff_plain;f=src%2Fmkws-widget-main.js;h=5438348ca3ef04a95c352cdc9c9d3bc4f6ac6021;hp=8a51a4dba10bfeb6f3a7be870a38601f6baf7b7b;hb=fedd5ca7b6f69684e6c59cec1c92e82952cafa9c;hpb=f89028d68a7b765084d35a3175f9d92d5ffc97cd diff --git a/src/mkws-widget-main.js b/src/mkws-widget-main.js index 8a51a4d..5438348 100644 --- a/src/mkws-widget-main.js +++ b/src/mkws-widget-main.js @@ -19,6 +19,7 @@ mkws.registerWidgetType('targets', function() { var cleandata = []; for (var i = 0; i < data.length; i++) { var cur = {}; + cur.name = data[i].name; cur.id = data[i].id; cur.hits = data[i].hits; cur.diagnostic = data[i].diagnostic; @@ -28,6 +29,8 @@ mkws.registerWidgetType('targets', function() { cleandata.push(cur); } + cleandata.sort(function(a,b) { return a.name.localeCompare(b.name) }); + var template = that.team.loadTemplate(that.config.template || "targets"); that.node.html(template({data: cleandata})); }); @@ -56,7 +59,7 @@ mkws.registerWidgetType('pager', function() { output.found = data.total; //client indexes pages from 1 but pz2 from 0 - var onsides = 6; + var onsides = 5; var pages = Math.ceil(that.team.totalRecordCount() / that.team.perpage()); var currentPage = that.team.currentPage(); @@ -100,13 +103,11 @@ mkws.registerWidgetType('details', function() { }); } this.team.queue("record").subscribe(function(data) { - console.log(data); if ($.inArray(recid, data.recid) > -1) { var template = that.team.loadTemplate(that.config.template || "details"); that.node.html(template(data)); } }); - that.autosearch(); }); mkws.registerWidgetType('records', function() { @@ -116,7 +117,6 @@ mkws.registerWidgetType('records', function() { this.team.queue("records").subscribe(function(data) { for (var i = 0; i < data.hits.length; i++) { var hit = data.hits[i]; - that.team.queue("record").publish(hit); hit.detailLinkId = team.recordElementId(hit.recid[0]); hit.detailClick = "mkws.showDetails('" + team.name() + "', '" + hit.recid[0] + "');return false;"; hit.containerClass = "mkws-summary mkwsSummary mkws-team-" + team.name(); @@ -131,7 +131,7 @@ mkws.registerWidgetType('records', function() { } } var template = team.loadTemplate(that.config.template || "records"); - var summaryPartial = team.loadTemplate("summary"); + var summaryPartial = team.loadTemplate(that.config['summary-template'] || "summary"); var tdata = $.extend({}, {"hits": data.hits}, that.config.template_vars); that.node.html(template(tdata, {"partials":{"summary":summaryPartial}})); }); @@ -144,7 +144,7 @@ mkws.registerWidgetType('navi', function() { var that = this; var teamName = this.team.name(); - this.team.queue("navi").subscribe(function() { + this.team.queue("searchtriggered").subscribe(function() { var filters = that.team.filters(); var output = {filters:[]}; @@ -223,7 +223,6 @@ mkws.registerWidgetType('switch', function() { mkws.registerWidgetType('search', function() { var output = {}; output.team = this.team.name(); - output.queryWidth = this.config.query_width; var template = this.team.loadTemplate(this.config.template || "search"); this.node.html(template(output)); }); @@ -255,7 +254,7 @@ mkws.registerWidgetType('ranking', function() { output.showPerPage = this.config.show_perpage; var order = this.team.sortOrder(); - this.log("making sort, sortOrder = '" + order + "'"); + this.info("making sort, sortOrder = '" + order + "'"); for (var i = 0; i < this.config.sort_options.length; i++) { var cur = {}; var opt = this.config.sort_options[i]; @@ -266,7 +265,7 @@ mkws.registerWidgetType('ranking', function() { } var perpage = this.team.perpage(); - this.log("making perpage, perpage = " + perpage); + this.info("making perpage, perpage = " + perpage); for(var i = 0; i < this.config.perpage_options.length; i++) { var cur = {}; cur.perPage = this.config.perpage_options[i]; @@ -289,7 +288,7 @@ mkws.registerWidgetType('lang', function() { var list = []; /* display a list of configured languages, or all */ - var lang_options = this.config.lang_options || []; + var lang_options = this.config.lang_options; var toBeIncluded = {}; for (var i = 0; i < lang_options.length; i++) { toBeIncluded[lang_options[i]] = true; @@ -314,7 +313,7 @@ mkws.registerWidgetType('lang', function() { list.push(cur); } - this.log("language menu: " + list.join(", ")); + this.info("language menu: " + list.join(", ")); var template = this.team.loadTemplate(this.config.template || "lang"); this.node.html(template({languages: list})); @@ -359,7 +358,7 @@ mkws.registerWidgetType('config', function() { for (var name in c) { if (c.hasOwnProperty(name)) { this.team.config[name] = c[name]; - this.log(this + " copied property " + name + "='" + c[name] + "' up to team"); + this.info(this + " copied property " + name + "='" + c[name] + "' up to team"); } } });