Skip to content

Commit

Permalink
feat: Frontend work for the homepage, manuscripts, and stanzas pages
Browse files Browse the repository at this point in the history
  • Loading branch information
hepplerj committed Jun 5, 2024
1 parent 6d1f8b6 commit 2d564f6
Show file tree
Hide file tree
Showing 9 changed files with 198 additions and 73 deletions.
14 changes: 11 additions & 3 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@
DEBUG = env("DEBUG", default="False")

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env("DJANGO_SECRET_KEY", default="django-insecure )$-$@6=%dtoet5l+p@-ug)mwssbtclfz*sua+ni+1llkw4lr)o")
SECRET_KEY = env(
"DJANGO_SECRET_KEY",
default="django-insecure )$-$@6=%dtoet5l+p@-ug)mwssbtclfz*sua+ni+1llkw4lr)o",
)

TIME_ZONE = "America/New_York"
LANGUAGE_CODE = "en-us"
ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=['localhost'])
CSRF_TRUSTED_ORIGINS = env.list("DJANGO_CSRF_TRUSTED_ORIGINS", default=['http://localhost'])
ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=["localhost"])
CSRF_TRUSTED_ORIGINS = env.list(
"DJANGO_CSRF_TRUSTED_ORIGINS", default=["http://localhost"]
)
X_FRAME_OPTIONS = "SAMEORIGIN"
SILENCED_SYSTEM_CHECKS = ["security.W019"]

Expand Down Expand Up @@ -163,6 +168,9 @@

STATIC_ROOT = str(BASE_DIR / "staticfiles")
STATIC_URL = "static/"
STATICFILES_DIRS = [
BASE_DIR / "static",
]
MEDIA_ROOT = str(BASE_DIR / "media")
MEDIA_URL = "media/"

Expand Down
2 changes: 2 additions & 0 deletions manuscript/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@

urlpatterns = [
path("", views.index, name="index"),
path("manuscripts", views.manuscripts, name="manuscripts"),
path("stanzas", views.stanzas, name="stanzas"),
]
16 changes: 13 additions & 3 deletions manuscript/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,18 @@


def index(request: HttpRequest):
return render(request, "index.html")


def about(request: HttpRequest):
return render(request, "about.html")


def stanzas(request: HttpRequest):
stanzas = Stanza.objects.all().order_by("stanza_line_code_starts")
return render(request, "stanzas.html", {"stanzas": stanzas})


def manuscripts(request: HttpRequest):
manuscripts = SingleManuscript.objects.all()
return render(
request, "index.html", {"stanzas": stanzas, "manuscripts": manuscripts}
)
return render(request, "manuscripts.html", {"manuscripts": manuscripts})
Binary file added static/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/troy.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 73 additions & 7 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,82 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>La Sfera</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>{% block title %}La Sfera{% endblock %}</title>
{% tailwind_css %}
</head>

<body class="bg-gray-50 leading-normal tracking-normal">
<div class="container mx-auto">
{% block content %}{% endblock content %}
</div>
<body>
<header class="relative h-96 bg-cover bg-center" style="background-image: url('{% static 'images/troy.jpg' %}');">
<div class="absolute inset-0 bg-black bg-opacity-50">
<div class="container mx-auto p-4 flex justify-between items-center">
<div class="flex items-center space-x-4">
<a href="{% url 'index' %}" class="flex items-center space-x-4">
<img src="{% static 'images/logo.png' %}" alt="Logo" class="h-10">
<h1 class="text-white text-2xl">The La Sfera Project</h1>
</a>
</div>
<nav class="text-white">
<ul class="flex space-x-4">
<li class="group relative">
<a href="#introduction" class="hover:underline inline-flex items-center">Introduction
<svg class="w-4 h-4 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
</svg>
</a>
<ul class="absolute left-0 mt-2 w-48 hidden group-hover:block bg-white text-black border border-gray-200 z-10">
<li><a href="#" class="block px-4 py-2 hover:bg-gray-200">Sub Item 1</a></li>
<li><a href="#" class="block px-4 py-2 hover:bg-gray-200">Sub Item 2</a></li>
</ul>
</li>
<li class="group relative">
<a href="#about" class="hover:underline inline-flex items-center">About
<svg class="w-4 h-4 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
</svg>
</a>
<ul class="absolute left-0 mt-2 w-48 hidden group-hover:block bg-white text-black border border-gray-200 z-10">
<li><a href="#" class="block px-4 py-2 hover:bg-gray-200">Sub Item 1</a></li>
<li><a href="#" class="block px-4 py-2 hover:bg-gray-200">Sub Item 2</a></li>
</ul>
</li>
<li class="group relative">
<a href="#background" class="hover:underline inline-flex items-center">Background
<svg class="w-4 h-4 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
</svg>
</a>
<ul class="absolute left-0 mt-2 w-48 hidden group-hover:block bg-white text-black border border-gray-200 z-10">
<li><a href="#" class="block px-4 py-2 hover:bg-gray-200">Sub Item 1</a></li>
<li><a href="#" class="block px-4 py-2 hover:bg-gray-200">Sub Item 2</a></li>
</ul>
</li>
<li class="group relative">
<a href="#resources" class="hover:underline inline-flex items-center">Resources
<svg class="w-4 h-4 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
</svg>
</a>
<ul class="absolute left-0 mt-2 w-48 hidden group-hover:block bg-white text-black border border-gray-200 z-10">
<li><a href="#" class="block px-4 py-2 hover:bg-gray-200">Sub Item 1</a></li>
<li><a href="#" class="block px-4 py-2 hover:bg-gray-200">Sub Item 2</a></li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="container mx-auto h-72 flex items-center">
<div class="text-left max-w-md">
<h2 class="text-white text-4xl">La Sfera: The Globe</h2>
<p class="text-white mt-4">The La Sfera Project encompasses a number of different scholarly efforts exploring the Florentine merchant Gregorio Dati's treatise La sfera (The Globe), written sometime around 1430. It began with the <code>#lasferachallenge</code>, the social-media brainchild of Laura Morreale and Ben Albritton, in 2020, but has since expanded in multiple scholarly directions.</p>
</div>
</div>
</div>
</header>
<main>
{% block content %}
{% endblock %}
</main>
</body>
</html>

104 changes: 44 additions & 60 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -1,63 +1,47 @@
{% extends "base.html" %}

{% block content %}
{% block title %}
Home - La Sfera
{% endblock title %}

<h2 class="text-3xl" id="top">Homepage - La Sfera</h2>

<hr class="my-4">

<p>This temporary page is for testing that the content is in good order. Displayed here is a table of all the manuscripts in the database, as well as all the available stanzas.</p>

<div class="p-4">
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
<a href="/admin">Admin panel</a>
</button>

<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
<a href="#table">Table of manuscripts</a>
</button>

<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
<a href="#text">Text of the manuscript</a>
</button>
</div>

<hr class="my-4">

<h3 class="text-2xl pb-8" id="table">Table of manuscripts &mdash; <a href="#top">Back to top &uarr;</a></h3>

<table class="table-auto">
<thead>
<tr>
<th class="px-4 py-2">ID</th>
<th class="px-4 py-2">Siglum</th>
<th class="px-4 py-2">Shelfmark</th>
<th class="px-4 py-2">Library</th>
</tr>
</thead>
<tbody>
{% for manuscript in manuscripts %}
<tr>
<td class="border px-4 py-2">{{ manuscript.item_id }}</td>
<td class="border px-4 py-2">{{ manuscript.siglum }}</td>
<td class="border px-4 py-2">{{ manuscript.shelfmark }}</td>
<td class="border px-4 py-2">{{ manuscript.library }}</td>
<!-- <td class="border px-4 py-2">
<a href="/manuscript/{{ manuscript.id }}">Details</a>
</td> -->
</tr>
{% endfor %}
</tbody>
</table>

<hr class="my-4">

<h3 class="text-2xl pb-8" id="text">Text of the manuscript &mdash; <a href="#top">Back to top &uarr;</a></h3>

<div class="prose">
{% for stanza in stanzas %}
<p><span class="font-serif text-red-700 text-sm">{{ stanza.stanza_line_code_starts }}</span> {{ stanza.stanza_text }}</p>
{% endfor %}
</div>

{% endblock content %}
{% block content %}
<section id="introduction" class="container mx-auto p-4 my-10">
<p>This temporary page is for testing that the content is in good order. Displayed here is a table of all the manuscripts in the database, as well as all the available stanzas.</p>

<div class="p-4">
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
<a href="/admin">Admin panel</a>
</button>

<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
<a href="{% url 'manuscripts' %}">Table of manuscripts</a>
</button>

<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
<a href="{% url 'stanzas' %}">Text of the manuscript</a>
</button>
</div>

</section>


<section id="introduction" class="container mx-auto p-4 my-10">
<h2 class="text-2xl font-bold">Introduction</h2>
<p class="mt-4">This is the introduction section. Add your content here.</p>
</section>

<section id="about" class="container mx-auto p-4 my-10 bg-gray-100">
<h2 class="text-2xl font-bold">About</h2>
<p class="mt-4">This is the about section. Add your content here.</p>
</section>

<section id="background" class="container mx-auto p-4 my-10">
<h2 class="text-2xl font-bold">Background</h2>
<p class="mt-4">This is the background section. Add your content here.</p>
</section>

<section id="resources" class="container mx-auto p-4 my-10 bg-gray-100">
<h2 class="text-2xl font-bold">Resources</h2>
<p class="mt-4">This is the resources section. Add your content here.</p>
</section>
{% endblock content %}
33 changes: 33 additions & 0 deletions templates/manuscripts.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% extends "base.html" %}

{% block title %}Stanzas - La Sfera{% endblock title %}

{% block content %}
<section id="introduction" class="container mx-auto p-4 my-10">
<h3 class="text-2xl pb-8" id="table">Table of manuscripts &mdash; <a href="#top">Back to top &uarr;</a></h3>

<table class="table-auto">
<thead>
<tr>
<th class="px-4 py-2">ID</th>
<th class="px-4 py-2">Siglum</th>
<th class="px-4 py-2">Shelfmark</th>
<th class="px-4 py-2">Library</th>
</tr>
</thead>
<tbody>
{% for manuscript in manuscripts %}
<tr>
<td class="border px-4 py-2">{{ manuscript.item_id }}</td>
<td class="border px-4 py-2">{{ manuscript.siglum }}</td>
<td class="border px-4 py-2">{{ manuscript.shelfmark }}</td>
<td class="border px-4 py-2">{{ manuscript.library }}</td>
<!-- <td class="border px-4 py-2">
<a href="/manuscript/{{ manuscript.id }}">Details</a>
</td> -->
</tr>
{% endfor %}
</tbody>
</table>
</section>
{% endblock content %}
22 changes: 22 additions & 0 deletions templates/stanzas.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% extends "base.html" %}

{% block title %}Stanzas - La Sfera{% endblock title %}

{% block content %}
<section id="introduction" class="container mx-auto p-4 my-10">
<h3 class="text-2xl pb-8" id="text">
Text of the manuscript &mdash; <a href="#top">Back to top &uarr;</a>
</h3>

<div class="prose">
{% for stanza in stanzas %}
<p>
<span class="font-serif text-red-700 text-sm">
{{ stanza.stanza_line_code_starts }}
</span>
{{ stanza.stanza_text }}
</p>
{% endfor %}
</div>
</section>
{% endblock content %}

0 comments on commit 2d564f6

Please sign in to comment.