pull/350/head
OzzieIsaacs 7 years ago
parent 031a175474
commit c56a02bab6

@ -39,7 +39,7 @@
<p class="title">{{entry.title|shortentitle}}</p> <p class="title">{{entry.title|shortentitle}}</p>
<p class="author"> <p class="author">
{% for author in entry.authors %} {% for author in entry.authors %}
<a href="{{url_for('author', book_id=author.id) }}">{{author.name}}</a> <a href="{{url_for('author', book_id=author.id) }}">{{author.name.replace('|',',')}}</a>
{% if not loop.last %} {% if not loop.last %}
&amp; &amp;
{% endif %} {% endif %}
@ -66,7 +66,7 @@
{% if other_books %} {% if other_books %}
<div class="discover"> <div class="discover">
<h3>{{_("More by")}} {{ author.name|safe }}</h3> <h3>{{_("More by")}} {{ author.name.replace('|',',')|safe }}</h3>
<div class="row"> <div class="row">
{% for entry in other_books %} {% for entry in other_books %}
<div class="col-sm-3 col-lg-2 col-xs-6 book"> <div class="col-sm-3 col-lg-2 col-xs-6 book">
@ -80,7 +80,7 @@
<p class="author"> <p class="author">
{% for author in entry.authors %} {% for author in entry.authors %}
<a href="https://www.goodreads.com/author/show/{{ author.gid }}" target="_blank" rel="noopener"> <a href="https://www.goodreads.com/author/show/{{ author.gid }}" target="_blank" rel="noopener">
{{author.name}} {{author.name.replace('|',',')}}
</a> </a>
{% if not loop.last %} {% if not loop.last %}
&amp; &amp;

@ -62,7 +62,7 @@
<h2>{{entry.title}}</h2> <h2>{{entry.title}}</h2>
<p class="author"> <p class="author">
{% for author in entry.authors %} {% for author in entry.authors %}
<a href="{{url_for('author', book_id=author.id ) }}">{{author.name}}</a> <a href="{{url_for('author', book_id=author.id ) }}">{{author.name.replace('|',',')}}</a>
{% if not loop.last %} {% if not loop.last %}
&amp; &amp;
{% endif %} {% endif %}

@ -56,7 +56,7 @@
<p class="title">{{entry.title|shortentitle}}</p> <p class="title">{{entry.title|shortentitle}}</p>
<p class="author"> <p class="author">
{% for author in entry.authors %} {% for author in entry.authors %}
<a href="{{url_for('author', book_id=author.id) }}">{{author.name}}</a> <a href="{{url_for('author', book_id=author.id) }}">{{author.name.replace('|',',')}}</a>
{% if not loop.last %} {% if not loop.last %}
&amp; &amp;
{% endif %} {% endif %}

@ -41,7 +41,7 @@
"rating":{% if entry.ratings.__len__() > 0 %} "{{entry.ratings[0].rating}}.0"{% else %}0.0{% endif %}, "rating":{% if entry.ratings.__len__() > 0 %} "{{entry.ratings[0].rating}}.0"{% else %}0.0{% endif %},
"authors": [ "authors": [
{% for author in entry.authors %} {% for author in entry.authors %}
"{{author.name}}"{% if not loop.last %},{% endif %} "{{author.name.replace('|',',')}}"{% if not loop.last %},{% endif %}
{% endfor %} {% endfor %}
], ],
"other_formats": { "other_formats": {
@ -51,4 +51,4 @@
{% endfor %} {% endfor %}
{% endif %} }, {% endif %} },
"title_sort": "{{entry.sort}}" "title_sort": "{{entry.sort}}"
} }

@ -24,7 +24,7 @@
<p class="title">{{entry.title|shortentitle}}</p> <p class="title">{{entry.title|shortentitle}}</p>
<p class="author"> <p class="author">
{% for author in entry.authors %} {% for author in entry.authors %}
<a href="{{url_for('author', book_id=author.id ) }}">{{author.name}}</a> <a href="{{url_for('author', book_id=author.id ) }}">{{author.name.replace('|',',')}}</a>
{% if not loop.last %} {% if not loop.last %}
&amp; &amp;
{% endif %} {% endif %}

@ -24,7 +24,7 @@
<p class="title">{{entry.title|shortentitle}}</p> <p class="title">{{entry.title|shortentitle}}</p>
<p class="author"> <p class="author">
{% for author in entry.authors %} {% for author in entry.authors %}
<a href="{{url_for('author', book_id=author.id) }}">{{author.name}}</a> <a href="{{url_for('author', book_id=author.id) }}">{{author.name.replace('|',',')}}</a>
{% if not loop.last %} {% if not loop.last %}
&amp; &amp;
{% endif %} {% endif %}

@ -1122,6 +1122,8 @@ def author_list():
entries = db.session.query(db.Authors, func.count('books_authors_link.book').label('count'))\ entries = db.session.query(db.Authors, func.count('books_authors_link.book').label('count'))\
.join(db.books_authors_link).join(db.Books).filter(common_filters())\ .join(db.books_authors_link).join(db.Books).filter(common_filters())\
.group_by('books_authors_link.author').order_by(db.Authors.sort).all() .group_by('books_authors_link.author').order_by(db.Authors.sort).all()
for entry in entries:
entry.Authors.name=entry.Authors.name.replace('|',',')
return render_title_template('list.html', entries=entries, folder='author', title=_(u"Author list")) return render_title_template('list.html', entries=entries, folder='author', title=_(u"Author list"))
@ -1135,7 +1137,7 @@ def author(book_id, page):
flash(_(u"Error opening eBook. File does not exist or file is not accessible:"), category="error") flash(_(u"Error opening eBook. File does not exist or file is not accessible:"), category="error")
return redirect(url_for("index")) return redirect(url_for("index"))
name = db.session.query(db.Authors).filter(db.Authors.id == book_id).first().name name = (db.session.query(db.Authors).filter(db.Authors.id == book_id).first().name).replace('|',',')
author_info = None author_info = None
other_books = [] other_books = []
@ -2740,7 +2742,7 @@ def edit_book(book_id):
except Exception: except Exception:
book.languages[index].language_name = _(isoLanguages.get(part3=book.languages[index].lang_code).name) book.languages[index].language_name = _(isoLanguages.get(part3=book.languages[index].lang_code).name)
for author in book.authors: for author in book.authors:
author_names.append(author.name) author_names.append(author.name.replace('|',','))
# Show form # Show form
if request.method != 'POST': if request.method != 'POST':
@ -2783,7 +2785,7 @@ def edit_book(book_id):
book.title = to_save["book_title"] book.title = to_save["book_title"]
edited_books_id.add(book.id) edited_books_id.add(book.id)
input_authors = to_save["author_name"].split('&') input_authors = to_save["author_name"].split('&')
input_authors = map(lambda it: it.strip(), input_authors) input_authors = map(lambda it: it.strip().replace(',','|'), input_authors)
# we have all author names now # we have all author names now
if input_authors == ['']: if input_authors == ['']:
input_authors = [_(u'unknown')] # prevent empty Author input_authors = [_(u'unknown')] # prevent empty Author

Loading…
Cancel
Save