Skip to content

Commit

Permalink
add cover option
Browse files Browse the repository at this point in the history
  • Loading branch information
cdhigh committed Nov 24, 2024
1 parent d5784ed commit 59607dc
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 80 deletions.
2 changes: 1 addition & 1 deletion application/back_end/db_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class KeUser(MyBaseModel): # kindleEar User
book_config = JSONField(default=JSONField.dict_default)

share_links = JSONField(default=JSONField.dict_default) #evernote/wiz/pocket/instapaper包含子字典,微博/facebook/twitter等仅包含0/1
covers = JSONField(default=JSONField.dict_default) #保存封面图片数据库ID {'order':,'cover0':,...'cover6':}
covers = JSONField(default=JSONField.dict_default) #保存封面图片数据库ID {'enable':,'order':,'cover0':,...'cover6':}
send_mail_service = JSONField(default=JSONField.dict_default) #{'service':,...}
custom = JSONField(default=JSONField.dict_default) #留着扩展,避免后续一些小特性还需要升级数据表结构

Expand Down
1 change: 1 addition & 0 deletions application/static/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,7 @@ function SetCoverToDefaultImg(idx) {
function startUploadCoversToServer(url) {
var totalSize = 0;
var fileDatas = new FormData();
fileDatas.append('enable', $('#enableCover').val());
fileDatas.append('order', $('#coverOrder').val());
for (var idx = 0; idx < 7; idx++) {
var coverName = 'cover' + idx;
Expand Down
27 changes: 17 additions & 10 deletions application/templates/adv_uploadcover.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,28 @@
{% endblock -%}

{% block advcontent -%}
<form class="pure-form" id="uploadForm" action="{{uploadUrl}}" method="POST" enctype="multipart/form-data" onsubmit="return false;">
<form class="pure-form pure-form-aligned" id="uploadForm" action="{{uploadUrl}}" method="POST" enctype="multipart/form-data" onsubmit="return false;">
<fieldset>
<legend>{{_("Upload cover image")}}</legend>
<p><small>{{_("Upload cover images from local with an aspect ratio of approximately 0.65.")}}</small></p>
<p><small>{{_("Upload cover images from local with an aspect ratio of approximately 0.625.")}}</small></p>
<div class="box-list">
<div class="pure-control-group" style="margin-top: 10px">
<label>{{_("Include cover")}}</label>
<select class="pure-u-1 pure-u-sm-9-24" name="enable" id="enableCover">
<option value="" {% if not covers.get('enable', '') %}selected="selected"{% endif %}>{{_("Disable")}}</option>
<option value="1" {% if covers.get('enable') %}selected="selected"{% endif %}>{{_("Enable")}}</option>
</select>
</div>
<div class="pure-control-group">
<label>{{_("Rule for cover")}}</label>
<select class="pure-u-1 pure-u-sm-9-24" name="order" id="coverOrder">
<option value="random" {% if covers.get('order', 'random') == 'random' %}selected="selected"{% endif %}>{{_("Random")}}</option>
<option value="weekday" {% if covers.get('order') == 'weekday' %}selected="selected"{% endif %}>{{_("Weekday")}}</option>
</select>
</div>
<hr style="width: 90%" />
<div id="preview" class="imgupBox">
<div class="imgFileUploade">
<div class="pure-control-group">
<label style="margin: 0px 20px">{{_("Rule to pick cover images")}}</label>
<select class="pure-u-1 pure-u-sm-9-24" name="order" id="coverOrder">
<option value="random" {% if covers.get('order', 'random') == 'random' %}selected="selected"{% endif %}>{{_("Random")}}</option>
<option value="weekday" {% if covers.get('order') == 'weekday' %}selected="selected"{% endif %}>{{_("Weekday")}}</option>
</select>
</div>
<hr style="width: 90%" />
<div class="imgAll">
<ul>
{% for idx in range(7) -%}
Expand Down
50 changes: 29 additions & 21 deletions application/translations/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-11-23 21:29-0300\n"
"POT-Creation-Date: 2024-11-24 09:32-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -383,6 +383,7 @@ msgid ""
msgstr ""

#: application/templates/adv_inboundmail.html:16
#: application/templates/adv_uploadcover.html:15
#: application/templates/book_summarizer.html:19
#: application/templates/book_translator.html:22
msgid "Disable"
Expand Down Expand Up @@ -465,23 +466,35 @@ msgid "Upload cover image"
msgstr ""

#: application/templates/adv_uploadcover.html:10
msgid "Upload cover images from local with an aspect ratio of approximately 0.65."
msgid ""
"Upload cover images from local with an aspect ratio of approximately "
"0.625."
msgstr ""

#: application/templates/adv_uploadcover.html:15
msgid "Rule to pick cover images"
#: application/templates/adv_uploadcover.html:13
msgid "Include cover"
msgstr ""

#: application/templates/adv_uploadcover.html:16
#: application/templates/book_summarizer.html:18
#: application/templates/book_translator.html:21
msgid "Enable"
msgstr ""

#: application/templates/adv_uploadcover.html:17
#: application/templates/adv_uploadcover.html:20
msgid "Rule for cover"
msgstr ""

#: application/templates/adv_uploadcover.html:22
msgid "Random"
msgstr ""

#: application/templates/adv_uploadcover.html:18
#: application/templates/adv_uploadcover.html:23
#: application/templates/base.html:127
msgid "Weekday"
msgstr ""

#: application/templates/adv_uploadcover.html:42
#: application/templates/adv_uploadcover.html:49
msgid "Upload/Update"
msgstr ""

Expand Down Expand Up @@ -1150,11 +1163,6 @@ msgstr ""
msgid "Your browser does not support the audio element."
msgstr ""

#: application/templates/book_summarizer.html:18
#: application/templates/book_translator.html:21
msgid "Enable"
msgstr ""

#: application/templates/book_summarizer.html:29
msgid "Model"
msgstr ""
Expand Down Expand Up @@ -1688,8 +1696,8 @@ msgstr ""
msgid "Word"
msgstr ""

#: application/view/admin.py:48 application/view/adv.py:434
#: application/view/adv.py:486 application/view/settings.py:66
#: application/view/admin.py:48 application/view/adv.py:437
#: application/view/adv.py:489 application/view/settings.py:66
#: application/view/translator.py:87 application/view/translator.py:171
#: application/view/translator.py:253
msgid "Settings Saved!"
Expand Down Expand Up @@ -1803,34 +1811,34 @@ msgstr ""
msgid "Append qrcode of url to article"
msgstr ""

#: application/view/adv.py:378 application/view/share.py:54
#: application/view/adv.py:381 application/view/share.py:54
#: application/view/subscribe.py:250
msgid "Unknown command: {}"
msgstr ""

#: application/view/adv.py:436 application/view/adv.py:488
#: application/view/adv.py:439 application/view/adv.py:491
msgid "The format is invalid."
msgstr ""

#: application/view/adv.py:520
#: application/view/adv.py:523
msgid "Authorization Error!<br/>{}"
msgstr ""

#: application/view/adv.py:541
#: application/view/adv.py:544
msgid "Success authorized by Pocket!"
msgstr ""

#: application/view/adv.py:547
#: application/view/adv.py:550
msgid ""
"Failed to request authorization of Pocket!<hr/>See details "
"below:<br/><br/>{}"
msgstr ""

#: application/view/adv.py:568
#: application/view/adv.py:571
msgid "The Instapaper service encountered an error. Please try again later."
msgstr ""

#: application/view/adv.py:581
#: application/view/adv.py:584
msgid "Request type [{}] unsupported"
msgstr ""

Expand Down
Binary file modified application/translations/tr_TR/LC_MESSAGES/messages.mo
Binary file not shown.
54 changes: 31 additions & 23 deletions application/translations/tr_TR/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-11-23 21:29-0300\n"
"POT-Creation-Date: 2024-11-24 09:32-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: tr_TR\n"
Expand Down Expand Up @@ -386,6 +386,7 @@ msgstr ""
"yapılandırmanız gerekmektedir."

#: application/templates/adv_inboundmail.html:16
#: application/templates/adv_uploadcover.html:15
#: application/templates/book_summarizer.html:19
#: application/templates/book_translator.html:22
msgid "Disable"
Expand Down Expand Up @@ -470,25 +471,37 @@ msgid "Upload cover image"
msgstr "Kapak resmi yükle"

#: application/templates/adv_uploadcover.html:10
msgid "Upload cover images from local with an aspect ratio of approximately 0.65."
msgid ""
"Upload cover images from local with an aspect ratio of approximately "
"0.625."
msgstr ""
"Yaklaşık 0.65 en boy oranına sahip kapak resimlerini yerel olarak "
"Yaklaşık 0.625 en boy oranına sahip kapak resimlerini yerel olarak "
"yükleyin."

#: application/templates/adv_uploadcover.html:15
msgid "Rule to pick cover images"
msgstr "Kapak resimlerini seçme kuralı"
#: application/templates/adv_uploadcover.html:13
msgid "Include cover"
msgstr "Kapak Dahil"

#: application/templates/adv_uploadcover.html:16
#: application/templates/book_summarizer.html:18
#: application/templates/book_translator.html:21
msgid "Enable"
msgstr "Etkinleştir"

#: application/templates/adv_uploadcover.html:20
msgid "Rule for cover"
msgstr "Kapak Kuralı"

#: application/templates/adv_uploadcover.html:17
#: application/templates/adv_uploadcover.html:22
msgid "Random"
msgstr "Rastgele"

#: application/templates/adv_uploadcover.html:18
#: application/templates/adv_uploadcover.html:23
#: application/templates/base.html:127
msgid "Weekday"
msgstr "Hafta içi gün"

#: application/templates/adv_uploadcover.html:42
#: application/templates/adv_uploadcover.html:49
msgid "Upload/Update"
msgstr "Yükle/Güncelle"

Expand Down Expand Up @@ -1168,11 +1181,6 @@ msgstr "Metin"
msgid "Your browser does not support the audio element."
msgstr "Tarayıcınız ses öğesini desteklemiyor."

#: application/templates/book_summarizer.html:18
#: application/templates/book_translator.html:21
msgid "Enable"
msgstr "Etkinleştir"

#: application/templates/book_summarizer.html:29
msgid "Model"
msgstr "Model"
Expand Down Expand Up @@ -1722,8 +1730,8 @@ msgstr "Ek olarak ilet"
msgid "Word"
msgstr "Kelime"

#: application/view/admin.py:48 application/view/adv.py:434
#: application/view/adv.py:486 application/view/settings.py:66
#: application/view/admin.py:48 application/view/adv.py:437
#: application/view/adv.py:489 application/view/settings.py:66
#: application/view/translator.py:87 application/view/translator.py:171
#: application/view/translator.py:253
msgid "Settings Saved!"
Expand Down Expand Up @@ -1837,38 +1845,38 @@ msgstr "Tarayıcıda aç"
msgid "Append qrcode of url to article"
msgstr "Makaleye URL'nin QR kodunu ekle"

#: application/view/adv.py:378 application/view/share.py:54
#: application/view/adv.py:381 application/view/share.py:54
#: application/view/subscribe.py:250
msgid "Unknown command: {}"
msgstr "Bilinmeyen komut: {}"

#: application/view/adv.py:436 application/view/adv.py:488
#: application/view/adv.py:439 application/view/adv.py:491
msgid "The format is invalid."
msgstr "Format geçersiz."

#: application/view/adv.py:520
#: application/view/adv.py:523
msgid "Authorization Error!<br/>{}"
msgstr "Yetkilendirme Hatası!<br/>{}"

#: application/view/adv.py:541
#: application/view/adv.py:544
msgid "Success authorized by Pocket!"
msgstr "Pocket tarafından yetkilendirilen başarı!"

#: application/view/adv.py:547
#: application/view/adv.py:550
msgid ""
"Failed to request authorization of Pocket!<hr/>See details "
"below:<br/><br/>{}"
msgstr ""
"Pocket yetkilendirme isteği başarısız oldu!<hr/>Aşağıdaki ayrıntılara "
"bakın:<br/><br/>{}"

#: application/view/adv.py:568
#: application/view/adv.py:571
msgid "The Instapaper service encountered an error. Please try again later."
msgstr ""
"Instapaper servisi bir hata ile karşılaştı. Lütfen daha sonra tekrar "
"deneyin."

#: application/view/adv.py:581
#: application/view/adv.py:584
msgid "Request type [{}] unsupported"
msgstr "İstek türü [{}] desteklenmiyor"

Expand Down
Binary file modified application/translations/zh/LC_MESSAGES/messages.mo
Binary file not shown.
Loading

0 comments on commit 59607dc

Please sign in to comment.