Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions homer/web/js/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var getResultRenderer = function(kind) {
if (resultRenderers[kind]) {
return resultRenderers[kind];
}
console.log("Falling back to default for "+kind);
return resultRenderers["default"];
};
/** This is the default, plain result renderer */
Expand Down
22 changes: 15 additions & 7 deletions homer/web/js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ queryBox.keypress(function(e)
if (e.keyCode == 13)
handleEnter();
});

// UI object/namespace
var UI = {};
UI.generateButtons = function() {


API.getKinds({}, function(data) {
UI.defaultKind = data.defaultKind;
var availableKinds = _(data.kinds);
Expand Down Expand Up @@ -70,11 +72,11 @@ UI.setQuery = function(q) {
/**
* Render a single search result.
* @see render.js
* I'm adding comments now since i regret it
* when I dont
* deleted UI.makeResult since its useless.

*/
UI.makeResult = function(queryTerms, result) {
var renderer = getResultRenderer(result.viewKind);
return '<div class="result">' + renderer(queryTerms, result) + '</div>';
};

// added labels to our button bar when they add a new one

Expand Down Expand Up @@ -115,8 +117,14 @@ UI.appendResults = function(queryTerms, results, usingLabels) {

UI.showProgress("Ajax response received!");
_(results).forEach(function(result) {
console.debug("result name: " + result.name);
resultsDiv.append(UI.makeResult(queryTerms, result));
console.debug("result nAME: " + result.name);
var renderer = getResultRenderer(result.viewKind); //added this line and 5 below make adding/subt elements in future easier
var resDiv = $('<div>');
resDiv.attr('class', 'result');
resDiv.attr('id',result.name);
$(resDiv).append(renderer(queryTerms, result));
resultsDiv.append(resDiv); //* 6/26/2014

var tagName = "#tags_" + result.name;
$(tagName).tagit({
availableTags: GLOBAL.uniqTypes,
Expand Down Expand Up @@ -298,4 +306,4 @@ UI.clearSelectedLabels = function() {
$("#multiselect-" + i).multiselect('refresh'); // this clears the "select all" option
i += 1;
});
};
};