Handle tool labels outside sections.

This commit is contained in:
Jeremy Goecks
2012-04-03 17:10:55 -04:00
parent 9e10f6b8f7
commit 8692f5a2e9
2 changed files with 30 additions and 3 deletions
+29 -2
View File
@@ -178,7 +178,13 @@ var ToolPanel = Backbone.Collection.extend({
clear_search_results: function() {
this.each(function(panel_elt) {
panel_elt.clear_search_results();
if (panel_elt instanceof ToolPanelSection) {
panel_elt.clear_search_results();
}
else {
// Label or tool, so just show.
panel_elt.show();
}
});
},
@@ -189,8 +195,24 @@ var ToolPanel = Backbone.Collection.extend({
return;
}
var cur_label = null;
this.each(function(panel_elt) {
panel_elt.apply_search_results(results);
if (panel_elt instanceof ToolPanelLabel) {
cur_label = panel_elt;
cur_label.hide();
}
else if (panel_elt instanceof Tool) {
if (panel_elt.apply_search_results(results)) {
if (cur_label) {
cur_label.show();
}
}
}
else {
// Starting new section, so clear current label.
cur_label = null;
panel_elt.apply_search_results(results);
}
});
}
});
@@ -358,6 +380,11 @@ var ToolPanelView = Backbone.View.extend({
tool_view.render();
this_el.append(tool_view.$el);
}
else if (panel_elt instanceof ToolPanelLabel) {
var label_view = new ToolPanelLabelView({model: panel_elt});
label_view.render();
this_el.append(label_view.$el);
}
});
return this;
},
File diff suppressed because one or more lines are too long