Merge branch 'master' of https://github.com/janeczku/calibre-web into 617
This commit is contained in:
commit
9b1954f2f0
|
@ -160,7 +160,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<button type="submit" class="btn btn-default">{{_('Submit')}}</button>
|
<button type="submit" name="submit" class="btn btn-default">{{_('Submit')}}</button>
|
||||||
<a href="{{ url_for('admin') }}" class="btn btn-default">{{_('Back')}}</a>
|
<a href="{{ url_for('admin') }}" class="btn btn-default">{{_('Back')}}</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -165,11 +165,11 @@
|
||||||
{% if g.user.is_authenticated or g.user.is_anonymous %}
|
{% if g.user.is_authenticated or g.user.is_anonymous %}
|
||||||
<li class="nav-head hidden-xs">{{_('Public Shelves')}}</li>
|
<li class="nav-head hidden-xs">{{_('Public Shelves')}}</li>
|
||||||
{% for shelf in g.public_shelfes %}
|
{% for shelf in g.public_shelfes %}
|
||||||
<li><a href="{{url_for('show_shelf', shelf_id=shelf.id)}}"><span class="glyphicon glyphicon-list"></span>{{shelf.name}}</a></li>
|
<li><a href="{{url_for('show_shelf', shelf_id=shelf.id)}}"><span class="glyphicon glyphicon-list public_shelf"></span>{{shelf.name|shortentitle(40)}}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<li class="nav-head hidden-xs">{{_('Your Shelves')}}</li>
|
<li class="nav-head hidden-xs">{{_('Your Shelves')}}</li>
|
||||||
{% for shelf in g.user.shelf %}
|
{% for shelf in g.user.shelf %}
|
||||||
<li><a href="{{url_for('show_shelf', shelf_id=shelf.id)}}"><span class="glyphicon glyphicon-list"></span>{{shelf.name}}</a></li>
|
<li><a href="{{url_for('show_shelf', shelf_id=shelf.id)}}"><span class="glyphicon glyphicon-list private_shelf"></span>{{shelf.name|shortentitle(40)}}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if not g.user.is_anonymous %}
|
{% if not g.user.is_anonymous %}
|
||||||
<li id="nav_createshelf" class="create-shelf"><a href="{{url_for('create_shelf')}}">{{_('Create a Shelf')}}</a></li>
|
<li id="nav_createshelf" class="create-shelf"><a href="{{url_for('create_shelf')}}">{{_('Create a Shelf')}}</a></li>
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
<h2>{{title}}</h2>
|
<h2>{{title}}</h2>
|
||||||
{% if g.user.is_authenticated %}
|
{% if g.user.is_authenticated %}
|
||||||
{% if (g.user.role_edit_shelfs() and shelf.is_public ) or not shelf.is_public %}
|
{% if (g.user.role_edit_shelfs() and shelf.is_public ) or not shelf.is_public %}
|
||||||
<div data-toggle="modal" data-target="#DeleteShelfDialog" class="btn btn-danger">{{ _('Delete this Shelf') }} </div>
|
<div id="delete_shelf" data-toggle="modal" data-target="#DeleteShelfDialog" class="btn btn-danger">{{ _('Delete this Shelf') }} </div>
|
||||||
<a href="{{ url_for('edit_shelf', shelf_id=shelf.id) }}" class="btn btn-primary">{{ _('Edit Shelf') }} </a>
|
<a id="edit_shelf" href="{{ url_for('edit_shelf', shelf_id=shelf.id) }}" class="btn btn-primary">{{ _('Edit Shelf') }} </a>
|
||||||
<a href="{{ url_for('order_shelf', shelf_id=shelf.id) }}" class="btn btn-primary">{{ _('Change order') }} </a>
|
<a id="order_shelf" href="{{ url_for('order_shelf', shelf_id=shelf.id) }}" class="btn btn-primary">{{ _('Change order') }} </a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -14,11 +14,13 @@
|
||||||
{% for entry in entries %}
|
{% for entry in entries %}
|
||||||
<div class="col-sm-3 col-lg-2 col-xs-6 book">
|
<div class="col-sm-3 col-lg-2 col-xs-6 book">
|
||||||
<div class="cover">
|
<div class="cover">
|
||||||
{% if entry.has_cover is defined %}
|
|
||||||
<a href="{{ url_for('show_book', book_id=entry.id) }}" data-toggle="modal" data-target="#bookDetailsModal" data-remote="false">
|
<a href="{{ url_for('show_book', book_id=entry.id) }}" data-toggle="modal" data-target="#bookDetailsModal" data-remote="false">
|
||||||
<img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" />
|
{% if entry.has_cover %}
|
||||||
</a>
|
<img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" alt="{{ entry.title }}" />
|
||||||
|
{% else %}
|
||||||
|
<img src="{{ url_for('static', filename='generic_cover.jpg') }}" alt="{{ entry.title }}" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="meta">
|
<div class="meta">
|
||||||
<p class="title">{{entry.title|shortentitle}}</p>
|
<p class="title">{{entry.title|shortentitle}}</p>
|
||||||
|
@ -56,7 +58,7 @@
|
||||||
<div class="modal-body text-center">
|
<div class="modal-body text-center">
|
||||||
<span>{{_('Shelf will be lost for everybody and forever!')}}</span>
|
<span>{{_('Shelf will be lost for everybody and forever!')}}</span>
|
||||||
<p></p>
|
<p></p>
|
||||||
<a href="{{ url_for('delete_shelf', shelf_id=shelf.id) }}" class="btn btn-danger">{{_('Ok')}}</a>
|
<a id="confirm" href="{{ url_for('delete_shelf', shelf_id=shelf.id) }}" class="btn btn-danger">{{_('Ok')}}</a>
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{_('Back')}}</button>
|
<button type="button" class="btn btn-default" data-dismiss="modal">{{_('Back')}}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -140,7 +140,7 @@
|
||||||
{% if g.user and g.user.role_admin() and not profile and not new_user and not content.role_anonymous() %}
|
{% if g.user and g.user.role_admin() and not profile and not new_user and not content.role_anonymous() %}
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="delete"> {{_('Delete this user')}}
|
<input type="checkbox" id="delete" name="delete"> {{_('Delete this user')}}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -149,8 +149,8 @@
|
||||||
<button type="submit" id="submit" class="btn btn-default">{{_('Submit')}}</button>
|
<button type="submit" id="submit" class="btn btn-default">{{_('Submit')}}</button>
|
||||||
{% if not profile %}
|
{% if not profile %}
|
||||||
<a href="{{ url_for('admin') }}" id="back" class="btn btn-default">{{_('Back')}}</a>
|
<a href="{{ url_for('admin') }}" id="back" class="btn btn-default">{{_('Back')}}</a>
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% if downloads %}
|
{% if downloads %}
|
||||||
|
|
13
cps/web.py
13
cps/web.py
|
@ -2428,18 +2428,22 @@ def add_to_shelf(shelf_id, book_id):
|
||||||
if shelf is None:
|
if shelf is None:
|
||||||
app.logger.info("Invalid shelf specified")
|
app.logger.info("Invalid shelf specified")
|
||||||
if not request.is_xhr:
|
if not request.is_xhr:
|
||||||
|
flash(_(u"Invalid shelf specified"), category="error")
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
return "Invalid shelf specified", 400
|
return "Invalid shelf specified", 400
|
||||||
|
|
||||||
if not shelf.is_public and not shelf.user_id == int(current_user.id):
|
if not shelf.is_public and not shelf.user_id == int(current_user.id):
|
||||||
app.logger.info("Sorry you are not allowed to add a book to the the shelf: %s" % shelf.name)
|
app.logger.info("Sorry you are not allowed to add a book to the the shelf: %s" % shelf.name)
|
||||||
if not request.is_xhr:
|
if not request.is_xhr:
|
||||||
|
flash(_(u"Sorry you are not allowed to add a book to the the shelf: %(shelfname)s", shelfname=shelf.name),
|
||||||
|
category="error")
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
return "Sorry you are not allowed to add a book to the the shelf: %s" % shelf.name, 403
|
return "Sorry you are not allowed to add a book to the the shelf: %s" % shelf.name, 403
|
||||||
|
|
||||||
if shelf.is_public and not current_user.role_edit_shelfs():
|
if shelf.is_public and not current_user.role_edit_shelfs():
|
||||||
app.logger.info("User is not allowed to edit public shelves")
|
app.logger.info("User is not allowed to edit public shelves")
|
||||||
if not request.is_xhr:
|
if not request.is_xhr:
|
||||||
|
flash(_(u"You are not allowed to edit public shelves"), category="error")
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
return "User is not allowed to edit public shelves", 403
|
return "User is not allowed to edit public shelves", 403
|
||||||
|
|
||||||
|
@ -2448,6 +2452,7 @@ def add_to_shelf(shelf_id, book_id):
|
||||||
if book_in_shelf:
|
if book_in_shelf:
|
||||||
app.logger.info("Book is already part of the shelf: %s" % shelf.name)
|
app.logger.info("Book is already part of the shelf: %s" % shelf.name)
|
||||||
if not request.is_xhr:
|
if not request.is_xhr:
|
||||||
|
flash(_(u"Book is already part of the shelf: %(shelfname)s", shelfname=shelf.name), category="error")
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
return "Book is already part of the shelf: %s" % shelf.name, 400
|
return "Book is already part of the shelf: %s" % shelf.name, 400
|
||||||
|
|
||||||
|
@ -2462,7 +2467,10 @@ def add_to_shelf(shelf_id, book_id):
|
||||||
ub.session.commit()
|
ub.session.commit()
|
||||||
if not request.is_xhr:
|
if not request.is_xhr:
|
||||||
flash(_(u"Book has been added to shelf: %(sname)s", sname=shelf.name), category="success")
|
flash(_(u"Book has been added to shelf: %(sname)s", sname=shelf.name), category="success")
|
||||||
|
if "HTTP_REFERER" in request.environ:
|
||||||
return redirect(request.environ["HTTP_REFERER"])
|
return redirect(request.environ["HTTP_REFERER"])
|
||||||
|
else:
|
||||||
|
return redirect(url_for('index'))
|
||||||
return "", 204
|
return "", 204
|
||||||
|
|
||||||
|
|
||||||
|
@ -3118,6 +3126,11 @@ def new_user():
|
||||||
content.sidebar_view += ub.SIDEBAR_AUTHOR
|
content.sidebar_view += ub.SIDEBAR_AUTHOR
|
||||||
if "show_detail_random" in to_save:
|
if "show_detail_random" in to_save:
|
||||||
content.sidebar_view += ub.DETAIL_RANDOM
|
content.sidebar_view += ub.DETAIL_RANDOM
|
||||||
|
if "show_sorted" in to_save:
|
||||||
|
content.sidebar_view += ub.SIDEBAR_SORTED
|
||||||
|
if "show_recent" in to_save:
|
||||||
|
content.sidebar_view += ub.SIDEBAR_RECENT
|
||||||
|
|
||||||
content.role = 0
|
content.role = 0
|
||||||
if "admin_role" in to_save:
|
if "admin_role" in to_save:
|
||||||
content.role = content.role + ub.ROLE_ADMIN
|
content.role = content.role + ub.ROLE_ADMIN
|
||||||
|
|
Loading…
Reference in New Issue
Block a user