diff options
| author | Alon Levy <alon@pobox.com> | 2015-02-06 11:50:52 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-02-06 11:50:52 +0200 |
| commit | b6756b8dd1aad3de178201d98a7980a4479c2b8a (patch) | |
| tree | 42baf6212633fe1bb0dbc9e3b8a9ed2cfa99c0cd | |
| parent | b1bcd4818c9f90e23879bdb22421b6d351452f64 (diff) | |
client/graph_view: filter drop down implementation, really ugly. #306
| -rw-r--r-- | res/templates/index.html | 12 | ||||
| -rw-r--r-- | src/client/view/graph_view.js | 13 |
2 files changed, 14 insertions, 11 deletions
diff --git a/res/templates/index.html b/res/templates/index.html index 19ca7152..f52ac89b 100644 --- a/res/templates/index.html +++ b/res/templates/index.html @@ -28,20 +28,20 @@ </div> <div style="right: 200px; position: absolute;"> <ul class="dropdown-menu"> - <li class="dropdown-item dropdown-menu-heading">Filter by Type</li> - <li class="dropdown-item dropdown-item-type dropdown-item-type-person"> + <li class="dropdown-item dropdown-menu-heading">Filter by node type</li> + <li class="dropdown-item dropdown-item-type dropdown-item-type-person" style="display:none"> <label><input type="checkbox" checked="checked" name="interest">Interest</label> </li> - <li class="dropdown-item dropdown-item-type dropdown-item-type dropdown-item-type-Skill"> + <li class="dropdown-item dropdown-item-type dropdown-item-type dropdown-item-type-Skill" style="display:none"> <label><input type="checkbox" checked="checked" name="skill">Skill</label> </li> - <li class="dropdown-item dropdown-item-type dropdown-item-type-Club"> + <li class="dropdown-item dropdown-item-type dropdown-item-type-Club" style="display:none"> <label><input type="checkbox" checked="checked" name="club">Club</label> </li> - <li class="dropdown-item dropdown-item-type dropdown-item-type-person"> + <li class="dropdown-item dropdown-item-type dropdown-item-type-person" style="display:none"> <label><input type="checkbox" checked="checked" name="person">Person</label> </li> - <li class="dropdown-item dropdown-item-type dropdown-item-type-Internship-proposal"> + <li class="dropdown-item dropdown-item-type dropdown-item-type-Internship-proposal" style="display:none"> <label><input type="checkbox" checked="checked" name="internship-proposal">Intership Proposal</label> </li> </ul> diff --git a/src/client/view/graph_view.js b/src/client/view/graph_view.js index 0b9bf62b..d1e8ba40 100644 --- a/src/client/view/graph_view.js +++ b/src/client/view/graph_view.js @@ -121,11 +121,14 @@ function GraphView(spec) { function redraw__set_on_checkbox_change() { var checkboxes = $('.dropdown-item label input').asEventStream('click').onValue(function (_) { - read_checkboxes(); - console.log(filter_states); - update_view(true); - } - ); + read_checkboxes(); + console.log(filter_states); + update_view(true); + }); + $('.dropdown-item.dropdown-menu-heading').asEventStream('click').onValue(function (_) { + var hidden = $('.dropdown-item.dropdown-item-type[style="display:none"]').length > 0; + $('.dropdown-item.dropdown-item-type').attr('style', 'display:' + (hidden ? '' : 'none')); + }) } function node__is_shown(d) { |
