Skip to content

new redesign via vibe coding #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/blog/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

class BlogConfig(AppConfig):
name = 'apps.blog'
default_auto_field = "django.db.models.BigAutoField"
15 changes: 0 additions & 15 deletions apps/blog/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,6 @@ def get_queryset(self):
)


class SubscriptionView(View):
def post(self, request):
form = EmailForm(request.POST)
if form.is_valid():
try:
EmailSubscription.objects.create(
email=form.cleaned_data['email'],
lang=translation.get_language()
)
except: # duplicate email
pass
return HttpResponseRedirect(reverse('blog:posts'))


class SearchView(View):
def get(self, request):
lang_mapping = {'en': 'english', 'ru': 'russian'}
Expand All @@ -150,5 +136,4 @@ def get(self, request):
.filter(lang=lang, search=search_query)
.order_by('-created')
)

return render(request, 'blog/search.html', {'results': results, 'query': query})
1 change: 1 addition & 0 deletions apps/notes/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

class NotesConfig(AppConfig):
name = 'apps.notes'
default_auto_field = "django.db.models.BigAutoField"
1 change: 1 addition & 0 deletions notion/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
HTML_MINIFY = True

ROOT_URLCONF = 'notion.urls'
SITE_ID = 1

TEMPLATES = [
{
Expand Down
2 changes: 0 additions & 2 deletions notion/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from django.conf import settings

from apps.blog.models import Post, Page
from apps.blog.views import SubscriptionView

blog_dict = {
'queryset': Post.objects.filter(status=Post.PUBLISHED),
Expand All @@ -32,7 +31,6 @@
),
path('redactor/', include('redactor.urls')),
path('cpadmin/', admin.site.urls),
path('subscribe/', SubscriptionView.as_view(), name='subscription'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

urlpatterns += i18n_patterns(
Expand Down
17 changes: 8 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
Django==3.2.18
psycopg2==2.9.5
django-environ==0.11.2
Django
psycopg2
django-environ
https://github.com/adilkhash/django-redactor3/archive/master.zip
redis==4.4.2
https://github.com/adilkhash/django-bootstrap-pagination/archive/master.zip
requests==2.28.2
Pillow==9.4.0
django-assets==2.0
cssmin==0.2.0
django-htmlmin==0.11.0
requests
Pillow
django-assets
cssmin
django-htmlmin
129 changes: 82 additions & 47 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% load assets %}
{% get_current_language as LANGUAGE_CODE %}
<!DOCTYPE html>
<html lang="en">
<html lang="{{ LANGUAGE_CODE }}">
<head>
{% if not DEBUG %}
<!-- Google tag (gtag.js) -->
Expand All @@ -21,62 +21,97 @@
<meta name="description" content="{% spaceless %}{% block meta_description %}{% trans 'Software engineer personal blog. Usually write about building web apps, machine learning and data analysis' %}{% endblock %}{% endspaceless %}" />
<meta name="google-site-verification" content="2oW122oyzuORLWrpVhZ29-2w0dTvpjiEL922qCuSa5M" />
<title>{% block title %}{% trans "Adil Khashtamov's personal blog — pragmatic programmer" %}{% endblock %}</title>
{% assets "css_all" %}
<link rel="stylesheet" href="{{ ASSET_URL }}">
{% endassets %}
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
{# {% assets "css_all" %}#}
{# <link rel="stylesheet" href="{{ ASSET_URL }}">#}
{# {% endassets %}#}
<link href="{% static 'images/icon.png' %}" rel="shortcut icon" type="image/x-icon" />
<link href="https://fonts.googleapis.com/css?family=PT+Serif&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Roboto', sans-serif;
}
code {
font-family: 'JetBrains Mono', monospace;
}
pre {
overflow-x: auto;
}
</style>
{% block _head %}
{% endblock %}
</head>

<body>
<div class="blog-masthead">
<div class="container container-wrap">
<div role="navigation">

<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#collapse-menu" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<body class="bg-gray-50">
<!-- Header -->
<header class="bg-white shadow-sm">
<div class="container mx-auto px-4 py-6">
<div class="flex flex-col md:flex-row justify-between items-center">
<div class="mb-4 md:mb-0">
<h1 class="text-3xl font-bold text-gray-800">
<a href="/" class="hover:text-blue-600">{% trans "Adil Khashtamov's blog" %}</a>
</h1>
<p class="text-gray-600 text-sm mt-1">{% trans "Tutorials and experiences from a software engineer" %}</p>
</div>
<!-- Navigation Menu -->
<nav class="flex">
<a href="{% url 'blog:posts' %}" class="px-3 py-2 {% if request.resolver_match.url_name == 'posts' %}text-blue-600 font-medium{% else %}text-gray-600 hover:text-blue-600{% endif %}">{% trans "Home" %}</a>
<a href="{% url 'blog:page' slug='about' %}" class="px-3 py-2 {% if request.resolver_match.url_name == 'page' and request.resolver_match.kwargs.slug == 'about' %}text-blue-600 font-medium{% else %}text-gray-600 hover:text-blue-600{% endif %}">{% trans "About" %}</a>
{# <a href="{% url 'blog:tags' %}" class="px-3 py-2 {% if request.resolver_match.url_name == 'tags' %}text-blue-600 font-medium{% else %}text-gray-600 hover:text-blue-600{% endif %}">{% trans "Tags" %}</a>#}
</nav>
</div>

<div class="collapse navbar-collapse" id="collapse-menu" style="padding:0;">
<ul class="menu__navigation">
<li><a class="blog-nav-item" href="{% url 'blog:posts' %}">{% trans 'Blog' %}</a></li>
<li><a class="blog-nav-item" href="{% url 'blog:page' slug='contacts' %}">{% trans 'Contacts' %}</a></li>
<li>
{% if LANGUAGE_CODE == 'ru' %}
<a class="blog-nav-item" href="/en/"><img src="{% static 'images/us-flag.png' %}" alt="In English" title="English version"></a>
{% else %}
<a class="blog-nav-item" href="/ru/"><img src="{% static 'images/ru-flag.png' %}" alt="На русском" title="Версия на русском"></a>
{% endif %}
</li>
{% if user.is_superuser %}
<li><a class="blog-nav-item" href="{% url 'admin:index' %}">{% trans 'Admin' %}</a></li>
{% endif %}
</ul>
<!-- Search Bar -->
<div class="mt-6">
<form action="{% url 'blog:search' %}" method="get" class="flex">
<input type="text" name="query" placeholder="{% trans 'Search the blog...' %}" class="flex-grow px-4 py-2 border border-gray-300 rounded-l focus:outline-none focus:ring-2 focus:ring-blue-400">
<button type="submit" class="bg-blue-600 text-white px-4 py-2 rounded-r hover:bg-blue-700">{% trans "Search" %}</button>
</form>
</div>
</div>
</div>
</div>
</header>

{% block content %}
{% endblock %}
<!-- Main Content -->
<main class="container mx-auto px-4 py-8">
{% block content %}{% endblock %}
</main>

<!--footer-->
<div class="container container-wrap">
<div class="row">
<div class="col-md-12">
<div class="footer" style="padding-bottom: 20px;padding-top:20px;">
<p><span style="font-size: .8em;color:#9b9b9b;">{% trans 'Powered by' %} Django {{ DJANGO_VERSION }} & Python {{ PYTHON_VERSION }} @ <a href="https://goo.gl/Yp6mKz" rel="nofollow noindex" target="_blank">DigitalOcean</a> © 2015 — {% now 'Y' %}</span></p>
<!-- Footer -->
<footer class="bg-gray-800 text-white">
<div class="container mx-auto px-4 py-10">
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
<div>
<h3 class="text-xl font-bold mb-4">{% trans "About the Blog" %}</h3>
<p class="text-gray-300">
{% trans "A personal blog sharing intermediate-level software engineering tutorials and experiences, focusing on Python, system design, and distributed systems." %}
</p>
</div>
<div>
<h3 class="text-xl font-bold mb-4">{% trans "Connect" %}</h3>
<div class="flex space-x-4">
<a href="https://github.com/yourusername" class="text-gray-300 hover:text-white">
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd" />
</svg>
</a>
<a href="https://twitter.com/yourusername" class="text-gray-300 hover:text-white">
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path d="M8.29 20.251c7.547 0 11.675-6.253 11.675-11.675 0-.178 0-.355-.012-.53A8.348 8.348 0 0022 5.92a8.19 8.19 0 01-2.357.646 4.118 4.118 0 001.804-2.27 8.224 8.224 0 01-2.605.996 4.107 4.107 0 00-6.993 3.743 11.65 11.65 0 01-8.457-4.287 4.106 4.106 0 001.27 5.477A4.072 4.072 0 012.8 9.713v.052a4.105 4.105 0 003.292 4.022 4.095 4.095 0 01-1.853.07 4.108 4.108 0 003.834 2.85A8.233 8.233 0 012 18.407a11.616 11.616 0 006.29 1.84" />
</svg>
</a>
<a href="https://www.linkedin.com/in/yourusername" class="text-gray-300 hover:text-white">
<svg class="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path d="M19 0h-14c-2.761 0-5 2.239-5 5v14c0 2.761 2.239 5 5 5h14c2.762 0 5-2.239 5-5v-14c0-2.761-2.238-5-5-5zm-11 19h-3v-11h3v11zm-1.5-12.268c-.966 0-1.75-.79-1.75-1.764s.784-1.764 1.75-1.764 1.75.79 1.75 1.764-.783 1.764-1.75 1.764zm13.5 12.268h-3v-5.604c0-3.368-4-3.113-4 0v5.604h-3v-11h3v1.765c1.396-2.586 7-2.777 7 2.476v6.759z" />
</svg>
</a>
</div>
</div>
</div>
<div class="mt-8 pt-8 border-t border-gray-700 text-center text-gray-400 text-sm">
<p>{% trans "Powered by" %} Django {{ DJANGO_VERSION }} & Python {{ PYTHON_VERSION }} @ <a href="https://goo.gl/Yp6mKz" rel="nofollow noindex" target="_blank">DigitalOcean</a> © 2015 — {% now 'Y' %}</p>
</div>
</div>
</div>
</footer>

{% block _bottom %}{% endblock %}
{% if not DEBUG %}
Expand Down Expand Up @@ -109,9 +144,9 @@
<noscript><div><img src="https://mc.yandex.ru/watch/32700075" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
{% endif %}
{% assets "js_all" %}
<script src="{{ ASSET_URL }}"></script>
{% endassets %}
{# {% assets "js_all" %}#}
{# <script src="{{ ASSET_URL }}"></script>#}
{# {% endassets %}#}
<script>hljs.initHighlightingOnLoad();</script>
</body>
</html>
54 changes: 36 additions & 18 deletions templates/blog/category_detail.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{{ object.title }} {% trans 'category' %}{% endblock %}
{% load static %}
{% block title %}{{ object.title }} {% trans "category" %}{% endblock %}

{% block content %}
<div class="container container-wrap">
<div class="row">
<div class="col-md-12">
<h1>{{ object.title }} {% trans 'category' %}</h1>

{% regroup posts by created.year as groups %}

{% for group in groups %}
<h3>{{ group.grouper }}</h3>
<ul>
{% for post in group.list %}
<li><a href="{% url 'blog:post' slug=post.slug %}">{{ post.title }}</a></li>
{% endfor %}
</ul>
{% endfor %}
<div class="bg-white p-6 rounded-lg shadow-sm">
<h1 class="text-3xl font-bold mb-6 text-gray-800">{{ object.title }} {% trans "category" %}</h1>

<!-- Posts by Year -->
{% regroup posts by created.year as year_groups %}
{% for year in year_groups %}
<div class="mb-8">
<h2 class="text-2xl font-bold mb-4 text-gray-700">{{ year.grouper }}</h2>
<div class="space-y-4">
{% for post in year.list %}
<article class="bg-gray-50 p-4 rounded-lg">
<h3 class="text-lg font-semibold mb-2">
<a href="{% url 'blog:post' slug=post.slug %}" class="text-blue-600 hover:underline">{{ post.title }}</a>
</h3>
<div class="flex items-center text-sm text-gray-500">
<span class="flex items-center">
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
</svg>
{{ post.created|date:"j N o" }}
</span>
<span class="mx-2">•</span>
<span class="flex items-center">
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
</svg>
{{ post.page_views }} {% trans "views" %}
</span>
</div>
</article>
{% endfor %}
</div>
</div>
</div>
{% endfor %}
</div>

{% endblock %}
Loading