From 2bbc30e48dd443ba5da5f18005ac8056e58bee31 Mon Sep 17 00:00:00 2001 From: Junwei Zhao Date: Sun, 13 Oct 2024 11:51:55 +1100 Subject: [PATCH] Add frontend search input --- links/templates/links/link_list.html | 77 +++++++++++++++++++++++----- locale/zh_Hans/LC_MESSAGES/django.po | 40 +++++++++------ new_theme/static/css/dist/styles.css | 38 ++++++++++++++ new_theme/static/js/navbar.js | 10 +--- 4 files changed, 127 insertions(+), 38 deletions(-) diff --git a/links/templates/links/link_list.html b/links/templates/links/link_list.html index 2b7ad70..54d47c4 100644 --- a/links/templates/links/link_list.html +++ b/links/templates/links/link_list.html @@ -22,14 +22,24 @@
-
-

{% trans "Link List" %}

- - - - - {% trans "Create New Link" %} - +
+

{% trans "Link List" %}

+
@@ -104,9 +114,9 @@ {% trans "Actions" %} - + {% for link in links %} - + @@ -155,10 +165,49 @@
diff --git a/locale/zh_Hans/LC_MESSAGES/django.po b/locale/zh_Hans/LC_MESSAGES/django.po index 0192b13..55be422 100644 --- a/locale/zh_Hans/LC_MESSAGES/django.po +++ b/locale/zh_Hans/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-08 07:10-0500\n" +"POT-Creation-Date: 2024-10-12 19:49-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -924,7 +924,7 @@ msgstr "" #: 3.12/lib/python3.12/site-packages/django/forms/formsets.py:499 #: links/templates/links/link_confirm_delete.html:30 -#: links/templates/links/link_list.html:139 +#: links/templates/links/link_list.html:149 msgid "Delete" msgstr "删除" @@ -1609,13 +1609,13 @@ msgstr "链接详情" #: links/templates/links/link_confirm_delete.html:17 #: links/templates/links/link_detail.html:33 -#: links/templates/links/link_list.html:46 +#: links/templates/links/link_list.html:56 msgid "Alias" msgstr "别名" #: links/templates/links/link_confirm_delete.html:18 #: links/templates/links/link_detail.html:50 -#: links/templates/links/link_list.html:66 +#: links/templates/links/link_list.html:76 msgid "Original URL" msgstr "原始URL" @@ -1634,18 +1634,18 @@ msgid "Go to link" msgstr "" #: links/templates/links/link_detail.html:26 -#: links/templates/links/link_list.html:138 +#: links/templates/links/link_list.html:148 #: links/templates/links/search.html:27 msgid "Edit" msgstr "编辑" #: links/templates/links/link_detail.html:41 -#: links/templates/links/link_list.html:86 +#: links/templates/links/link_list.html:96 msgid "Created At" msgstr "创建时间" #: links/templates/links/link_detail.html:45 -#: links/templates/links/link_list.html:96 +#: links/templates/links/link_list.html:106 msgid "Updated At" msgstr "更新时间" @@ -1671,7 +1671,7 @@ msgstr "" #: links/templates/links/link_detail.html:120 #: links/templates/links/link_list.html:15 -#: links/templates/links/link_list.html:76 +#: links/templates/links/link_list.html:86 msgid "Clicks" msgstr "点击次数" @@ -1688,7 +1688,7 @@ msgid "Edit Link" msgstr "编辑链接" #: links/templates/links/link_form.html:14 -#: links/templates/links/link_list.html:31 +#: links/templates/links/link_list.html:40 msgid "Create New Link" msgstr "创建新链接" @@ -1696,7 +1696,7 @@ msgstr "创建新链接" msgid "" "Link type is used for redirecting to an external URL. Use this when you want " "to create a short alias for a long URL." -msgstr "" +msgstr "链接类型用于重定向到外部URL。当您想为长URL创建一个短别名时,请使用此选项。" #: links/templates/links/link_form.html:38 msgid "" @@ -1726,27 +1726,37 @@ msgstr "暂无热门链接" msgid "Link List" msgstr "链接列表" -#: links/templates/links/link_list.html:56 +#: links/templates/links/link_list.html:29 +#, fuzzy +#| msgid "Search aliases..." +msgid "Search links..." +msgstr "搜索别名..." + +#: links/templates/links/link_list.html:66 msgid "Type" msgstr "链接类型" -#: links/templates/links/link_list.html:104 +#: links/templates/links/link_list.html:114 msgid "Actions" msgstr "操作" -#: links/templates/links/link_list.html:140 +#: links/templates/links/link_list.html:150 #: links/templates/links/search.html:26 msgid "Details" msgstr "详情" -#: links/templates/links/link_list.html:145 +#: links/templates/links/link_list.html:155 msgid "No links available" msgstr "暂无可用链接" -#: links/templates/links/link_list.html:152 +#: links/templates/links/link_list.html:162 msgid "Delete Selected" msgstr "删除选中项" +#: links/templates/links/link_list.html:199 +msgid "No matching links found" +msgstr "" + #: links/templates/links/search.html:5 templates/base.html:71 msgid "Advanced Search" msgstr "高级搜索" diff --git a/new_theme/static/css/dist/styles.css b/new_theme/static/css/dist/styles.css index c15b55c..32e2688 100644 --- a/new_theme/static/css/dist/styles.css +++ b/new_theme/static/css/dist/styles.css @@ -600,6 +600,10 @@ video { border-width: 0; } +.pointer-events-none { + pointer-events: none; +} + .visible { visibility: visible; } @@ -628,6 +632,11 @@ video { position: sticky; } +.inset-y-0 { + top: 0px; + bottom: 0px; +} + .left-0 { left: 0px; } @@ -761,6 +770,10 @@ video { height: 1rem; } +.h-5 { + height: 1.25rem; +} + .h-screen { height: 100vh; } @@ -789,6 +802,14 @@ video { width: 12rem; } +.w-5 { + width: 1.25rem; +} + +.w-64 { + width: 16rem; +} + .w-full { width: 100%; } @@ -1165,6 +1186,10 @@ video { padding-bottom: 1.25rem; } +.pr-3 { + padding-right: 0.75rem; +} + .text-left { text-align: left; } @@ -1259,6 +1284,11 @@ video { color: rgb(30 64 175 / var(--tw-text-opacity)); } +.text-gray-400 { + --tw-text-opacity: 1; + color: rgb(156 163 175 / var(--tw-text-opacity)); +} + .text-gray-500 { --tw-text-opacity: 1; color: rgb(107 114 128 / var(--tw-text-opacity)); @@ -1378,6 +1408,10 @@ video { transition-duration: 150ms; } +.duration-150 { + transition-duration: 150ms; +} + .ease-in-out { transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); } @@ -1481,6 +1515,10 @@ video { border-color: rgb(165 180 252 / var(--tw-border-opacity)); } +.focus\:border-transparent:focus { + border-color: transparent; +} + .focus\:outline-none:focus { outline: 2px solid transparent; outline-offset: 2px; diff --git a/new_theme/static/js/navbar.js b/new_theme/static/js/navbar.js index c3d8fcf..aa0934b 100644 --- a/new_theme/static/js/navbar.js +++ b/new_theme/static/js/navbar.js @@ -1,17 +1,12 @@ -console.log('navbar.js is being executed'); + document.addEventListener('DOMContentLoaded', function() { - console.log('DOMContentLoaded event fired in navbar.js'); const moreMenuButton = document.getElementById('more-menu-button'); const moreMenuDropdown = document.getElementById('more-menu-dropdown'); const languageSelectorButton = document.getElementById('language-selector-button'); const languageOptions = document.getElementById('language-options'); - console.log('moreMenuButton:', moreMenuButton); - console.log('moreMenuDropdown:', moreMenuDropdown); - console.log('languageSelectorButton:', languageSelectorButton); - console.log('languageOptions:', languageOptions); function toggleDropdown(button, dropdown) { button.addEventListener('click', function(e) { @@ -45,13 +40,10 @@ document.addEventListener('DOMContentLoaded', function() { // 处理语言选择 const languageForm = document.getElementById('language-form'); - console.log('languageForm:', languageForm); if (languageForm) { const languageButtons = languageForm.querySelectorAll('button[name="language"]'); - console.log('languageButtons:', languageButtons); languageButtons.forEach(button => { button.addEventListener('click', function() { - console.log('Language changed'); languageForm.submit(); }); });