Merge be5581fa2a
into e591211b57
This commit is contained in:
commit
e11c6f1f3a
|
@ -564,6 +564,7 @@ def update_view_configuration():
|
|||
to_save = request.form.to_dict()
|
||||
|
||||
_config_string(to_save, "config_calibre_web_title")
|
||||
_config_checkbox(to_save, "config_use_logo")
|
||||
_config_string(to_save, "config_columns_to_ignore")
|
||||
if _config_string(to_save, "config_title_regex"):
|
||||
calibre_db.update_title_sort(config)
|
||||
|
|
|
@ -77,6 +77,7 @@ class _Settings(_Base):
|
|||
config_certfile = Column(String)
|
||||
config_keyfile = Column(String)
|
||||
config_trustedhosts = Column(String, default='')
|
||||
config_use_logo = Column(Boolean, default=False)
|
||||
config_calibre_web_title = Column(String, default='Calibre-Web')
|
||||
config_books_per_page = Column(Integer, default=60)
|
||||
config_random_books = Column(Integer, default=4)
|
||||
|
|
|
@ -21,6 +21,7 @@ from flask_babel import gettext as _
|
|||
from werkzeug.local import LocalProxy
|
||||
from flask_login import current_user
|
||||
from sqlalchemy.sql.expression import or_
|
||||
from pathlib import Path
|
||||
|
||||
from . import config, constants, logger, ub
|
||||
from .ub import User
|
||||
|
@ -106,12 +107,18 @@ def get_sidebar_config(kwargs=None):
|
|||
|
||||
return sidebar, simple
|
||||
|
||||
def logo_file():
|
||||
dir_static_path = Path(constants.STATIC_DIR)
|
||||
file_name = Path('logo.png')
|
||||
file_path = dir_static_path / file_name
|
||||
return file_path.is_file()
|
||||
|
||||
# Returns the template for rendering and includes the instance name
|
||||
def render_title_template(*args, **kwargs):
|
||||
sidebar, simple = get_sidebar_config(kwargs)
|
||||
try:
|
||||
return render_template(instance=config.config_calibre_web_title, sidebar=sidebar, simple=simple,
|
||||
use_logo=config.config_use_logo and logo_file(),
|
||||
accept=constants.EXTENSIONS_UPLOAD,
|
||||
*args, **kwargs)
|
||||
except PermissionError:
|
||||
|
|
|
@ -20,7 +20,11 @@
|
|||
</div>
|
||||
<div id="collapsefour" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
<input type="checkbox" id="config_use_logo" name="config_use_logo" {% if conf.config_use_logo %}checked{% endif %}>
|
||||
<label for="config_use_logo">{{_('Use Logo')}}</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="config_calibre_web_title">{{_('Title')}}</label>
|
||||
<input type="text" class="form-control" name="config_calibre_web_title" id="config_calibre_web_title" value="{% if conf.config_calibre_web_title != None %}{{ conf.config_calibre_web_title }}{% endif %}" autocomplete="off" required>
|
||||
</div>
|
||||
|
|
|
@ -34,7 +34,13 @@
|
|||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="{{url_for('web.index')}}">{{instance}}</a>
|
||||
<a class="navbar-brand" href="{{url_for('web.index')}}" style="display:flex;">
|
||||
{% if use_logo %}
|
||||
<img src="{{ url_for('static', filename='logo.png') }}" alt="{{instance}}"/>
|
||||
{% else %}
|
||||
{{instance}}
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
{% if g.current_theme == 1 %}
|
||||
<div class="home-btn"><a class="home-btn-tooltip" href="{{url_for("web.index",page=1)}}" data-toggle="tooltip" title="" data-placement="bottom" data-original-title="Home"></a></div>
|
||||
|
|
Loading…
Reference in New Issue