Allow to use image as logo. - Sponsor: Fundación Karisma
This commit is contained in:
parent
c2267b6902
commit
be5581fa2a
|
@ -563,6 +563,7 @@ def update_view_configuration():
|
||||||
to_save = request.form.to_dict()
|
to_save = request.form.to_dict()
|
||||||
|
|
||||||
_config_string(to_save, "config_calibre_web_title")
|
_config_string(to_save, "config_calibre_web_title")
|
||||||
|
_config_checkbox(to_save, "config_use_logo")
|
||||||
_config_string(to_save, "config_columns_to_ignore")
|
_config_string(to_save, "config_columns_to_ignore")
|
||||||
if _config_string(to_save, "config_title_regex"):
|
if _config_string(to_save, "config_title_regex"):
|
||||||
calibre_db.update_title_sort(config)
|
calibre_db.update_title_sort(config)
|
||||||
|
|
|
@ -74,6 +74,7 @@ class _Settings(_Base):
|
||||||
config_certfile = Column(String)
|
config_certfile = Column(String)
|
||||||
config_keyfile = Column(String)
|
config_keyfile = Column(String)
|
||||||
config_trustedhosts = Column(String, default='')
|
config_trustedhosts = Column(String, default='')
|
||||||
|
config_use_logo = Column(Boolean, default=False)
|
||||||
config_calibre_web_title = Column(String, default='Calibre-Web')
|
config_calibre_web_title = Column(String, default='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)
|
||||||
|
|
|
@ -21,6 +21,7 @@ from flask_babel import gettext as _
|
||||||
from werkzeug.local import LocalProxy
|
from werkzeug.local import LocalProxy
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
from sqlalchemy.sql.expression import or_
|
from sqlalchemy.sql.expression import or_
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from . import config, constants, logger, ub
|
from . import config, constants, logger, ub
|
||||||
from .ub import User
|
from .ub import User
|
||||||
|
@ -106,12 +107,18 @@ def get_sidebar_config(kwargs=None):
|
||||||
|
|
||||||
return sidebar, simple
|
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
|
# Returns the template for rendering and includes the instance name
|
||||||
def render_title_template(*args, **kwargs):
|
def render_title_template(*args, **kwargs):
|
||||||
sidebar, simple = get_sidebar_config(kwargs)
|
sidebar, simple = get_sidebar_config(kwargs)
|
||||||
try:
|
try:
|
||||||
return render_template(instance=config.config_calibre_web_title, sidebar=sidebar, simple=simple,
|
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,
|
accept=constants.EXTENSIONS_UPLOAD,
|
||||||
*args, **kwargs)
|
*args, **kwargs)
|
||||||
except PermissionError:
|
except PermissionError:
|
||||||
|
|
|
@ -20,7 +20,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="collapsefour" class="panel-collapse collapse">
|
<div id="collapsefour" class="panel-collapse collapse">
|
||||||
<div class="panel-body">
|
<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>
|
<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>
|
<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>
|
</div>
|
||||||
|
|
|
@ -34,7 +34,13 @@
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</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>
|
</div>
|
||||||
{% if g.current_theme == 1 %}
|
{% 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>
|
<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