Browse Source

library changes reverse clicking from file to name

master
zeroth 5 years ago
parent
commit
2c39f2ddd3
  1. 4
      static/css/main.css
  2. 26
      templates/layout.html

4
static/css/main.css

@ -64,13 +64,13 @@ li a.nav-button {
z-index: 10000; z-index: 10000;
} }
span.librarian-names, a.file-names { span.librarian-names, span.file-names {
text-decoration: none; text-decoration: none;
padding: 0.3em; padding: 0.3em;
color: black; color: black;
} }
span.librarian-names:hover, a.file-names:hover { span.librarian-names:hover, span.file-names:hover {
color: white; color: white;
cursor: pointer; cursor: pointer;
} }

26
templates/layout.html

@ -11,6 +11,7 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$(".librarian-names").click(function(event){ $(".librarian-names").click(function(event){
var thename = $(this).text(); var thename = $(this).text();
$.getJSON('{{ url_for('static', filename='js/realjson.json') }}', function(test) { $.getJSON('{{ url_for('static', filename='js/realjson.json') }}', function(test) {
@ -29,6 +30,29 @@
alert(alldocs); alert(alldocs);
}); });
}); });
$(".file-names").click(function(event){
var thefile = $(this).text();
$.getJSON('{{ url_for('static', filename='js/realjson.json') }}', function(test) {
alert(thefile);
// iterate in test[i].librarian to find where the name is present
//to get the test[i].debris that goes with it
var allpeeps = [];
var category = null;
for (var i = 0; i < test.length; ++i) {
var item = test[i];
if(item.debris.includes(thefile)){
ledocument = item.librarian;
// alert(ledocument);
allpeeps.push(ledocument);
};
category = item.method;
};
alert(allpeeps);
alert(category);
});
});
}); });
</script> </script>
@ -54,7 +78,7 @@
<div class="file-names-container"> <div class="file-names-container">
{% for file in filetoname_dict %} {% for file in filetoname_dict %}
<a href="" class="file-names">{{file["debris"]}}</a><br> <span class="file-names">{{file["debris"]}}</span><br>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>

Loading…
Cancel
Save