Skip to content
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

Tailwind Integration (new version 2.0.0) #90

Merged
merged 60 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
e1d4df9
ADD: TailWindCSS App
Farhaduneci Aug 1, 2022
f23c2e1
ADD: Django Compressor
Farhaduneci Aug 2, 2022
d2a1ccc
ADD: NavBar TailWind Style
Farhaduneci Aug 2, 2022
209416c
ADD Footer TailWind Style
Farhaduneci Aug 2, 2022
232496f
UPDATE: Navbar Toggle Button Functionality
Farhaduneci Aug 3, 2022
536a058
UPDATE: Thinner logo title, and more navbar padding
Farhaduneci Aug 3, 2022
b2194ac
ADD: Particles JS
Farhaduneci Aug 3, 2022
28b85df
ADD: Hero Section
Farhaduneci Aug 3, 2022
e7097d7
ADD: Stats Section
Farhaduneci Aug 4, 2022
86bddb7
UPDATE: New Darkmode Button, Minor bug fixes
Farhaduneci Aug 4, 2022
2c8d2e6
ADD: Repo Info Section
Farhaduneci Aug 4, 2022
4fd6504
ADD: Collove Icon to footer
Farhaduneci Aug 4, 2022
2667792
Update: Collove Icon
Farhaduneci Aug 4, 2022
4e859e6
UPDATE: Minor style changes
Farhaduneci Aug 5, 2022
d71c596
ADD: Light/Dark mode full integration
Farhaduneci Aug 5, 2022
f4fae59
ADD: Snippets template styles
Farhaduneci Aug 5, 2022
ceb8cb4
ADD: ParticlesJS inactive for mobile devices
Farhaduneci Aug 5, 2022
11ba901
Merge branch 'main' into feature/frontend_refactor
Farhaduneci Aug 6, 2022
a8bd442
UPDATE: Removed particlesJS, Darkmode update
Farhaduneci Aug 6, 2022
50b887d
ADD: Blog styles
Farhaduneci Aug 6, 2022
215f2be
UPDATE: General Style Updates
Farhaduneci Aug 6, 2022
c0761b1
ADD: Collove Section
Farhaduneci Aug 7, 2022
c8429b4
UPDATE: General Style Updates, Added millify templatetag
Farhaduneci Aug 11, 2022
f1058f3
FIX: Removed Tailwind typography code styles, using HJS now
Farhaduneci Aug 11, 2022
9c66f03
ADD: Blog posts Tag styles
Farhaduneci Aug 11, 2022
8f67387
FIX: Code block wrapping
Farhaduneci Aug 11, 2022
3c3595a
UPDATE: Hope page style
Farhaduneci Aug 12, 2022
64bd7b6
ADD: 404/500 Octocat images
Farhaduneci Aug 12, 2022
d263dcd
ADD: Disclaimer page, Some style updates
Farhaduneci Aug 12, 2022
58568d4
FIX: Files formatted via Black
Farhaduneci Aug 12, 2022
9f9c46c
UPDATE: General Style Updates
Farhaduneci Aug 17, 2022
b2548ea
ADD: Mobile Menu animation
Farhaduneci Aug 18, 2022
892add3
UPDATE: General Style Updates
Farhaduneci Aug 18, 2022
5e47641
Merge branch 'development' into feature/frontend_refactor
Farhaduneci Aug 18, 2022
5add415
UPDATE: Pinned articles styles
Farhaduneci Aug 18, 2022
98cf732
ADD: Update Contributors Command
Farhaduneci Aug 20, 2022
6f9dd90
UPDATE: Using Cash.js insted of Jquery
Farhaduneci Aug 20, 2022
9b65712
UPDATE: Blog features posts tag styles update
Farhaduneci Aug 20, 2022
7535828
UPDATE: General Style Updates
Farhaduneci Aug 21, 2022
097dfd2
ADD: Copy to clipboard button
Farhaduneci Aug 21, 2022
65735d6
ADD: Loading screen
Farhaduneci Aug 22, 2022
4e03347
UPDATE: Image assets compression
Farhaduneci Aug 22, 2022
3c2c451
UPDATE: General Style Updates
Farhaduneci Aug 22, 2022
5a5f8c5
UPDATE: Meta tags
Farhaduneci Aug 22, 2022
8f1384c
UPDATE: Hashnode section + local fonts
Farhaduneci Aug 22, 2022
c18adcc
UPDATE: Local Asciinema
Farhaduneci Aug 22, 2022
fff8894
UPDATE: Populate JS files
Farhaduneci Aug 22, 2022
07c35ec
"plus" symbol misplace fixed
lnxpy Aug 22, 2022
0fb9f3c
Merge pull request #87 from Farhaduneci/feature/frontend_refactor
Farhaduneci Aug 22, 2022
aa81362
code quality observed
lnxpy Aug 22, 2022
4faa7e3
download_url moved to constants
lnxpy Aug 22, 2022
207aeed
Merge pull request #88 from lnxpy/development
lnxpy Aug 22, 2022
fee2ed3
FIX: Update Contributors command
Farhaduneci Aug 22, 2022
87af50f
FIX: JS tags
Farhaduneci Aug 22, 2022
54e6540
FIX: Blogs template meta tags
Farhaduneci Aug 22, 2022
07ffdc0
static root issue fixed
lnxpy Aug 23, 2022
0410fda
Merge branch 'collove:development' into development
Farhaduneci Aug 23, 2022
45af5d0
FIX: Sticky Navbar
Farhaduneci Aug 23, 2022
cb8e072
FIX: Local fonts
Farhaduneci Aug 23, 2022
97fb571
Merge pull request #89 from Farhaduneci/development
lnxpy Aug 23, 2022
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/

# Static files
/static/
100 changes: 53 additions & 47 deletions blog/templates/blog.html
Original file line number Diff line number Diff line change
@@ -1,49 +1,55 @@
{% extends '_base.html' %}
{% load static %}
{% extends "base/_base.html" %}
{% load markdown_extras %}

{% block title %}{{blog.title}}{% endblock %}

{% block metas %}
<!-- Primary Meta Tags -->
<meta name="title" content="{{blog.title}}">
<meta name="description"
content="{{blog.abstract}}">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:url" content="{% url 'blog' blog.slug %}">
<meta property="og:title"
content="{{blog.title}}">
<meta property="og:description"
content="{{blog.abstract}}">
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="{% url 'blog' blog.slug %}">
<meta property="twitter:title"
content="{{blog.title}}">
<meta property="twitter:description"
content="{{blog.abstract}}">
{% endblock %}

{% block addon_link %}
<link rel="stylesheet" href="{% static 'css/blog.css' %}">
{% endblock %}

{% block blog_active %}active{% endblock %}

{% load static %}
<!-- Titles -->
{% block title %}
PasteMe - {{ blog.title }}
{% endblock title %}
{% block meta_title %}
PasteMe - {{ blog.title }}
{% endblock meta_title %}
{% block meta_og_title %}
PasteMe - {{ blog.title }}
{% endblock meta_og_title %}
{% block meta_tw_title %}
{{ blog.title }}
{% endblock meta_tw_title %}
<!-- URLs -->
{% block meta_og_url %}
{% url 'blog' blog.slug %}
{% endblock meta_og_url %}
{% block meta_tw_url %}
{% url 'blog' blog.slug %}
{% endblock meta_tw_url %}
<!-- Description -->
{% block meta_og_desc %}
{{ blog.abstract }}
{% endblock meta_og_desc %}
{% block meta_tw_desc %}
{{ blog.abstract }}
{% endblock meta_tw_desc %}
{% block addon_style %}
<link rel="stylesheet" href="{% static 'css/themes/dark.min.css' %}"/>
{% endblock addon_style %}
{% block addon_script %}
<script src="{% static 'js/highlight.min.js' %}"></script>
<script>hljs.initHighlightingOnLoad();</script>
{% endblock addon_script %}
{% block content %}
<section class="p-5">
<div class="container d-flex justify-content-center">
<div class="col-md-9">
<h1 class="title">{{blog.title}}</h1>
<p class="text-muted">Published on {{blog.published_at | date:'M d, Y'}} &#183;
{% for tag in blog.tags.all %}
<span class="badge me-1 bg-black">{{tag.name}}</span>
{% endfor %%}
</p>
<h5 class="text-muted mt-4 mb-4 abstract">{{blog.abstract}}</h5>
<div class="body">{{blog.body | markdown | safe}}</div>
</div>
</div>
</section>
{% endblock %}
<section class="py-10">
<div class="container md:px-0 prose prose-emerald dark:prose-invert prose-pre:text-sm prose-code:rounded prose-code:whitespace-pre-wrap prose-hr:border-dashed prose-hr:border-t-2">
<h1 class="mb-2">{{ blog.title }}</h1>
<p class="text-sm">
Published on {{ blog.published_at | date:'M d, Y' }}
{% if blog.tags.all %}
{% for tag in blog.tags.all %}<span class="text-xs text-neutral-500 mr-1">#{{ tag.name }}</span>{% endfor %}
{% endif %}
</p>
<h3>Abstract</h3>
<h5 class="text-justify">{{ blog.abstract }}</h5>
<hr/>
<div class="text-justify">{{ blog.body | markdown | safe }}</div>
</div>
</section>
{% endblock content %}
163 changes: 101 additions & 62 deletions blog/templates/blogs.html
Original file line number Diff line number Diff line change
@@ -1,66 +1,105 @@
{% extends '_base.html' %}
{% extends 'base/_base.html' %}
{% load static %}

{% block title %}PasteMe - Blogs{% endblock %}

{% block blog_active %}active{% endblock %}

{% block metas %}
<!-- Primary Meta Tags -->
<meta name="title" content="PasteMe - Blogs">
<meta name="description"
content="Follow the feed and keep up with the tech.">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:url" content="{% url 'blogs' %}">
<meta property="og:title"
content="PasteMe - Blogs">
<meta property="og:description"
content="Follow the feed and keep up with the tech.">
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="{% url 'blogs' %}">
<meta property="twitter:title"
content="PasteMe - Blogs">
<meta property="twitter:description"
content="Follow the feed and keep up with the tech.">
{% endblock %}

{% block body_css %}background: url('{% static 'img/banner.svg' %}') fixed;{% endblock %}

<!-- Titles -->
{% block title %}
PasteMe - Blogs
{% endblock title %}
{% block meta_title %}
PasteMe - Blogs
{% endblock meta_title %}
{% block meta_og_title %}
PasteMe - Blogs
{% endblock meta_og_title %}
{% block meta_tw_title %}
PasteMe - Blogs
{% endblock meta_tw_title %}
<!-- URLs -->
{% block meta_og_url %}
{% url 'blogs' %}
{% endblock meta_og_url %}
{% block meta_tw_url %}
{% url 'blogs' %}
{% endblock meta_tw_url %}
<!-- Description -->
{% block meta_desc %}
Follow the feed and keep up with the tech.
{% endblock meta_desc %}
{% block meta_og_desc %}
Follow the feed and keep up with the tech.
{% endblock meta_og_desc %}
{% block meta_tw_desc %}
Follow the feed and keep up with the tech.
{% endblock meta_tw_desc %}
{% block addon_script %}
<script src="{% static 'js/aos.js' %}"></script>
<script src="{% static 'js/app.js' %}"></script>
{% endblock addon_script %}
{% block content %}
<section class="text-white" style="padding: 30px;">
<div class="container">
<div class="row align-items-center">
<div class="col-md">
<h2 class="fw-bold" style="line-height: 40px;">Welcome to the PasteMe Library!</h2>
<p align="justify">In library, our professional writers write awesome articles about tricks, best practices, implementations, and new technologes. Follow the feed and enjoy the blogs.</p>
<section class="py-6 md:py-10 text-black dark:text-white">
<div class="container"
data-aos="fade-up"
data-aos-duration="400"
data-aos-delay="100"
data-aos-once="true">
<div class="flex flex-col md:flex-row items-center justify-center gap-6 md:gap-12">
<div class="md:max-w-xl">
<h2 class="text-3xl md:text-4xl lg:text-6xl font-bold text-center md:text-left mb-4 lg:mb-8">
Welcome to the PasteMe Library!
</h2>
<p class="mx-4 md:mx-0 text-justify lg:text-xl">
In library, our professional writers write awesome articles about tricks, best practices, implementations, and new technologes. Follow the feed and enjoy the blogs.
</p>
<div class="mt-8 md:mt-12 flex flex-col-reverse md:flex-row gap-4 md:gap-1 items-center justify-center md:justify-start select-none">
<svg xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6 md:h-4 md:w-4 animate-bounce"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M15 13l-3 3m0 0l-3-3m3 3V8m0 13a9 9 0 110-18 9 9 0 010 18z" />
</svg>
<p class="text-sm font-semibold">Scroll down for latest articles</p>
</div>
</div>
<div class="order-first md:order-last" align="center">
<img class="max-w-xs w-56 lg:w-72"
src="{% static 'img/reader_octocat.svg' %}"
alt="Octocat image"/>
</div>
</div>
</div>
</section>
<section class="py-12 text-black dark:text-white bg-white dark:bg-black transition-colors duration-300">
<div class="container flex flex-wrap gap-5"
data-aos="fade-up"
data-aos-duration="400"
data-aos-delay="100"
data-aos-once="true">
{% if blogs.exists %}
{% for blog in blogs %}
<a href="{% url 'blog' blog.slug %}"
class="shrink grow basis-1/2 md:basis-1/3 lg:basis-1/4">
<div class="{% if blog.is_featured %}glow{% endif %} h-full p-4 bg-neutral-100 dark:bg-neutral-900 shadow-md rounded transition-colors duration-300 hover:bg-neutral-200 dark:hover:bg-neutral-800 group">
<div class="flex flex-col-reverse md:flex-row items-baseline md:items-center justify-between gap-1 md:gap-2">
<h3 class="text-2xl font-extrabold">{{ blog.title }}</h3>
{% if blog.is_featured %}
<span class="py-1 px-2 text-xs font-semibold bg-neutral-300 dark:bg-neutral-800 group-hover:bg-neutral-300 dark:group-hover:bg-neutral-700 text-neutral-500 rounded transition-colors duration-300">Featured</span>
{% endif %}
</div>
<p class="mt-1 mb-4 text-sm text-neutral-500 select-none">Published on {{ blog.published_at | date:'M d, Y' }}</p>
<h5 class="text-neutral-600 dark:text-neutral-400 select-none">{{ blog.abstract|truncatechars:85 }}</h5>
<p class="mt-2 text-xs text-neutral-500 flex flex-row flex-wrap gap-2">
{% for tag in blog.tags.all %}<span>#{{ tag.name }}</span>{% endfor %}
</p>
</div>
</a>
{% endfor %}
{% else %}
<div class="w-full flex flex-col items-center justify-center transition-colors duration-300">
<h2 class="text-xl md:text-3xl lg:text-4xl font-bold text-center md:text-left mb-3">No feeds to follow up!</h2>
<p class="text-center md:text-left text-neutral-500 font-semibold">No blog post found in the archive.</p>
</div>
{% endif %}
</div>
<div class="col-md order-first order-md-last" align="center">
<img class="img-fluid" src="{% static 'img/reader_octocat.svg' %}" width="250">
</div>
</div>
</div>
</section>
<section class="p-4 font-dark bg-white">
<div class="container mb-3">
{% if blogs.exists %}
{% for blog in blogs %}
<div class="card card-body" style="border: unset;">
<a href="{% url 'blog' blog.slug %}" class="link-dark" style="text-decoration: unset;"><h3 class="card-title" style="font-family: Lora, serif"><b>{{blog.title}}</b></h3></a>
<p class="card-subtitle mb-2 text-muted">Published on {{blog.published_at | date:'M d, Y'}}</p>
<h5 class="card-text" style="font-family: Lora, serif">{{blog.abstract|truncatechars:85}}</h5>
<p class="card-text mt-1">
{% for tag in blog.tags.all %}
<span class="badge me-1 bg-black">{{tag.name}}</span>
{% endfor %%}
</p>
</div>
{% endfor %}
{% else %}
<h2>No feeds to follow up!</h2>
<p>No blog post found in the archive.</p>
{% endif %}
</div>
</section>
</section>
{% endblock %}
26 changes: 24 additions & 2 deletions pasteme/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
https://docs.djangoproject.com/en/4.0/ref/settings/
"""

import os
from contextlib import suppress
from pathlib import Path

Expand Down Expand Up @@ -41,8 +42,11 @@
"django.contrib.staticfiles",
# 3rd parties
"rest_framework",
"compressor",
"tailwind",
"drf_yasg",
# apps
"tailwindcss",
"snippet",
"blog",
"pypi",
Expand Down Expand Up @@ -123,7 +127,7 @@
# https://docs.djangoproject.com/en/4.0/howto/static-files/

STATIC_URL = "/static/"
STATIC_ROOT = "static/"
STATIC_ROOT = BASE_DIR / "static"

MEDIA_URL = "/media/"
MEDIA_ROOT = "media/"
Expand All @@ -135,7 +139,25 @@

DOMAIN_URL = "https://pasteme.pythonanywhere.com/"

# Import local settings
# Used for disclaimer view
SITE_URL = "pasteme.pythonanywhere.com"

# TailWindCSS settings
TAILWIND_APP_NAME = "tailwindcss"

INTERNAL_IPS = [
"127.0.0.1",
]

# Compressor settings
STATICFILES_FINDERS = (
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
"compressor.finders.CompressorFinder",
)

COMPRESS_ENABLED = True

# Import local settings
with suppress(ImportError):
from .local_settings import *
13 changes: 12 additions & 1 deletion pasteme/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from django.conf import settings

# from django.contrib import admin
from django.urls import include, path
from django.views.generic import TemplateView
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
from rest_framework import permissions
Expand All @@ -18,10 +21,18 @@
)

urlpatterns = [
# path('admin/', admin.site.urls),
# path("admin/", admin.site.urls),
path(
"apidocs/", schema_view.with_ui("redoc", cache_timeout=0), name="schema-redoc"
),
path(
"disclaimer/",
TemplateView.as_view(
template_name="disclaimer.html",
extra_context={"SITE_URL": settings.SITE_URL},
),
name="disclaimer",
),
path("blog/", include("blog.urls")),
path("", include("snippet.urls")),
]
3 changes: 3 additions & 0 deletions pypi/constants.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Github API Endpoint
GITHUB_API_ROOT = "https://api.github.com/"

# Contrib.rock Image URL
DOWNLOAD_URL = "https://contrib.rocks/image?repo=collove/pasteme"
25 changes: 25 additions & 0 deletions pypi/management/commands/update_contributors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from os import path

import urllib.request as request
from django.core.management.base import BaseCommand

from pypi.constants import DOWNLOAD_URL


class Command(BaseCommand):
help = "Updates the contributors image on the homepage"

def handle(self, *args, **options):
CUR_DIR = path.dirname(path.realpath(__file__))
STAT_FILES_DIR = path.join(CUR_DIR, "../../../snippet/static/img/")
try:
request.urlretrieve(
DOWNLOAD_URL, path.join(STAT_FILES_DIR, "contributors.svg")
)
self.stdout.write(
self.style.SUCCESS("Successfully updated contributors image")
)
except Exception as e:
self.stdout.write(
self.style.ERROR(f"Error updating contributors image: {e}")
)
Loading