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