summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-04-12 12:01:19 +0200
committerAlon Levy <alon@pobox.com>2015-04-12 12:01:19 +0200
commita62ac0625ed5b7846888029ea3946ebd6dd561e8 (patch)
tree680890e15c43975e8b37ffb614d5692533665b23
parentba1f6955be392947e3e1438250b3f5e272ee5ecc (diff)
client: show number of selected nodes below search bar
-rw-r--r--res/templates/index.html1
-rw-r--r--src/client/view/selection.js4
2 files changed, 4 insertions, 1 deletions
diff --git a/res/templates/index.html b/res/templates/index.html
index a1151228..04676ec7 100644
--- a/res/templates/index.html
+++ b/res/templates/index.html
@@ -71,6 +71,7 @@ var RZ_VERSION = '{% include "fragment/version.txt" %}';
<div class="input-container" id="input-container__search">
<input class="input-bar" tabindex="1" id="search" placeholder="Search for nodes or links"/>
<button tabindex="-1" id="btn_search"></button>
+ <div id="selection-count"></div>
<div id="search-suggestion" class="suggestion" style="display: none"></div>
</div>
<div class="input-container" id="input-container__graph-input">
diff --git a/src/client/view/selection.js b/src/client/view/selection.js
index 6a7fa01f..32d3230c 100644
--- a/src/client/view/selection.js
+++ b/src/client/view/selection.js
@@ -1,7 +1,8 @@
define(['Bacon', 'jquery', 'underscore', 'messages'],
function(Bacon, $, _, messages) {
-var rz_core; // circular dependency, see get_rz_core
+var rz_core, // circular dependency, see get_rz_core
+ selection_count_element = $('#selection-count');
function list_from_list_like(list_like)
{
@@ -115,6 +116,7 @@ function updateSelectedNodesBus(nodes, new_selected_nodes)
root_nodes__by_id = nodes_to_id_dict(nodes);
selected_nodes = new_selected_nodes;
selected_nodes__by_id = nodes_to_id_dict(selected_nodes);
+ selection_count_element.text(selected_nodes.length > 0 ? '' + nodes.length + ', ' + selected_nodes.length : '');
selectionChangedBus.push(new_selection(selected_nodes, root_nodes));
}