diff options
| author | Bobby <[email protected]> | 2025-05-20 08:08:56 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2025-05-20 08:08:56 +0530 |
| commit | 0686a7fa66f7ae173045d73e60fbdcdac7349ea8 (patch) | |
| tree | 6fc58a2d744ab1dfd12cc8346009e9d49a6843e2 | |
| parent | 85bef77e0d2810dfc63807ed62e8c222f05aabf4 (diff) | |
| download | thatcomputerscientist-0686a7fa66f7ae173045d73e60fbdcdac7349ea8.tar.xz thatcomputerscientist-0686a7fa66f7ae173045d73e60fbdcdac7349ea8.zip | |
moving older templates to `templates.old` temporarily; auth module; user profile middleware; localegen generator
| -rw-r--r-- | auth/__init__.py (renamed from templates/userpages/partials/navbar.html) | 0 | ||||
| -rw-r--r-- | auth/admin.py | 3 | ||||
| -rw-r--r-- | auth/apps.py | 6 | ||||
| -rw-r--r-- | auth/migrations/__init__.py | 0 | ||||
| -rw-r--r-- | auth/models.py | 3 | ||||
| -rw-r--r-- | auth/tests.py | 3 | ||||
| -rw-r--r-- | auth/urls.py | 8 | ||||
| -rw-r--r-- | auth/views.py | 34 | ||||
| -rw-r--r-- | locale/ja/LC_MESSAGES/django.po | 57 | ||||
| -rw-r--r-- | localegen.sh | 88 | ||||
| -rw-r--r-- | middleware/userprofilemiddleware.py | 14 | ||||
| -rwxr-xr-x | runserver.sh | 70 | ||||
| -rw-r--r-- | static/images/core/icons/anime.png | bin | 0 -> 1044 bytes | |||
| -rw-r--r-- | static/images/core/icons/calendar.png | bin | 0 -> 658 bytes | |||
| -rw-r--r-- | static/images/core/icons/census.png | bin | 0 -> 591 bytes | |||
| -rw-r--r-- | static/images/core/icons/changelanguage.png | bin | 0 -> 1850 bytes | |||
| -rw-r--r-- | static/images/core/icons/chatrooms.png | bin | 0 -> 659 bytes | |||
| -rw-r--r-- | static/images/core/icons/coin.png | bin | 0 -> 5172 bytes | |||
| -rw-r--r-- | static/images/core/icons/discussions.png | bin | 0 -> 538 bytes | |||
| -rw-r--r-- | static/images/core/icons/dvd.png | bin | 0 -> 646 bytes | |||
| -rw-r--r-- | static/images/core/icons/folder.png | bin | 0 -> 481 bytes | |||
| -rw-r--r-- | static/images/core/icons/games.png | bin | 0 -> 926 bytes | |||
| -rw-r--r-- | static/images/core/icons/guestbook.png | bin | 0 -> 512 bytes | |||
| -rw-r--r-- | static/images/core/icons/harlemshake.gif | bin | 0 -> 64804 bytes | |||
| -rw-r--r-- | static/images/core/icons/home.png | bin | 0 -> 828 bytes | |||
| -rw-r--r-- | static/images/core/icons/journalofrandomthoughts.png | bin | 0 -> 563 bytes | |||
| -rw-r--r-- | static/images/core/icons/journals.png | bin | 0 -> 507 bytes | |||
| -rw-r--r-- | static/images/core/icons/logout.png | bin | 0 -> 900 bytes | |||
| -rw-r--r-- | static/images/core/icons/marketplace.png | bin | 0 -> 461 bytes | |||
| -rw-r--r-- | static/images/core/icons/matrix.png | bin | 0 -> 8329 bytes | |||
| -rw-r--r-- | static/images/core/icons/music.png | bin | 0 -> 684 bytes | |||
| -rw-r--r-- | static/images/core/icons/myanimelist.png | bin | 0 -> 947 bytes | |||
| -rw-r--r-- | static/images/core/icons/mypage.png | bin | 0 -> 462 bytes | |||
| -rw-r--r-- | static/images/core/icons/pagodarealm.png | bin | 0 -> 3198 bytes | |||
| -rw-r--r-- | static/images/core/icons/pamphlet.png | bin | 0 -> 497 bytes | |||
| -rw-r--r-- | static/images/core/icons/preferences.png | bin | 0 -> 548 bytes | |||
| -rw-r--r-- | static/images/core/icons/registeraccount.png | bin | 0 -> 552 bytes | |||
| -rw-r--r-- | static/images/core/icons/repositories.png | bin | 0 -> 719 bytes | |||
| -rw-r--r-- | static/images/core/icons/rss.png | bin | 0 -> 1158 bytes | |||
| -rw-r--r-- | static/images/core/icons/screenshots.png | bin | 0 -> 1250 bytes | |||
| -rw-r--r-- | static/images/core/icons/shrines.png | bin | 0 -> 1586 bytes | |||
| -rw-r--r-- | static/images/core/icons/socialify.png | bin | 0 -> 8624 bytes | |||
| -rw-r--r-- | static/images/core/icons/summon_oneko.gif | bin | 0 -> 151 bytes | |||
| -rw-r--r-- | static/images/core/icons/useraccount.png | bin | 0 -> 625 bytes | |||
| -rw-r--r-- | static/images/core/icons/weblog.gif | bin | 0 -> 356 bytes | |||
| -rw-r--r-- | static/images/core/icons/webring.png | bin | 0 -> 948 bytes | |||
| -rw-r--r-- | static/images/core/icons/withdraw_oneko.gif | bin | 0 -> 160 bytes | |||
| -rw-r--r-- | templates.old/400.html (renamed from templates/400.html) | 0 | ||||
| -rw-r--r-- | templates.old/403.html (renamed from templates/403.html) | 0 | ||||
| -rw-r--r-- | templates.old/404.html (renamed from templates/404.html) | 0 | ||||
| -rw-r--r-- | templates.old/500.html (renamed from templates/500.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/account.html (renamed from templates/blog/account.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/activity.html (renamed from templates/blog/activity.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/anidata.html (renamed from templates/blog/anidata.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/anilist.html (renamed from templates/blog/anilist.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/archives.html (renamed from templates/blog/archives.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/articles.html (renamed from templates/blog/articles.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/categories.html (renamed from templates/blog/categories.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/home.html (renamed from templates/blog/home.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/partials/base.html (renamed from templates/blog/partials/base.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/partials/mathjax.html (renamed from templates/blog/partials/mathjax.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/partials/post_list.html (renamed from templates/blog/partials/post_list.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/partials/search/comment_list.html (renamed from templates/blog/partials/search/comment_list.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/partials/search/post_list.html (renamed from templates/blog/partials/search/post_list.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/partials/search/user_list.html (renamed from templates/blog/partials/search/user_list.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/partials/sidebar.html (renamed from templates/blog/partials/sidebar.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/post.html (renamed from templates/blog/post.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/register.html (renamed from templates/blog/register.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/resetpass.html (renamed from templates/blog/resetpass.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/resetpass_input.html (renamed from templates/blog/resetpass_input.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/search.html (renamed from templates/blog/search.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/site_policy.html (renamed from templates/blog/site_policy.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/socialify.html (renamed from templates/blog/socialify.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/tagged.html (renamed from templates/blog/tagged.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog/tags.html (renamed from templates/blog/tags.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog_admin/comments.html (renamed from templates/blog_admin/comments.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog_admin/edit_post.html (renamed from templates/blog_admin/edit_post.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog_admin/new_post.html (renamed from templates/blog_admin/new_post.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog_admin/partials/category_topbar.html (renamed from templates/blog_admin/partials/category_topbar.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog_admin/partials/posts_topbar.html (renamed from templates/blog_admin/partials/posts_topbar.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog_admin/partials/tags_topbar.html (renamed from templates/blog_admin/partials/tags_topbar.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog_admin/partials/users_topbar.html (renamed from templates/blog_admin/partials/users_topbar.html) | 0 | ||||
| -rw-r--r-- | templates.old/blog_admin/posts.html (renamed from templates/blog_admin/posts.html) | 0 | ||||
| -rw-r--r-- | templates.old/dev_status/home.html (renamed from templates/dev_status/home.html) | 0 | ||||
| -rw-r--r-- | templates.old/dev_status/repo.html (renamed from templates/dev_status/repo.html) | 0 | ||||
| -rw-r--r-- | templates.old/userpages/home.html (renamed from templates/userpages/home.html) | 0 | ||||
| -rw-r--r-- | templates.old/userpages/partials/base.html (renamed from templates/userpages/partials/base.html) | 0 | ||||
| -rw-r--r-- | templates.old/userpages/partials/navbar.html | 0 | ||||
| -rw-r--r-- | templates/_partials/left_sidebar.html | 605 | ||||
| -rw-r--r-- | thatcomputerscientist/settings.py | 1 | ||||
| -rw-r--r-- | thatcomputerscientist/urls.py | 5 | ||||
| -rw-r--r-- | users/functions.py | 9 |
92 files changed, 801 insertions, 105 deletions
diff --git a/templates/userpages/partials/navbar.html b/auth/__init__.py index e69de29b..e69de29b 100644 --- a/templates/userpages/partials/navbar.html +++ b/auth/__init__.py diff --git a/auth/admin.py b/auth/admin.py new file mode 100644 index 00000000..8c38f3f3 --- /dev/null +++ b/auth/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/auth/apps.py b/auth/apps.py new file mode 100644 index 00000000..836fe02b --- /dev/null +++ b/auth/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class AuthConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'auth' diff --git a/auth/migrations/__init__.py b/auth/migrations/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/auth/migrations/__init__.py diff --git a/auth/models.py b/auth/models.py new file mode 100644 index 00000000..71a83623 --- /dev/null +++ b/auth/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/auth/tests.py b/auth/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/auth/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/auth/urls.py b/auth/urls.py new file mode 100644 index 00000000..23113b17 --- /dev/null +++ b/auth/urls.py @@ -0,0 +1,8 @@ +from django.urls import path +from . import views + +app_name = "auth" +urlpatterns = [ + path("login", views.login, name="login"), + path("logout", views.logout, name="logout"), +] diff --git a/auth/views.py b/auth/views.py new file mode 100644 index 00000000..9921b17e --- /dev/null +++ b/auth/views.py @@ -0,0 +1,34 @@ +from django.contrib import messages +from django.contrib.auth import authenticate, login as auth_login, logout as auth_logout +from django.shortcuts import redirect +from users.functions import email_verified + +def login(request): + next = request.POST.get("next", "core:home").strip() + username = request.POST.get("username") + password = request.POST.get("password") + + print("Next:", next) + print("Username:", username) + print("Password:", password) + if username == "" or password == "" or username is None or password is None: + messages.error(request, "ErrorEmptyFields", extra_tags="LoginError") + return redirect(f"{next}?username={username}" if username else next) + else: + user = authenticate(request, username=username, password=password) + if user is not None: + if email_verified(user): + auth_login(request, user) + return redirect(next) + else: + messages.error(request, "ErrorEmailNotVerified", extra_tags="LoginError") + return redirect(f"{next}?username={username}") + else: + messages.error(request, "ErrorInvalidCredentials", extra_tags="LoginError") + return redirect(f"{next}?username={username}") + + +def logout(request): + auth_logout(request) + referer = request.META.get('HTTP_REFERER', '/') + return redirect(referer) diff --git a/locale/ja/LC_MESSAGES/django.po b/locale/ja/LC_MESSAGES/django.po index 1cd18f8d..77b68e97 100644 --- a/locale/ja/LC_MESSAGES/django.po +++ b/locale/ja/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-20 00:57+0000\n" +"POT-Creation-Date: 2025-05-20 01:39+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <[email protected]>\n" @@ -17,40 +17,31 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +#: templates/_partials/left_sidebar.html:11 +msgid "Username" +msgstr "ユーザー名" -#: templates/blog/home.html:8 +#: templates/_partials/left_sidebar.html:12 +msgid "Password" +msgstr "パスワード" + +#: templates/_partials/left_sidebar.html:27 #, python-format -msgid "" -"\n" -" <p>\n" -" Welcome to the home of <b>Shifoo</b> (previously <i>That Computer " -"Scientist</i>). My name is <a href=\"%(bobby_profile_url)s\">@bobby</a>, and " -"this is my personal\n" -" website. I aim to build a retro looking personal website, where I share " -"my thoughts, ideas, and experiences through articles, and will showcase some " -"cool nostalgic features and tools.\n" -" </p>\n" -" <p>\n" -" Please note that I am continuously working on this site, and it is still " -"under construction. So, not all features are available yet, and some " -"features may not work as intended.\n" -" </p>\n" -" <p>\n" -" There's also a some of <a href=\"#fun-stuff\">fun stuff</a> you can find " -"in the sidebar, that you can play around with. I will be adding more in the " -"not so distant future.\n" -" Also, To participate around various sections of the site, you will need " -"to <a href=\"%(register_url)s\">register</a> for an account. I hope you " -"enjoy your stay here.\n" -" </p>\n" -" " -msgstr "" +msgid "Hello, %(username)s" +msgstr "こんにちは、%(username)sさん" -#: thatcomputerscientist/settings.py:231 -msgid "English" -msgstr "" +#: templates/_partials/left_sidebar.html:34 +msgid "Journals" +msgstr "ジャーナル" -#: thatcomputerscientist/settings.py:232 -msgid "Japanese" -msgstr "" +#: templates/_partials/left_sidebar.html:38 +msgid "The Pagoda Realm" +msgstr "パゴダレルム" + +#: templates/_partials/left_sidebar.html:42 +msgid "My Page" +msgstr "マイページ" +#: templates/_partials/left_sidebar.html:46 +msgid "Logout" +msgstr "ログアウト" diff --git a/localegen.sh b/localegen.sh new file mode 100644 index 00000000..ab7f0888 --- /dev/null +++ b/localegen.sh @@ -0,0 +1,88 @@ +#!/bin/bash + +# Colors +CYAN='\033[0;36m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +PURPLE='\033[0;35m' +RED='\033[0;31m' +NC='\033[0m' # No Color +BOLD='\033[1m' + +clear + +# ASCII Art +echo -e "${CYAN} + ████████╗██████╗ █████╗ ███╗ ██╗███████╗██╗ █████╗ ████████╗███████╗ + ╚══██╔══╝██╔══██╗██╔══██╗████╗ ██║██╔════╝██║ ██╔══██╗╚══██╔══╝██╔════╝ + ██║ ██████╔╝███████║██╔██╗ ██║███████╗██║ ███████║ ██║ █████╗ + ██║ ██╔══██╗██╔══██║██║╚██╗██║╚════██║██║ ██╔══██║ ██║ ██╔══╝ + ██║ ██║ ██║██║ ██║██║ ╚████║███████║███████╗██║ ██║ ██║ ███████╗ + ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ + ${NC}" + +echo -e "${PURPLE} ᕕ(⌐■_■)ᕗ ${GREEN}Locale generation tool ${YELLOW}for Japanese templates${NC}\n" + +LANG_CODE="ja" + +generate_messages() { + echo -e "\n${BOLD}${YELLOW}Generating translation messages for ${LANG_CODE} (HTML templates only)...${NC}\n" + + python manage.py makemessages -l ${LANG_CODE} -e html \ + --ignore="templates.old/*" \ + --ignore="venv/*" + + echo -e "\n${GREEN}✓ Translation message files successfully generated!${NC}" + echo -e "${BLUE}You can now edit the .po files in locale/${LANG_CODE}/LC_MESSAGES/${NC}\n" +} + +compile_messages() { + echo -e "\n${BOLD}${YELLOW}Compiling translation messages for ${LANG_CODE}...${NC}\n" + + if [[ ! -d "locale/${LANG_CODE}/LC_MESSAGES" ]]; then + echo -e "${RED}Error: Could not find locale/${LANG_CODE}/LC_MESSAGES directory.${NC}" + exit 1 + fi + + cd locale/${LANG_CODE}/LC_MESSAGES || exit 1 + + if [[ ! -f "django.po" ]]; then + echo -e "${RED}Error: Could not find django.po file in locale/${LANG_CODE}/LC_MESSAGES directory.${NC}" + echo -e "${YELLOW}Tip: Run the generate option first to create translation files.${NC}" + cd - > /dev/null + exit 1 + fi + + echo -e "${BLUE}Compiling django.po...${NC}" + if msgfmt django.po -o django.mo; then + echo -e "${GREEN}✓ Compiled django.mo successfully.${NC}" + else + echo -e "${RED}Error: Failed to compile django.po${NC}" + cd - > /dev/null + exit 1 + fi + + cd - > /dev/null + echo -e "\n${GREEN}✓ Translation messages compilation complete!${NC}\n" +} + +echo -e "${BOLD}${CYAN}What do you want to do?${NC}" +echo -e " ${GREEN}g${NC} - Generate translation messages" +echo -e " ${BLUE}c${NC} - Compile translation messages" +echo -n -e "${YELLOW}Choose an option ${NC}[${GREEN}g${NC}]: " +read -n 1 action +echo "" + +case "$action" in + "g"|"") + generate_messages + ;; + "c") + compile_messages + ;; + *) + echo -e "\n${RED}Error: Invalid option. Use 'g' for generate or 'c' for compile.${NC}" + exit 1 + ;; +esac
\ No newline at end of file diff --git a/middleware/userprofilemiddleware.py b/middleware/userprofilemiddleware.py new file mode 100644 index 00000000..724f7f04 --- /dev/null +++ b/middleware/userprofilemiddleware.py @@ -0,0 +1,14 @@ +from django.utils.deprecation import MiddlewareMixin +from users.models import UserProfile + +class UserProfileMiddleware(MiddlewareMixin): + def process_request(self, request): + if request.user.is_authenticated: + try: + user_profile = UserProfile.objects.get(user=request.user) + except UserProfile.DoesNotExist: + user_profile = UserProfile(user=request.user) + user_profile.save() + request.user.profile = user_profile + else: + request.user.profile = None
\ No newline at end of file diff --git a/runserver.sh b/runserver.sh deleted file mode 100755 index 5a84a06c..00000000 --- a/runserver.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -# Function to check if mkcert is installed -check_mkcert_installed() { - if ! command -v mkcert &> /dev/null; then - echo "mkcert is not installed. Installing mkcert..." - brew install mkcert # Assuming you're using Homebrew to install mkcert - fi -} - -# Function to check if the mkcert local CA is installed and install it if not present -check_and_install_local_ca() { - if ! mkcert -CAROOT &> /dev/null; then - echo "Installing mkcert local CA..." - mkcert -install - fi -} - -# Function to set the DOMAIN value in the .env file -set_domain_in_env() { - domain=$1 - sed -i "" "s/^DOMAIN=.*/DOMAIN='.${domain}'/" .env -} - -# Function to run the development server -run_dev_server() { - domain=$1 - cert_file="SSL/${domain}+1.pem" - key_file="SSL/${domain}+1-key.pem" - - if [[ -f "$cert_file" && -f "$key_file" ]]; then - set_domain_in_env "$domain" - sudo python3 manage.py runsslserver 127.0.0.1:443 --certificate "$cert_file" --key "$key_file" - else - echo "Certificate files not found. Generating self-signed certificate..." - mkdir -p SSL && cd SSL - mkcert "${domain}" "*.${domain}" - cd .. - set_domain_in_env "$domain" - sudo python3 manage.py runsslserver 127.0.0.1:443 --certificate "$cert_file" --key "$key_file" - fi -} - -# Main script - -# Check if mkcert is installed and install if not present -check_mkcert_installed - -# Present options to the user -echo "Choose an option:" -echo "[1]: (*).[peek].shi.foo" -echo "[2]: (*).[peek].thatcomputerscientist.com" -read -p "Enter your choice (1 or 2): " choice - -case $choice in - 1) - domain="peek.shi.foo" - check_and_install_local_ca - run_dev_server "$domain" - ;; - 2) - domain="peek.thatcomputerscientist.com" - check_and_install_local_ca - run_dev_server "$domain" - ;; - *) - echo "Invalid choice. Exiting..." - exit 1 - ;; -esac diff --git a/static/images/core/icons/anime.png b/static/images/core/icons/anime.png Binary files differnew file mode 100644 index 00000000..27750e47 --- /dev/null +++ b/static/images/core/icons/anime.png diff --git a/static/images/core/icons/calendar.png b/static/images/core/icons/calendar.png Binary files differnew file mode 100644 index 00000000..fc024771 --- /dev/null +++ b/static/images/core/icons/calendar.png diff --git a/static/images/core/icons/census.png b/static/images/core/icons/census.png Binary files differnew file mode 100644 index 00000000..c13d25d4 --- /dev/null +++ b/static/images/core/icons/census.png diff --git a/static/images/core/icons/changelanguage.png b/static/images/core/icons/changelanguage.png Binary files differnew file mode 100644 index 00000000..d2f4df83 --- /dev/null +++ b/static/images/core/icons/changelanguage.png diff --git a/static/images/core/icons/chatrooms.png b/static/images/core/icons/chatrooms.png Binary files differnew file mode 100644 index 00000000..0641f621 --- /dev/null +++ b/static/images/core/icons/chatrooms.png diff --git a/static/images/core/icons/coin.png b/static/images/core/icons/coin.png Binary files differnew file mode 100644 index 00000000..4be6fe09 --- /dev/null +++ b/static/images/core/icons/coin.png diff --git a/static/images/core/icons/discussions.png b/static/images/core/icons/discussions.png Binary files differnew file mode 100644 index 00000000..0fb0bd5f --- /dev/null +++ b/static/images/core/icons/discussions.png diff --git a/static/images/core/icons/dvd.png b/static/images/core/icons/dvd.png Binary files differnew file mode 100644 index 00000000..ee045037 --- /dev/null +++ b/static/images/core/icons/dvd.png diff --git a/static/images/core/icons/folder.png b/static/images/core/icons/folder.png Binary files differnew file mode 100644 index 00000000..807f1690 --- /dev/null +++ b/static/images/core/icons/folder.png diff --git a/static/images/core/icons/games.png b/static/images/core/icons/games.png Binary files differnew file mode 100644 index 00000000..1bd3fc2e --- /dev/null +++ b/static/images/core/icons/games.png diff --git a/static/images/core/icons/guestbook.png b/static/images/core/icons/guestbook.png Binary files differnew file mode 100644 index 00000000..0cf514c4 --- /dev/null +++ b/static/images/core/icons/guestbook.png diff --git a/static/images/core/icons/harlemshake.gif b/static/images/core/icons/harlemshake.gif Binary files differnew file mode 100644 index 00000000..0ef493b0 --- /dev/null +++ b/static/images/core/icons/harlemshake.gif diff --git a/static/images/core/icons/home.png b/static/images/core/icons/home.png Binary files differnew file mode 100644 index 00000000..0bfbd03c --- /dev/null +++ b/static/images/core/icons/home.png diff --git a/static/images/core/icons/journalofrandomthoughts.png b/static/images/core/icons/journalofrandomthoughts.png Binary files differnew file mode 100644 index 00000000..845863a2 --- /dev/null +++ b/static/images/core/icons/journalofrandomthoughts.png diff --git a/static/images/core/icons/journals.png b/static/images/core/icons/journals.png Binary files differnew file mode 100644 index 00000000..535e090e --- /dev/null +++ b/static/images/core/icons/journals.png diff --git a/static/images/core/icons/logout.png b/static/images/core/icons/logout.png Binary files differnew file mode 100644 index 00000000..61b7b260 --- /dev/null +++ b/static/images/core/icons/logout.png diff --git a/static/images/core/icons/marketplace.png b/static/images/core/icons/marketplace.png Binary files differnew file mode 100644 index 00000000..c231f8f8 --- /dev/null +++ b/static/images/core/icons/marketplace.png diff --git a/static/images/core/icons/matrix.png b/static/images/core/icons/matrix.png Binary files differnew file mode 100644 index 00000000..d445aa1c --- /dev/null +++ b/static/images/core/icons/matrix.png diff --git a/static/images/core/icons/music.png b/static/images/core/icons/music.png Binary files differnew file mode 100644 index 00000000..68bb414d --- /dev/null +++ b/static/images/core/icons/music.png diff --git a/static/images/core/icons/myanimelist.png b/static/images/core/icons/myanimelist.png Binary files differnew file mode 100644 index 00000000..a079fb91 --- /dev/null +++ b/static/images/core/icons/myanimelist.png diff --git a/static/images/core/icons/mypage.png b/static/images/core/icons/mypage.png Binary files differnew file mode 100644 index 00000000..3e7c64f7 --- /dev/null +++ b/static/images/core/icons/mypage.png diff --git a/static/images/core/icons/pagodarealm.png b/static/images/core/icons/pagodarealm.png Binary files differnew file mode 100644 index 00000000..df1bcfab --- /dev/null +++ b/static/images/core/icons/pagodarealm.png diff --git a/static/images/core/icons/pamphlet.png b/static/images/core/icons/pamphlet.png Binary files differnew file mode 100644 index 00000000..397063ef --- /dev/null +++ b/static/images/core/icons/pamphlet.png diff --git a/static/images/core/icons/preferences.png b/static/images/core/icons/preferences.png Binary files differnew file mode 100644 index 00000000..5d977bfb --- /dev/null +++ b/static/images/core/icons/preferences.png diff --git a/static/images/core/icons/registeraccount.png b/static/images/core/icons/registeraccount.png Binary files differnew file mode 100644 index 00000000..071ceff2 --- /dev/null +++ b/static/images/core/icons/registeraccount.png diff --git a/static/images/core/icons/repositories.png b/static/images/core/icons/repositories.png Binary files differnew file mode 100644 index 00000000..6c2f4bba --- /dev/null +++ b/static/images/core/icons/repositories.png diff --git a/static/images/core/icons/rss.png b/static/images/core/icons/rss.png Binary files differnew file mode 100644 index 00000000..73d16e8a --- /dev/null +++ b/static/images/core/icons/rss.png diff --git a/static/images/core/icons/screenshots.png b/static/images/core/icons/screenshots.png Binary files differnew file mode 100644 index 00000000..563dd621 --- /dev/null +++ b/static/images/core/icons/screenshots.png diff --git a/static/images/core/icons/shrines.png b/static/images/core/icons/shrines.png Binary files differnew file mode 100644 index 00000000..f0000eba --- /dev/null +++ b/static/images/core/icons/shrines.png diff --git a/static/images/core/icons/socialify.png b/static/images/core/icons/socialify.png Binary files differnew file mode 100644 index 00000000..529d0cae --- /dev/null +++ b/static/images/core/icons/socialify.png diff --git a/static/images/core/icons/summon_oneko.gif b/static/images/core/icons/summon_oneko.gif Binary files differnew file mode 100644 index 00000000..5f43a2ce --- /dev/null +++ b/static/images/core/icons/summon_oneko.gif diff --git a/static/images/core/icons/useraccount.png b/static/images/core/icons/useraccount.png Binary files differnew file mode 100644 index 00000000..2938efb7 --- /dev/null +++ b/static/images/core/icons/useraccount.png diff --git a/static/images/core/icons/weblog.gif b/static/images/core/icons/weblog.gif Binary files differnew file mode 100644 index 00000000..53bb81db --- /dev/null +++ b/static/images/core/icons/weblog.gif diff --git a/static/images/core/icons/webring.png b/static/images/core/icons/webring.png Binary files differnew file mode 100644 index 00000000..b89e422a --- /dev/null +++ b/static/images/core/icons/webring.png diff --git a/static/images/core/icons/withdraw_oneko.gif b/static/images/core/icons/withdraw_oneko.gif Binary files differnew file mode 100644 index 00000000..b7cddb4c --- /dev/null +++ b/static/images/core/icons/withdraw_oneko.gif diff --git a/templates/400.html b/templates.old/400.html index 41beaa4e..41beaa4e 100644 --- a/templates/400.html +++ b/templates.old/400.html diff --git a/templates/403.html b/templates.old/403.html index 1ab86cd6..1ab86cd6 100644 --- a/templates/403.html +++ b/templates.old/403.html diff --git a/templates/404.html b/templates.old/404.html index 455f1659..455f1659 100644 --- a/templates/404.html +++ b/templates.old/404.html diff --git a/templates/500.html b/templates.old/500.html index f61b46fa..f61b46fa 100644 --- a/templates/500.html +++ b/templates.old/500.html diff --git a/templates/blog/account.html b/templates.old/blog/account.html index 7af89675..7af89675 100644 --- a/templates/blog/account.html +++ b/templates.old/blog/account.html diff --git a/templates/blog/activity.html b/templates.old/blog/activity.html index d963fe1d..d963fe1d 100644 --- a/templates/blog/activity.html +++ b/templates.old/blog/activity.html diff --git a/templates/blog/anidata.html b/templates.old/blog/anidata.html index 78e7106c..78e7106c 100644 --- a/templates/blog/anidata.html +++ b/templates.old/blog/anidata.html diff --git a/templates/blog/anilist.html b/templates.old/blog/anilist.html index 2ab01484..2ab01484 100644 --- a/templates/blog/anilist.html +++ b/templates.old/blog/anilist.html diff --git a/templates/blog/archives.html b/templates.old/blog/archives.html index 09ec4963..09ec4963 100644 --- a/templates/blog/archives.html +++ b/templates.old/blog/archives.html diff --git a/templates/blog/articles.html b/templates.old/blog/articles.html index 87bb53cf..87bb53cf 100644 --- a/templates/blog/articles.html +++ b/templates.old/blog/articles.html diff --git a/templates/blog/categories.html b/templates.old/blog/categories.html index b95403ea..b95403ea 100644 --- a/templates/blog/categories.html +++ b/templates.old/blog/categories.html diff --git a/templates/blog/home.html b/templates.old/blog/home.html index 739c5227..739c5227 100644 --- a/templates/blog/home.html +++ b/templates.old/blog/home.html diff --git a/templates/blog/partials/base.html b/templates.old/blog/partials/base.html index ea517166..ea517166 100644 --- a/templates/blog/partials/base.html +++ b/templates.old/blog/partials/base.html diff --git a/templates/blog/partials/mathjax.html b/templates.old/blog/partials/mathjax.html index dd1944d4..dd1944d4 100644 --- a/templates/blog/partials/mathjax.html +++ b/templates.old/blog/partials/mathjax.html diff --git a/templates/blog/partials/post_list.html b/templates.old/blog/partials/post_list.html index d72bd723..d72bd723 100644 --- a/templates/blog/partials/post_list.html +++ b/templates.old/blog/partials/post_list.html diff --git a/templates/blog/partials/search/comment_list.html b/templates.old/blog/partials/search/comment_list.html index 7afbced0..7afbced0 100644 --- a/templates/blog/partials/search/comment_list.html +++ b/templates.old/blog/partials/search/comment_list.html diff --git a/templates/blog/partials/search/post_list.html b/templates.old/blog/partials/search/post_list.html index 811c417e..811c417e 100644 --- a/templates/blog/partials/search/post_list.html +++ b/templates.old/blog/partials/search/post_list.html diff --git a/templates/blog/partials/search/user_list.html b/templates.old/blog/partials/search/user_list.html index 3493508c..3493508c 100644 --- a/templates/blog/partials/search/user_list.html +++ b/templates.old/blog/partials/search/user_list.html diff --git a/templates/blog/partials/sidebar.html b/templates.old/blog/partials/sidebar.html index 458ddbee..458ddbee 100644 --- a/templates/blog/partials/sidebar.html +++ b/templates.old/blog/partials/sidebar.html diff --git a/templates/blog/post.html b/templates.old/blog/post.html index 5a98e981..5a98e981 100644 --- a/templates/blog/post.html +++ b/templates.old/blog/post.html diff --git a/templates/blog/register.html b/templates.old/blog/register.html index 16ff128a..16ff128a 100644 --- a/templates/blog/register.html +++ b/templates.old/blog/register.html diff --git a/templates/blog/resetpass.html b/templates.old/blog/resetpass.html index 81c68c56..81c68c56 100644 --- a/templates/blog/resetpass.html +++ b/templates.old/blog/resetpass.html diff --git a/templates/blog/resetpass_input.html b/templates.old/blog/resetpass_input.html index 939eab9d..939eab9d 100644 --- a/templates/blog/resetpass_input.html +++ b/templates.old/blog/resetpass_input.html diff --git a/templates/blog/search.html b/templates.old/blog/search.html index 721f8d8d..721f8d8d 100644 --- a/templates/blog/search.html +++ b/templates.old/blog/search.html diff --git a/templates/blog/site_policy.html b/templates.old/blog/site_policy.html index 683e2c07..683e2c07 100644 --- a/templates/blog/site_policy.html +++ b/templates.old/blog/site_policy.html diff --git a/templates/blog/socialify.html b/templates.old/blog/socialify.html index f48eba25..f48eba25 100644 --- a/templates/blog/socialify.html +++ b/templates.old/blog/socialify.html diff --git a/templates/blog/tagged.html b/templates.old/blog/tagged.html index 192ef2ee..192ef2ee 100644 --- a/templates/blog/tagged.html +++ b/templates.old/blog/tagged.html diff --git a/templates/blog/tags.html b/templates.old/blog/tags.html index 44dcac61..44dcac61 100644 --- a/templates/blog/tags.html +++ b/templates.old/blog/tags.html diff --git a/templates/blog_admin/comments.html b/templates.old/blog_admin/comments.html index 95ae1d96..95ae1d96 100644 --- a/templates/blog_admin/comments.html +++ b/templates.old/blog_admin/comments.html diff --git a/templates/blog_admin/edit_post.html b/templates.old/blog_admin/edit_post.html index 6ce7af18..6ce7af18 100644 --- a/templates/blog_admin/edit_post.html +++ b/templates.old/blog_admin/edit_post.html diff --git a/templates/blog_admin/new_post.html b/templates.old/blog_admin/new_post.html index c2e911b6..c2e911b6 100644 --- a/templates/blog_admin/new_post.html +++ b/templates.old/blog_admin/new_post.html diff --git a/templates/blog_admin/partials/category_topbar.html b/templates.old/blog_admin/partials/category_topbar.html index a52b2bb3..a52b2bb3 100644 --- a/templates/blog_admin/partials/category_topbar.html +++ b/templates.old/blog_admin/partials/category_topbar.html diff --git a/templates/blog_admin/partials/posts_topbar.html b/templates.old/blog_admin/partials/posts_topbar.html index b9bad541..b9bad541 100644 --- a/templates/blog_admin/partials/posts_topbar.html +++ b/templates.old/blog_admin/partials/posts_topbar.html diff --git a/templates/blog_admin/partials/tags_topbar.html b/templates.old/blog_admin/partials/tags_topbar.html index c4a49ccf..c4a49ccf 100644 --- a/templates/blog_admin/partials/tags_topbar.html +++ b/templates.old/blog_admin/partials/tags_topbar.html diff --git a/templates/blog_admin/partials/users_topbar.html b/templates.old/blog_admin/partials/users_topbar.html index a0be6122..a0be6122 100644 --- a/templates/blog_admin/partials/users_topbar.html +++ b/templates.old/blog_admin/partials/users_topbar.html diff --git a/templates/blog_admin/posts.html b/templates.old/blog_admin/posts.html index a8aac92c..a8aac92c 100644 --- a/templates/blog_admin/posts.html +++ b/templates.old/blog_admin/posts.html diff --git a/templates/dev_status/home.html b/templates.old/dev_status/home.html index 18574c0a..18574c0a 100644 --- a/templates/dev_status/home.html +++ b/templates.old/dev_status/home.html diff --git a/templates/dev_status/repo.html b/templates.old/dev_status/repo.html index c5df710b..c5df710b 100644 --- a/templates/dev_status/repo.html +++ b/templates.old/dev_status/repo.html diff --git a/templates/userpages/home.html b/templates.old/userpages/home.html index 68a13b2c..68a13b2c 100644 --- a/templates/userpages/home.html +++ b/templates.old/userpages/home.html diff --git a/templates/userpages/partials/base.html b/templates.old/userpages/partials/base.html index d6dd452a..d6dd452a 100644 --- a/templates/userpages/partials/base.html +++ b/templates.old/userpages/partials/base.html diff --git a/templates.old/userpages/partials/navbar.html b/templates.old/userpages/partials/navbar.html new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/templates.old/userpages/partials/navbar.html diff --git a/templates/_partials/left_sidebar.html b/templates/_partials/left_sidebar.html index e69de29b..8e1445a8 100644 --- a/templates/_partials/left_sidebar.html +++ b/templates/_partials/left_sidebar.html @@ -0,0 +1,605 @@ +{% load static %} +{% load i18n %} +{% block head %} + <link rel="stylesheet" href="{% static 'css/shared/sidebar.css' %}" /> +{% endblock %} +<div class="left-sidebar{% if user.is_authenticated %} left-sidebar-authenticated{% endif %}"> + {% if not user.is_authenticated %} + {% for message in messages %} + {% if 'LoginError' in message.tags %} + <div id="login-error"> + <div class="messageBox">{{ message.message }}</div> + </div> + {% endif %} + {% endfor %} + <div id="login-area"> + <form method="post" action="{% url 'auth:login' %}" id="login-form"> + {% csrf_token %} + <input type="text" id="username" name="username" placeholder="{% translate 'Username' %}" autocomplete="off" value="{{ request.GET.username }}" /> + <input type="password" id="password" name="password" placeholder="{% translate 'Password' %}" autocomplete="off" /> + <input type="hidden" + name="next" + value="{% if request.GET.next %} + {{ request.GET.next }} + {% else %} + {{ request.path }} + {% endif %}" /> + <input type="submit" value="" /> + </form> + <button id="register-now-button"></button> + <button id="forgot-password-button"></button> + </div> + {% else %} + <div id="user-area"> + <h2 class="user-title">{% blocktranslate with username=user.username %}Hello, {{ username }}{% endblocktranslate %}</h2> + <div class="user-avatar"> + <img src="{% static 'images/avatars/' %}{{ user.profile.avatar_url }}.gif" alt="{{ user.username }}'s avatar" /> + </div> + <div class="user-items-container"> + <div class="user-item"> + <img src="{% static 'images/core/icons/journals.png' %}" alt="Journals Icon" /> + <a href="">{% translate 'Journals' %}</a> + </div> + <div class="user-item"> + <img src="{% static 'images/core/icons/pagodarealm.png' %}" alt="The Pagoda Realm Icon" /> + <a href="">{% translate 'The Pagoda Realm' %}</a> + </div> + <div class="user-item"> + <img src="{% static 'images/core/icons/mypage.png' %}" alt="My Page Icon" /> + <a href="#mypage">{% translate 'My Page' %}</a> + </div> + <div class="user-item"> + <img src="{% static 'images/core/icons/logout.png' %}" alt="Logout Icon" /> + <a href="{% url 'auth:logout' %}">{% translate 'Logout' %}</a> + </div> + </div> + </div> + {% endif %} +</div> + +{% comment %} {% load static %} +<div class="left-sidebar"> + <link rel="stylesheet" href="{% static 'css/shared/login-area.css' %}" /> + {% if request.LANGUAGE_CODE == 'ja' %} + <link rel="stylesheet" href="{% static 'css/ja/login-area.css' %}" /> + {% else %} + <link rel="stylesheet" href="{% static 'css/en/login-area.css' %}" /> + {% endif %} + {% if not user.is_authenticated %} + {% for message in messages %} + {% if 'loginError' in message.tags %} + <div id="login-error"> + <div class="messageBox {{ message.message }}"></div> + </div> + {% endif %} + {% endfor %} + <div id="login-area"> + <form method="post" action="{% url 'auth:login' %}" id="login-form"> + <input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}" /> + <input type="text" + id="username" + name="username" + placeholder="{% if request.LANGUAGE_CODE == 'ja' %} + + + + ユーザー名 + + + + {% else %} + + + + Username + + + + + {% endif %}" + autocomplete="off" + value="{{ request.GET.username }}" /> + <input type="password" + id="password" + name="password" + placeholder="{% if request.LANGUAGE_CODE == 'ja' %} + + + + パスワード + + + + + {% else %} + + + + Password + + + + + {% endif %}" + autocomplete="off" /> + <input type="hidden" + name="next" + value="{% if request.GET.next %} + {{ request.GET.next }} + {% else %} + {{ request.path }} + {% endif %}" /> + <input type="submit" value="" /> + </form> + <a href="#" id="register-now-button"></a> + <a href="#" id="forgot-password-button"></a> + </div> + {% else %} + <div id="user-area"> + <h2 class="user-title"> + {% if request.LANGUAGE_CODE == 'ja' %} + こんにちは、{{ user.username }}さん + {% else %} + Hello, {{ user.username }} + {% endif %} + </h2> + <div class="user-avatar"> + <img src="{% static 'images/avatars/' %}{{ user.profile.avatar_url }}.gif" alt="{{ user.username }}'s avatar" /> + </div> + <div class="user-items-container"> + <div class="user-item"> + <img src="{% static 'images/core/icons/journals.png' %}" alt="Journals Icon" /> + <a href="{% url 'core:my_journals' %}"> + {% if request.LANGUAGE_CODE == 'ja' %} + ジャーナル + {% else %} + Journals + {% endif %} + </a> + </div> + <div class="user-item"> + <img src="{% static 'images/core/icons/pagodarealm.png' %}" alt="The Pagoda Realm Icon" /> + <a href="{% url 'pagoda:home' %}"> + {% if request.LANGUAGE_CODE == 'ja' %} + パゴダレルム + {% else %} + The Pagoda Realm + {% endif %} + </a> + </div> + <div class="user-item"> + <img src="{% static 'images/core/icons/mypage.png' %}" alt="My Page Icon" /> + <a href="#mypage"> + {% if request.LANGUAGE_CODE == 'ja' %} + マイページ + {% else %} + My Page + {% endif %} + </a> + </div> + <div class="user-item"> + <img src="{% static 'images/core/icons/logout.png' %}" alt="Logout Icon" /> + <a href="{% url 'auth:logout' %}"> + {% if request.LANGUAGE_CODE == 'ja' %} + ログアウト + {% else %} + Logout + {% endif %} + </a> + </div> + </div> + </div> + {% endif %} + + <div class="navigation-links"> + <div class="navigation-title-container"> + <h1 class="navigation-title"> + {% if request.LANGUAGE_CODE == 'ja' %} + ナビゲーション + {% else %} + Navigation + {% endif %} + </h1> + </div> + <div class="navigation-items-container"> + <div class="navigation-item"> + <img src="{% static 'images/core/icons/home.png' %}" alt="Home Icon" /> + <a href="{% url 'core:home' %}"> + {% if request.LANGUAGE_CODE == 'ja' %} + ホーム + {% else %} + Home + {% endif %} + </a> + </div> + <div class="navigation-item"> + <img src="{% static 'images/core/icons/journalofrandomthoughts.png' %}" alt="Journal of Random Thoughts Icon" /> + <a href="{% url 'journal:journal_of_random_thoughts' %}"> + {% if request.LANGUAGE_CODE == 'ja' %} + ランダム思考のジャーナル + {% else %} + Journal of Random Thoughts + {% endif %} + </a> + </div> + <div class="navigation-item"> + <img src="{% static 'images/core/icons/weblog.gif' %}" alt="Weblog Icon" /> + <a href="#weblog"> + {% if request.LANGUAGE_CODE == 'ja' %} + ウェブログ + {% else %} + Weblog + {% endif %} + </a> + </div> + <div class="navigation-item"> + <img src="{% static 'images/core/icons/shrines.png' %}" alt="Shrines Icon" /> + <a href="#shrines"> + {% if request.LANGUAGE_CODE == 'ja' %} + 神社 + {% else %} + Shrines + {% endif %} + </a> + </div> + <div class="navigation-item"> + <img src="{% static 'images/core/icons/screenshots.png' %}" alt="Screenshots Icon" /> + <a href="#screenshots"> + {% if request.LANGUAGE_CODE == 'ja' %} + スクリーンショット + {% else %} + Screenshots + {% endif %} + </a> + </div> + <div class="navigation-item"> + <img src="{% static 'images/core/icons/chatrooms.png' %}" alt="Chatrooms Icon" /> + <a href="#chatrooms"> + {% if request.LANGUAGE_CODE == 'ja' %} + チャットルーム + {% else %} + Chatrooms + {% endif %} + </a> + </div> + <div class="navigation-item"> + <img src="{% static 'images/core/icons/guestbook.png' %}" alt="Guestbook Icon" /> + <a href="#guestbook"> + {% if request.LANGUAGE_CODE == 'ja' %} + ゲストブック + {% else %} + Guestbook + {% endif %} + </a> + </div> + <div class="navigation-item"> + <img src="{% static 'images/core/icons/preferences.png' %}" alt="Site Preferences Icon" /> + <a href="#preferences"> + {% if request.LANGUAGE_CODE == 'ja' %} + サイトの設定 + {% else %} + Site Preferences + {% endif %} + </a> + </div> + <div class="navigation-item"> + {% if not user.is_authenticated %} + <img src="{% static 'images/core/icons/registeraccount.png' %}" alt="Register Account Icon" /> + <a href="#register"> + {% if request.LANGUAGE_CODE == 'ja' %} + アカウント登録 + {% else %} + Register Account + {% endif %} + </a> + {% else %} + <img src="{% static 'images/core/icons/useraccount.png' %}" alt="My Account Icon" /> + <a href="#account"> + {% if request.LANGUAGE_CODE == 'ja' %} + マイアカウント + {% else %} + My Account + {% endif %} + </a> + {% endif %} + </div> + + <div class="navigation-item {% if request.LANGUAGE_CODE == 'ja' %} + + + + + + + + + + + + + en + + + + + {% else %} + + + + + + + + + + + + + ja + + + + + {% endif %}"> + <img src="{% static 'images/core/icons/changelanguage.png' %}" alt="Change Language Icon" /> + <a href="javascript:void(0);" + onclick="changeLanguage({% if request.LANGUAGE_CODE == 'ja' %} + + + + 'en' + + + + + {% else %} + + + + 'ja' + + + + + {% endif %})"> + {% if request.LANGUAGE_CODE == 'ja' %} + English (英語) + {% else %} + 日本語 (Japanese) + {% endif %} + </a> + </div> + </div> + </div> + + <div id="search-area"> + <form action="#" method="get" id="search-form"> + <input type="text" + name="q" + placeholder="{% if request.LANGUAGE_CODE == 'ja' %} + + + + + + + + + + + + + 検索 + + + + + {% else %} + + + + + + + + + + + + + Search + + + + + {% endif %}" + autocomplete="off" + value="{{ request.GET.q }}" + required /> + </form> + </div> + <div class="navigation-links"> + <div class="navigation-title-container"> + <h1 class="navigation-title"> + {% if request.LANGUAGE_CODE == 'ja' %} + おすすめ + {% else %} + The Good Stuff + {% endif %} + </h1> + </div> + <div class="navigation-items-container"> + <div class="navigation-item"> + <img src="{% static 'images/core/icons/calendar.png' %}" alt="Calendar Icon" /> + <a href="#calendar"> + {% if request.LANGUAGE_CODE == 'ja' %} + ブログカレンダー + {% else %} + Post Calendar + {% endif %} + </a> + </div> + <div class="navigation-item"> + <img src="{% static 'images/core/icons/anime.png' %}" alt="Anime Icon" /> + <a href="{% url 'anime:home' %}"> + {% if request.LANGUAGE_CODE == 'ja' %} + アニメ配信 + {% else %} + Anime Streams + {% endif %} + </a> + </div> + <div class="navigation-item"> + <img src="{% static 'images/core/icons/matrix.png' %}" alt="The Matrix Icon" /> + <a href="#matrix"> + {% if request.LANGUAGE_CODE == 'ja' %} + ザ・マトリックス + {% else %} + The Matrix + {% endif %} + </a> + </div> + <div class="navigation-item"> + <img src="{% static 'images/core/icons/rss.png' %}" alt="RSS Icon" /> + <a href="#rss"> + {% if request.LANGUAGE_CODE == 'ja' %} + RSSフィード + {% else %} + RSS Feed + {% endif %} + </a> + </div> + <div class="navigation-item"> + <img src="{% static 'images/core/icons/marketplace.png' %}" alt="Marketplace Icon" /> + <a href="#marketplace"> + {% if request.LANGUAGE_CODE == 'ja' %} + マーケットプレイス + {% else %} + Marketplace + {% endif %} + </a> + </div> + <div class="navigation-item"> + <img src="{% static 'images/core/icons/discussions.png' %}" alt="Discussions Icon" /> + <a href="#discussions"> + {% if request.LANGUAGE_CODE == 'ja' %} + ディスカッション + {% else %} + Discussions + {% endif %} + </a> + </div> + </div> + </div> + + <div class="pamphlet pamphlet-big"></div> + + <div class="navigation-links"> + <div class="navigation-title-container"> + <h1 class="navigation-title"> + {% if request.LANGUAGE_CODE == 'ja' %} + サイトの魔法 + {% else %} + Site Spells + {% endif %} + </h1> + </div> + <div class="navigation-items-container"> + <div class="navigation-item"> + {% if request.COOKIES.summonOneko == 'true' %} + <img src="{% static 'images/core/icons/withdraw_oneko.gif' %}" alt="Withdraw Oneko Icon" /> + <a href="javascript:void(0);" onclick="document.cookie = 'summonOneko=false;path=/';location.reload();"> + {% if request.LANGUAGE_CODE == 'ja' %} + おねこを引っ込める + {% else %} + Withdraw Oneko + {% endif %} + </a> + {% else %} + <img src="{% static 'images/core/icons/summon_oneko.gif' %}" alt="Summon Oneko Icon" /> + <a href="javascript:void(0);" onclick="document.cookie = 'summonOneko=true;path=/';location.reload();"> + {% if request.LANGUAGE_CODE == 'ja' %} + おねこを召喚 + {% else %} + Summon Oneko + {% endif %} + </a> + {% endif %} + </div> + <div class="navigation-item"> + <img src="{% static 'images/core/icons/harlemshake.gif' %}" alt="Harlem Shake Icon" /> + <a href="javascript:harlemShakeAndBake();"> + {% if request.LANGUAGE_CODE == 'ja' %} + ハーレムシェイク + {% else %} + Harlem Shake + {% endif %} + </a> + </div> + <div class="navigation-item"> + <img src="{% static 'images/core/icons/dvd.png' %}" alt="DVD Sitesaver Icon" /> + <a href="javascript:dvdSitesaver();"> + {% if request.LANGUAGE_CODE == 'ja' %} + DVDサイトセーバー + {% else %} + DVD Sitesaver + {% endif %} + </a> + </div> + </div> + </div> + + {% if user.is_staff or user.is_superuser %} + <div class="navigation-links"> + <div class="navigation-title-container"> + <h1 class="navigation-title"> + {% if request.LANGUAGE_CODE == 'ja' %} + アドミンアレア + {% else %} + Admin Area + {% endif %} + </h1> + </div> + <div class="navigation-items-container"> + <div class="navigation-item"> + <img src="{% static 'images/core/gifs/right_hand.gif' %}" alt="Manage Announcements Icon" /> + <a href="#manage-announcements"> + {% if request.LANGUAGE_CODE == 'ja' %} + アナウンスメント管理 + {% else %} + Manage Announcements + {% endif %} + </a> + </div> + <div class="navigation-item"> + <img src="{% static 'images/core/gifs/right_hand.gif' %}" alt="Manage Users Icon" /> + <a href="#manage-users"> + {% if request.LANGUAGE_CODE == 'ja' %} + ユーザー管理 + {% else %} + Manage Users + {% endif %} + </a> + </div> + <div class="navigation-item"> + <img src="{% static 'images/core/gifs/right_hand.gif' %}" alt="Manage Storage Buckets Icon" /> + <a href="{% url 'administration:manage_storage_buckets' %}"> + {% if request.LANGUAGE_CODE == 'ja' %} + ストレージバケット管理 + {% else %} + Manage Storage Buckets + {% endif %} + </a> + </div> + </div> + </div> + {% endif %} + <p class="sidebar-credits">This website uses cookies and there's nothing you can do about it!</p> +</div> + +<script> + function changeLanguage(language) { + document.cookie = `site_language=${language};path=/` + location.reload() + } +</script> {% endcomment %} diff --git a/thatcomputerscientist/settings.py b/thatcomputerscientist/settings.py index 823ed0e8..6e4ee98d 100644 --- a/thatcomputerscientist/settings.py +++ b/thatcomputerscientist/settings.py @@ -111,6 +111,7 @@ MIDDLEWARE = [ "django.middleware.clickjacking.XFrameOptionsMiddleware", "middleware.globalmetamiddleware.GlobalMetaMiddleware", "middleware.i18nmiddleware.I18NMiddleware", + "middleware.userprofilemiddleware.UserProfileMiddleware", # "whitenoise.middleware.WhiteNoiseMiddleware", # "middleware.oldbrowsermiddleware.OldBrowserMiddleware", # "middleware.ignismiddleware.IgnisMiddleware", diff --git a/thatcomputerscientist/urls.py b/thatcomputerscientist/urls.py index caa7fb77..1b86eae2 100644 --- a/thatcomputerscientist/urls.py +++ b/thatcomputerscientist/urls.py @@ -35,9 +35,10 @@ handler404 = 'thatcomputerscientist.error_handler.custom_404' urlpatterns = [ path('', include('core.urls', namespace='core')), + # Authentication + path('auth/', include('auth.urls', namespace='auth')), - - # Django Admin + # Administration path('admin/administration/', admin.site.urls), diff --git a/users/functions.py b/users/functions.py new file mode 100644 index 00000000..ccf1a7a6 --- /dev/null +++ b/users/functions.py @@ -0,0 +1,9 @@ +from users.models import UserProfile + +def email_verified(user): + profile = UserProfile.objects.get(user=user) + if profile.email_verified: + return True + else: + return False +
\ No newline at end of file |
