Mercurial > hg > NetworkVis
comparison ismi-python-neo4jrestclient/static/commentaries.html @ 31:a6b2a09ea413
fix commentary chain visualisation author name display and search by clicking author name.
| author | casties |
|---|---|
| date | Fri, 11 Dec 2015 17:06:26 -0500 |
| parents | eb0be386736f |
| children | 9f0d4fd3a412 |
comparison
equal
deleted
inserted
replaced
| 30:cccbcc845d54 | 31:a6b2a09ea413 |
|---|---|
| 12 <div class="col-sm-6 col-md-6"> | 12 <div class="col-sm-6 col-md-6"> |
| 13 <ul class="nav navbar-nav"> | 13 <ul class="nav navbar-nav"> |
| 14 <li> | 14 <li> |
| 15 <form role="search" class="navbar-form" id="search"> | 15 <form role="search" class="navbar-form" id="search"> |
| 16 <div class="form-group"> | 16 <div class="form-group"> |
| 17 <input type="text" value="7437" placeholder="Search for person-id" class="form-control" name="search"> | 17 <input type="text" value="jaghmini" placeholder="Search for person name" class="form-control" name="search"> |
| 18 </div> | 18 </div> |
| 19 <button class="btn btn-default" type="submit">Search for author id</button> | 19 <button class="btn btn-default" type="submit">Search for author id</button> |
| 20 </form> | 20 </form> |
| 21 </li> | 21 </li> |
| 22 </ul> | 22 </ul> |
| 112 $(".panel-heading").on("click", function() { | 112 $(".panel-heading").on("click", function() { |
| 113 $(this).find(".clickhide").toggle(); | 113 $(this).find(".clickhide").toggle(); |
| 114 $(this).next().slideToggle(); | 114 $(this).next().slideToggle(); |
| 115 }); | 115 }); |
| 116 // provide search and graph | 116 // provide search and graph |
| 117 backendApiPrefix = "/netvis-ismi"; | 117 backendApiPrefix = ""; |
| 118 searchApi = {}; | 118 searchApi = {}; |
| 119 $(function () { | 119 $(function () { |
| 120 function showText(text_id) { | 120 function showText(text_id) { |
| 121 $.get(backendApiPrefix+"/textandcommentaries/" + encodeURIComponent(text_id), | 121 $.get(backendApiPrefix+"/textandcommentaries/" + encodeURIComponent(text_id), |
| 122 function (data) { | 122 function (data) { |
| 123 if (!data) return; | 123 if (!data) return; |
| 124 $("#title").text("Title: "+data.title); | 124 $("#title").text("Title: "+data.title); |
| 125 var $list = $("#info").empty(); | 125 var $list = $("#info").empty(); |
| 126 $list.append($("<li>Author: " + data.author.label + " [" + data.author.ismi_id + "]</li>") | 126 $list.append($("<li>Author: " + data.author.label + " [" + data.author.ismi_id + "]</li>") |
| 127 .click(function() { | 127 .click(function() { |
| 128 search(data.author.ismi_id, true); | 128 search(data.author.label, true); |
| 129 })); | 129 })); |
| 130 for (var key in data.attrs) { | 130 for (var key in data.attrs) { |
| 131 if (key[0] === "_") continue; | |
| 131 var val = data.attrs[key]; | 132 var val = data.attrs[key]; |
| 132 if (key === "link") { | 133 if (key === "link") { |
| 133 val = "<a href=\"" + val + "\" target=\"_blank\">" + val + "</a>"; | 134 val = "<a href=\"" + val + "\" target=\"_blank\">" + val + "</a>"; |
| 134 } | 135 } |
| 135 $list.append($("<li>" + key + ": " + val + "</li>")); | 136 $list.append($("<li>" + key + ": " + val + "</li>")); |
| 177 } | 178 } |
| 178 // set mark | 179 // set mark |
| 179 $("#graph .ismi-"+text.ismi_id).each(function(){this.classList.add("marked")}); | 180 $("#graph .ismi-"+text.ismi_id).each(function(){this.classList.add("marked")}); |
| 180 }); | 181 }); |
| 181 if (!keep_detail_view) { | 182 if (!keep_detail_view) { |
| 182 // show first title | 183 // show first title in detail view |
| 183 showText(data[0].text.ismi_id); | 184 showText(data[0].text.ismi_id); |
| 184 } | 185 } |
| 185 }, "json"); | 186 }, "json"); |
| 186 return false; | 187 return false; |
| 187 } | 188 } |
