Commit da3fcb9a authored by Ozzieisaacs's avatar Ozzieisaacs

Merge branch 'master' into Develop

# Conflicts:
#	cps/book_formats.py
#	cps/static/css/style.css
#	cps/static/js/uploadprogress.js
#	cps/templates/author.html
#	cps/templates/detail.html
#	cps/templates/discover.html
#	cps/templates/index.html
#	cps/templates/layout.html
#	cps/templates/osd.xml
#	cps/templates/search.html
#	cps/templates/shelf.html
#	cps/translations/de/LC_MESSAGES/messages.mo
#	cps/translations/de/LC_MESSAGES/messages.po
#	cps/web.py
#	messages.pot
parents 9144a7ce 76d40411
...@@ -36,6 +36,11 @@ a{color: #45b29d}a:hover{color: #444;} ...@@ -36,6 +36,11 @@ a{color: #45b29d}a:hover{color: #444;}
.container-fluid .book .meta .title{font-weight:bold;font-size:15px;color:#444} .container-fluid .book .meta .title{font-weight:bold;font-size:15px;color:#444}
.container-fluid .book .meta .author{font-size:12px;color:#999} .container-fluid .book .meta .author{font-size:12px;color:#999}
.container-fluid .book .meta .rating{margin-top:5px}.rating .glyphicon-star{color:#999}.rating .glyphicon-star.good{color:#45b29d} .container-fluid .book .meta .rating{margin-top:5px}.rating .glyphicon-star{color:#999}.rating .glyphicon-star.good{color:#45b29d}
.container-fluid .author .author-hidden, .container-fluid .author .author-hidden-divider {
display: none;
}
.navbar-brand{font-family: 'Grand Hotel', cursive; font-size: 35px; color: #45b29d !important;} .navbar-brand{font-family: 'Grand Hotel', cursive; font-size: 35px; color: #45b29d !important;}
.more-stuff{margin-top: 20px; padding-top: 20px; border-top: 1px solid #ccc} .more-stuff{margin-top: 20px; padding-top: 20px; border-top: 1px solid #ccc}
.more-stuff>li{margin-bottom: 10px;} .more-stuff>li{margin-bottom: 10px;}
...@@ -52,6 +57,7 @@ span.glyphicon.glyphicon-tags {padding-right: 5px;color: #999;vertical-align: te ...@@ -52,6 +57,7 @@ span.glyphicon.glyphicon-tags {padding-right: 5px;color: #999;vertical-align: te
-moz-box-shadow: 0 5px 8px -6px #777; -moz-box-shadow: 0 5px 8px -6px #777;
box-shadow: 0 5px 8px -6px #777; box-shadow: 0 5px 8px -6px #777;
} }
.navbar-default .navbar-toggle .icon-bar {background-color: #000;} .navbar-default .navbar-toggle .icon-bar {background-color: #000;}
.navbar-default .navbar-toggle {border-color: #000;} .navbar-default .navbar-toggle {border-color: #000;}
.cover { margin-bottom: 10px;} .cover { margin-bottom: 10px;}
...@@ -131,3 +137,8 @@ input.pill:not(:checked) + label .glyphicon { ...@@ -131,3 +137,8 @@ input.pill:not(:checked) + label .glyphicon {
.editable-submit { margin-bottom: 0px !important;} .editable-submit { margin-bottom: 0px !important;}
.filterheader { margin-bottom: 20px; } .filterheader { margin-bottom: 20px; }
.modal-body .comments {
max-height:300px;
overflow-y: auto;
}
@media (min-device-width: 768px) { @media (min-device-width: 768px) {
.modal-dialog { .upload-modal-dialog {
position: absolute; position: absolute;
top: 45%; top: 45%;
left: 50%; left: 50%;
......
...@@ -411,8 +411,8 @@ $( 'div.comments' ).readmore( { ...@@ -411,8 +411,8 @@ $( 'div.comments' ).readmore( {
collapsedHeight: 134, collapsedHeight: 134,
heightMargin: 45, heightMargin: 45,
speed: 300, speed: 300,
moreLink: '<a href="#">READ MORE</a>', moreLink: '<a href="#">READ MORE</a>', // ToDo: make translateable
lessLink: '<a href="#">READ LESS</a>', lessLink: '<a href="#">READ LESS</a>', // ToDo: make translateable
}); });
///////////////////////////////// /////////////////////////////////
// End of Global Work // // End of Global Work //
......
...@@ -230,4 +230,12 @@ $(function() { ...@@ -230,4 +230,12 @@ $(function() {
$(window).resize(function() { $(window).resize(function() {
$(".discover .row").isotope("layout"); $(".discover .row").isotope("layout");
}); });
$(".author-expand").click(function() {
$(this).parent().find("a.author-name").slice($(this).data("authors-max")).toggle();
$(this).parent().find("span.author-hidden-divider").toggle();
$(this).html() === $(this).data("collapse-caption") ? $(this).html("(...)") : $(this).html($(this).data("collapse-caption"));
$(".discover .row").isotope("layout");
});
}); });
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
} }
var template = "<div class=\"modal fade\" id=\"file-progress-modal\">" + var template = "<div class=\"modal fade\" id=\"file-progress-modal\">" +
"<div class=\"modal-dialog\">" + "<div class=\"modal-dialog upload-modal-dialog\">" +
" <div class=\"modal-content\">" + " <div class=\"modal-content\">" +
" <div class=\"modal-header\">" + " <div class=\"modal-header\">" +
" <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>" + " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>" +
...@@ -170,7 +170,7 @@ ...@@ -170,7 +170,7 @@
replaceForm: function(html) { replaceForm: function(html) {
var newForm; var newForm;
var formId = this.$form.attr("id"); var formId = this.$form.attr("id");
if (typeof formId !== "undefined") { if ( typeof formId !== "undefined") {
newForm = $(html).find("#" + formId); newForm = $(html).find("#" + formId);
} else { } else {
newForm = $(html).find("form"); newForm = $(html).find("form");
......
...@@ -41,10 +41,20 @@ ...@@ -41,10 +41,20 @@
</a> </a>
<p class="author"> <p class="author">
{% for author in entry.authors %} {% for author in entry.authors %}
<a href="{{url_for('web.author', book_id=author.id) }}">{{author.name.replace('|',',')}}</a> {% if loop.index > config_authors_max and config_authors_max != 0 %}
{% if not loop.last %} {% if not loop.first %}
&amp; <span class="author-hidden-divider">&amp;</span>
{% endif %} {% endif %}
<a class="author-name author-hidden" href="{{url_for('web.author', book_id=author.id) }}">{{author.name.replace('|',',')|shortentitle(30)}}</a>
{% if loop.last %}
<a href="#" class="author-expand" data-authors-max="{{config_authors_max}}" data-collapse-caption="({{_('reduce')}})">(...)</a>
{% endif %}
{% else %}
{% if not loop.first %}
<span>&amp;</span>
{% endif %}
<a class="author-name" href="{{url_for('web.author', book_id=author.id) }}">{{author.name.replace('|',',')|shortentitle(30)}}</a>
{% endif %}
{% endfor %} {% endfor %}
</p> </p>
{% if entry.ratings.__len__() > 0 %} {% if entry.ratings.__len__() > 0 %}
...@@ -80,13 +90,15 @@ ...@@ -80,13 +90,15 @@
<div class="meta"> <div class="meta">
<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="https://www.goodreads.com/author/show/{{ author.gid }}" target="_blank" rel="noopener"> {% if loop.index > config_authors_max and config_authors_max != 0 %}
{{author.name.replace('|',',')}} <a class="author-name author-hidden" href="https://www.goodreads.com/author/show/{{ author.gid }}" target="_blank" rel="noopener">{{author.name.replace('|',',')}}</a>
</a> {% if loop.last %}
{% if not loop.last %} <a href="#" class="author-expand" data-authors-max="{{config_authors_max}}" data-collapse-caption="({{_('reduce')}})">(...)</a>
&amp; {% endif %}
{% endif %} {% else %}
<a class="author-name" href="https://www.goodreads.com/author/show/{{ author.gid }}" target="_blank" rel="noopener">{{author.name.replace('|',',')}}</a>
{% endif %}
{% endfor %} {% endfor %}
</p> </p>
<div class="rating"> <div class="rating">
......
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
<label for="config_random_books">{{_('No. of random books to show')}}</label> <label for="config_random_books">{{_('No. of random books to show')}}</label>
<input type="number" min="1" max="30" class="form-control" name="config_random_books" id="config_random_books" value="{% if conf.config_random_books != None %}{{ conf.config_random_books }}{% endif %}" autocomplete="off"> <input type="number" min="1" max="30" class="form-control" name="config_random_books" id="config_random_books" value="{% if conf.config_random_books != None %}{{ conf.config_random_books }}{% endif %}" autocomplete="off">
</div> </div>
<div class="form-group">
<label for="config_authors_max">{{_('No. of authors to show before hiding (0=disable hiding)')}}</label>
<input type="number" min="0" max="999" class="form-control" name="config_authors_max" id="config_authors_max" value="{% if content.config_authors_max != None %}{{ content.config_authors_max }}{% endif %}" autocomplete="off">
</div>
<div class="form-group"> <div class="form-group">
<label for="config_theme">{{_('Theme')}}</label> <label for="config_theme">{{_('Theme')}}</label>
<select name="config_theme" id="config_theme" class="form-control"> <select name="config_theme" id="config_theme" class="form-control">
......
...@@ -19,9 +19,19 @@ ...@@ -19,9 +19,19 @@
</a> </a>
<p class="author"> <p class="author">
{% for author in entry.authors %} {% for author in entry.authors %}
<a href="{{url_for('web.author', book_id=author.id) }}">{{author.name.replace('|',',')|shortentitle(30)}}</a> {% if loop.index > config_authors_max and config_authors_max != 0 %}
{% if not loop.last %} {% if not loop.first %}
&amp; <span class="author-hidden-divider">&amp;</span>
{% endif %}
<a class="author-name author-hidden" href="{{url_for('web.author', book_id=author.id) }}">{{author.name.replace('|',',')|shortentitle(30)}}</a>
{% if loop.last %}
<a href="#" class="author-expand" data-authors-max="{{config_authors_max}}" data-collapse-caption="({{_('reduce')}})">(...)</a>
{% endif %}
{% else %}
{% if not loop.first %}
<span>&amp;</span>
{% endif %}
<a class="author-name" href="{{url_for('web.author', book_id=author.id) }}">{{author.name.replace('|',',')|shortentitle(30)}}</a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</p> </p>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="discover random-books"> <div class="discover random-books">
<h2 class="random-books">{{_('Discover (Random Books)')}}</h2> <h2 class="random-books">{{_('Discover (Random Books)')}}</h2>
<div class="row"> <div class="row">
{% for entry in random %} web. {% for entry in random %}
<div class="col-sm-3 col-lg-2 col-xs-6 book" id="books_rand"> <div class="col-sm-3 col-lg-2 col-xs-6 book" id="books_rand">
<div class="cover"> <div class="cover">
<a href="{{ url_for('web.show_book', book_id=entry.id) }}" data-toggle="modal" data-target="#bookDetailsModal" data-remote="false"> <a href="{{ url_for('web.show_book', book_id=entry.id) }}" data-toggle="modal" data-target="#bookDetailsModal" data-remote="false">
...@@ -21,9 +21,19 @@ ...@@ -21,9 +21,19 @@
</a> </a>
<p class="author"> <p class="author">
{% for author in entry.authors %} {% for author in entry.authors %}
<a href="{{url_for('web.author', book_id=author.id) }}">{{author.name.replace('|',',')|shortentitle(30)}}</a> {% if loop.index > config_authors_max and config_authors_max != 0 %}
{% if not loop.last %} {% if not loop.first %}
&amp; <span class="author-hidden-divider">&amp;</span>
{% endif %}
<a class="author-name author-hidden" href="{{url_for('web.author', book_id=author.id) }}">{{author.name.replace('|',',')|shortentitle(30)}}</a>
{% if loop.last %}
<a href="#" class="author-expand" data-authors-max="{{config_authors_max}}" data-collapse-caption="({{_('reduce')}})">(...)</a>
{% endif %}
{% else %}
{% if not loop.first %}
<span>&amp;</span>
{% endif %}
<a class="author-name" href="{{url_for('web.author', book_id=author.id) }}">{{author.name.replace('|',',')|shortentitle(30)}}</a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</p> </p>
...@@ -78,9 +88,19 @@ ...@@ -78,9 +88,19 @@
</a> </a>
<p class="author"> <p class="author">
{% for author in entry.authors %} {% for author in entry.authors %}
<a href="{{url_for('web.author', book_id=author.id) }}">{{author.name.replace('|',',')|shortentitle(30)}}</a> {% if loop.index > config_authors_max and config_authors_max != 0 %}
{% if not loop.last %} {% if not loop.first %}
&amp; <span class="author-hidden-divider">&amp;</span>
{% endif %}
<a class="author-name author-hidden" href="{{url_for('web.author', book_id=author.id) }}">{{author.name.replace('|',',')|shortentitle(30)}}</a>
{% if loop.last %}
<a href="#" class="author-expand" data-authors-max="{{config_authors_max}}" data-collapse-caption="({{_('reduce')}})">(...)</a>
{% endif %}
{% else %}
{% if not loop.first %}
<span>&amp;</span>
{% endif %}
<a class="author-name" href="{{url_for('web.author', book_id=author.id) }}">{{author.name.replace('|',',')|shortentitle(30)}}</a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% for format in entry.data %} {% for format in entry.data %}
......
...@@ -46,9 +46,19 @@ ...@@ -46,9 +46,19 @@
</a> </a>
<p class="author"> <p class="author">
{% for author in entry.authors %} {% for author in entry.authors %}
<a href="{{url_for('web.author', book_id=author.id ) }}">{{author.name.replace('|',',')}}</a> {% if loop.index > config_authors_max and config_authors_max != 0 %}
{% if not loop.last %} {% if not loop.first %}
&amp; <span class="author-hidden-divider">&amp;</span>
{% endif %}
<a class="author-name author-hidden" href="{{url_for('web.author', book_id=author.id) }}">{{author.name.replace('|',',')|shortentitle(30)}}</a>
{% if loop.last %}
<a href="#" class="author-expand" data-authors-max="{{config_authors_max}}" data-collapse-caption="({{_('reduce')}})">(...)</a>
{% endif %}
{% else %}
{% if not loop.first %}
<span>&amp;</span>
{% endif %}
<a class="author-name" href="{{url_for('web.author', book_id=author.id) }}">{{author.name.replace('|',',')|shortentitle(30)}}</a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</p> </p>
......
...@@ -31,9 +31,19 @@ ...@@ -31,9 +31,19 @@
</a> </a>
<p class="author"> <p class="author">
{% for author in entry.authors %} {% for author in entry.authors %}
<a href="{{url_for('web.author', book_id=author.id) }}">{{author.name.replace('|',',')}}</a> {% if loop.index > config_authors_max and config_authors_max != 0 %}
{% if not loop.last %} {% if not loop.first %}
&amp; <span class="author-hidden-divider">&amp;</span>
{% endif %}
<a class="author-name author-hidden" href="{{url_for('web.author', book_id=author.id) }}">{{author.name.replace('|',',')|shortentitle(30)}}</a>
{% if loop.last %}
<a href="#" class="author-expand" data-authors-max="{{config_authors_max}}" data-collapse-caption="({{_('reduce')}})">(...)</a>
{% endif %}
{% else %}
{% if not loop.first %}
<span>&amp;</span>
{% endif %}
<a class="author-name" href="{{url_for('web.author', book_id=author.id) }}">{{author.name.replace('|',',')|shortentitle(30)}}</a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</p> </p>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -371,6 +371,7 @@ class Settings(Base): ...@@ -371,6 +371,7 @@ class Settings(Base):
config_calibre_web_title = Column(String, default=u'Calibre-Web') config_calibre_web_title = Column(String, default=u'Calibre-Web')
config_books_per_page = Column(Integer, default=60) config_books_per_page = Column(Integer, default=60)
config_random_books = Column(Integer, default=4) config_random_books = Column(Integer, default=4)
config_authors_max = Column(Integer, default=0)
config_read_column = Column(Integer, default=0) config_read_column = Column(Integer, default=0)
config_title_regex = Column(String, default=u'^(A|The|An|Der|Die|Das|Den|Ein|Eine|Einen|Dem|Des|Einem|Eines)\s+') config_title_regex = Column(String, default=u'^(A|The|An|Der|Die|Das|Den|Ein|Eine|Einen|Dem|Des|Einem|Eines)\s+')
config_log_level = Column(SmallInteger, default=logging.INFO) config_log_level = Column(SmallInteger, default=logging.INFO)
...@@ -446,6 +447,7 @@ class Config: ...@@ -446,6 +447,7 @@ class Config:
self.config_calibre_web_title = data.config_calibre_web_title self.config_calibre_web_title = data.config_calibre_web_title
self.config_books_per_page = data.config_books_per_page self.config_books_per_page = data.config_books_per_page
self.config_random_books = data.config_random_books self.config_random_books = data.config_random_books
self.config_authors_max = data.config_authors_max
self.config_title_regex = data.config_title_regex self.config_title_regex = data.config_title_regex
self.config_read_column = data.config_read_column self.config_read_column = data.config_read_column
self.config_log_level = data.config_log_level self.config_log_level = data.config_log_level
...@@ -637,6 +639,12 @@ def migrate_Database(): ...@@ -637,6 +639,12 @@ def migrate_Database():
conn = engine.connect() conn = engine.connect()
conn.execute("ALTER TABLE Settings ADD column `config_default_role` SmallInteger DEFAULT 0") conn.execute("ALTER TABLE Settings ADD column `config_default_role` SmallInteger DEFAULT 0")
session.commit() session.commit()
try:
session.query(exists().where(Settings.config_authors_max)).scalar()
except exc.OperationalError: # Database is not compatible, some rows are missing
conn = engine.connect()
conn.execute("ALTER TABLE Settings ADD column `config_authors_max` INTEGER DEFAULT 0")
session.commit()
try: try:
session.query(exists().where(BookShelf.order)).scalar() session.query(exists().where(BookShelf.order)).scalar()
except exc.OperationalError: # Database is not compatible, some rows are missing except exc.OperationalError: # Database is not compatible, some rows are missing
......
...@@ -494,7 +494,7 @@ def get_matching_tags(): ...@@ -494,7 +494,7 @@ def get_matching_tags():
def index(page): def index(page):
entries, random, pagination = fill_indexpage(page, db.Books, True, [db.Books.timestamp.desc()]) entries, random, pagination = fill_indexpage(page, db.Books, True, [db.Books.timestamp.desc()])
return render_title_template('index.html', random=random, entries=entries, pagination=pagination, return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
title=_(u"Recently Added Books"), page="root") title=_(u"Recently Added Books"), page="root", config_authors_max=config.config_authors_max)
@web.route('/books/newest', defaults={'page': 1}) @web.route('/books/newest', defaults={'page': 1})
...@@ -632,7 +632,8 @@ def author(book_id, page): ...@@ -632,7 +632,8 @@ def author(book_id, page):
app.logger.error('Goodreads website is down/inaccessible') app.logger.error('Goodreads website is down/inaccessible')
return render_title_template('author.html', entries=entries, pagination=pagination, return render_title_template('author.html', entries=entries, pagination=pagination,
title=name, author=author_info, other_books=other_books, page="author") title=name, author=author_info, other_books=other_books, page="author",
config_authors_max=config.config_authors_max)
@web.route("/publisher") @web.route("/publisher")
......
This diff is collapsed.
Markdown is supported
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