comparison ismi-python-neo4jrestclient/static/commentaries.html @ 37:7b5dcd3238d2

search field also accepts ismi_ids. display list of authors in head. display author name in title list.
author casties
date Thu, 04 Feb 2016 17:35:50 +0100
parents 810ea40a9ef8
children fee275163ff9
comparison
equal deleted inserted replaced
36:810ea40a9ef8 37:7b5dcd3238d2
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="jaghmini" placeholder="Search for person name" 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 name</button> 19 <button class="btn btn-default" type="submit">Search for author name or id</button>
20 </form> 20 </form>
21 </li> 21 </li>
22 </ul> 22 </ul>
23 </div> 23 </div>
24 <div class="navbar-header col-sm-6 col-md-6"> 24 <div class="navbar-header col-sm-6 col-md-6">
44 <span class="clickhide" style="display:none;">(click to show)</span> 44 <span class="clickhide" style="display:none;">(click to show)</span>
45 </div> 45 </div>
46 <table id="results" class="table table-striped table-hover"> 46 <table id="results" class="table table-striped table-hover">
47 <thead> 47 <thead>
48 <tr> 48 <tr>
49 <th>Author</th>
49 <th>Title (translit)</th> 50 <th>Title (translit)</th>
50 <th>Title (arabic)</th> 51 <th>Title (arabic)</th>
51 <th>ismi_id</th> 52 <th>ismi_id</th>
52 </tr> 53 </tr>
53 </thead> 54 </thead>
164 var t = $("table#results tbody").empty(); 165 var t = $("table#results tbody").empty();
165 if (!data || data.length == 0) return; 166 if (!data || data.length == 0) return;
166 // clear all marks 167 // clear all marks
167 $("#graph .marked").each(function(){this.classList.remove("marked")}); 168 $("#graph .marked").each(function(){this.classList.remove("marked")});
168 // fill table of titles 169 // fill table of titles
170 var authors = {};
169 data.forEach(function (row) { 171 data.forEach(function (row) {
170 var text = row.text; 172 var text = row.text;
171 var author = row.author; 173 var author = row.author;
172 $("#author").text("Titles by Author: "+author.label+" ["+author.ismi_id+"]"); 174 // collect authors
175 authors[author.ismi_id] = author;
173 var comm = row.is_commentary || row.has_commentaries; 176 var comm = row.is_commentary || row.has_commentaries;
174 var $row = $("<tr><td>" + text.label + "</td><td>" + text.full_title + "</td><td class='text_id'>" + text.ismi_id + "</td></tr>").appendTo(t) 177 var $row = $("<tr><td>" + author.label + "</td><td>" + text.label + "</td><td>" + text.full_title + "</td><td class='text_id'>" + text.ismi_id + "</td></tr>").appendTo(t)
175 .click(function() { showText($(this).find("td.text_id").text());}); 178 .click(function() { showText($(this).find("td.text_id").text());});
176 if (comm) { 179 if (comm) {
177 $row.addClass("marked"); 180 $row.addClass("marked");
178 } 181 }
179 // set mark 182 // set mark
180 $("#graph .ismi-"+text.ismi_id).each(function(){this.classList.add("marked")}); 183 $("#graph .ismi-"+text.ismi_id).each(function(){this.classList.add("marked")});
181 }); 184 });
185 var authorlist = "";
186 for (var a in authors) {
187 authorlist += (authorlist ? ", " : "") + authors[a].label + " ["+authors[a].ismi_id+"]";
188 }
189 $("#author").text("Titles by: "+authorlist);
182 if (!keep_detail_view) { 190 if (!keep_detail_view) {
183 // show first title in detail view 191 // show first title in detail view
184 showText(data[0].text.ismi_id); 192 showText(data[0].text.ismi_id);
185 } 193 }
186 }, "json"); 194 }, "json");