Commit 54e0298a authored by Citronalco's avatar Citronalco
Browse files

rename subjects to more calibre-like tags

fix javascript to work on my mobile phone
fix scroll-load-finished handling
parent c594fbf0
...@@ -108,8 +108,8 @@ def parse_metadata(metadata): ...@@ -108,8 +108,8 @@ def parse_metadata(metadata):
'series': series, 'series': series,
'series_index': series_index, 'series_index': series_index,
'subject': subject, 'tag': subject,
'subject_facet': subject, 'tag_facet': subject,
'abstract': description, 'abstract': description,
'abstract_output': description, 'abstract_output': description,
......
...@@ -225,8 +225,8 @@ ...@@ -225,8 +225,8 @@
<field name="series" type="text" indexed="true" stored="true"/> <field name="series" type="text" indexed="true" stored="true"/>
<field name="series_index" type="string" indexed="true" stored="true" /> <field name="series_index" type="string" indexed="true" stored="true" />
<field name="subject" type="text" indexed="true" stored="true" multiValued="true" /> <field name="tag" type="text" indexed="true" stored="true" multiValued="true" />
<field name="subject_facet" type="string" indexed="true" stored="false" multiValued="true" /> <field name="tag_facet" type="string" indexed="true" stored="false" multiValued="true" />
<field name="abstract" type="text" indexed="true" stored="false" multiValued="false" omitNorms="false" /> <field name="abstract" type="text" indexed="true" stored="false" multiValued="false" omitNorms="false" />
<field name="abstract_output" type="text" indexed="false" stored="true" /> <field name="abstract_output" type="text" indexed="false" stored="true" />
...@@ -277,7 +277,7 @@ ...@@ -277,7 +277,7 @@
<copyField source="series" dest="text" /> <copyField source="series" dest="text" />
<copyField source="series_index" dest="text" /> <copyField source="series_index" dest="text" />
<copyField source="author" dest="text" /> <copyField source="author" dest="text" />
<copyField source="subject" dest="text" /> <copyField source="tag" dest="text" />
<copyField source="publisher" dest="text" /> <copyField source="publisher" dest="text" />
<copyField source="identifier" dest="text" /> <copyField source="identifier" dest="text" />
<copyField source="filetype" dest="text" /> <copyField source="filetype" dest="text" />
......
...@@ -40,9 +40,9 @@ ...@@ -40,9 +40,9 @@
Kennungen: Kennungen:
<ul>{{{identifiers}}}</ul> <ul>{{{identifiers}}}</ul>
</div> </div>
<div class="booksubjects"> <div class="booktags">
Schlagwörter: Schlagwörter:
<ul>{{{subjects}}}</ul> <ul>{{{tags}}}</ul>
</div> </div>
<div class="bookpublisher"> <div class="bookpublisher">
Herausgeber: Herausgeber:
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
}); });
function get_ebooks(start_pos) { function get_ebooks(start_pos) {
if(query) { if (query) {
$('#status').removeClass('error').text('Suche läuft...'); $('#status').removeClass('error').text('Suche läuft...');
$.getJSON(solr_url_prefix + '/?q=' + encodeURIComponent(query) + '&wt=json&rows=' + query_limit + '&start=' + start_pos, function(data) { $.getJSON(solr_url_prefix + '/?q=' + encodeURIComponent(query) + '&wt=json&rows=' + query_limit + '&start=' + start_pos, function(data) {
if (data['responseHeader']['status'] != 0) { if (data['responseHeader']['status'] != 0) {
...@@ -110,6 +110,7 @@ ...@@ -110,6 +110,7 @@
} }
var template = $('#template-bookitem').html(); // load template var template = $('#template-bookitem').html(); // load template
$.each(data['response']['docs'], function(key, val) { // fill template for each book $.each(data['response']['docs'], function(key, val) { // fill template for each book
// Book URL // Book URL
var bookurl = calibre_url_prefix + '/' + val['path'] + '/' +val['filename'] var bookurl = calibre_url_prefix + '/' + val['path'] + '/' +val['filename']
...@@ -128,33 +129,32 @@ ...@@ -128,33 +129,32 @@
// Book Author // Book Author
var bookauthors=''; var bookauthors='';
if (val['author']) { if (val['author']) {
for (let i of val['author']) { for (var i=0;i<val['author'].length;i++) {
bookauthors += '<li>' + htmlEncode(i) + '</li>'; bookauthors += '<li>' + htmlEncode(val['author'][i]) + '</li>';
} }
} }
// Book Subjects // Book Tags
var booksubjects=''; var booktags='';
if (val['subject']) { if (val['tag']) {
for (let i of val['subject']) { for (var i=0;i<val['tag'].length;i++) {
booksubjects += '<li>' + htmlEncode(i) + '</li>'; booktags += '<li>' + htmlEncode(val['tag'][i]) + '</li>';
} }
} }
// Book Identifiers // Book Identifiers
var bookidentifiers=''; var bookidentifiers='';
if (val['identifier']) { if (val['identifier']) {
for (let i of val['identifier']) { for (var i=0;i<val['identifier'].length;i++) {
if (i.substr(0,5)=='uuid:') { continue; } // skip calibre uuid if (val['identifier'][i].substr(0,5)=='uuid:') { continue; } // skip calibre uuid
bookidentifiers += '<li>' + htmlEncode(i) + '</li>'; bookidentifiers += '<li>' + htmlEncode(val['identifier'][i]) + '</li>';
} }
} }
// Book Languages // Book Languages
var booklanguages=''; var booklanguages='';
if (val['language']) { if (val['language']) {
for (let i of val['language']) { for (var i=0;i<val['language'].length;i++) {
booklanguages += '<li>' + htmlEncode(i) + '</li>'; booklanguages += '<li>' + htmlEncode(val['language'][i]) + '</li>';
} }
} }
...@@ -187,7 +187,7 @@ ...@@ -187,7 +187,7 @@
coverurl: coverurl, coverurl: coverurl,
title: booktitle, title: booktitle,
authors: bookauthors, authors: bookauthors,
subjects: booksubjects, tags: booktags,
identifiers: bookidentifiers, identifiers: bookidentifiers,
series: bookseries, series: bookseries,
date: bookdate, date: bookdate,
...@@ -198,12 +198,13 @@ ...@@ -198,12 +198,13 @@
var bookdetails = Mustache.render(template,bookdata); // fill template with values var bookdetails = Mustache.render(template,bookdata); // fill template with values
$('#booklist').append(bookdetails).children(':last').hide().fadeIn(1000); // append book to booklist $('#booklist').append(bookdetails).children(':last').hide().fadeIn(1000); // append book to booklist
scroll_load_finished = true;
}); });
} }
}).fail(function() { }).fail(function() {
$('#status').addClass('error').text('Fehler'); $('#status').addClass('error').text('Fehler');
}); });
scroll_load_finished = true;
} }
} }
...@@ -260,7 +261,7 @@ ...@@ -260,7 +261,7 @@
}); });
// search button // search button
$('#searchform').submit(function(ev) { $('#searchform').on("submit",function(e) {
query = $('input#solr_query').val(); query = $('input#solr_query').val();
get_ebooks(start_pos=0); get_ebooks(start_pos=0);
return false; return false;
...@@ -314,7 +315,7 @@ ...@@ -314,7 +315,7 @@
</script> </script>
<div id="searchcontainer"> <div id="searchcontainer">
<form id="searchform" method="post"> <form id="searchform">
<div id="querybar"> <div id="querybar">
<div id="querystring"> <div id="querystring">
<label for="solr_query">SOLR Query</label> <label for="solr_query">SOLR Query</label>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment