Skip to content

Commit

Permalink
revert blog formatttings
Browse files Browse the repository at this point in the history
  • Loading branch information
krrish-sehgal committed Nov 7, 2024
1 parent e28f9a9 commit a8138d2
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 100 deletions.
24 changes: 13 additions & 11 deletions blog/templates/blog/post_delete.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends "base.html" %}

{% block content %}
<style>
<style>
body {
display: flex;
justify-content: center;
Expand Down Expand Up @@ -51,13 +52,14 @@
text-align: center;
margin: 0;
}
</style>
{% include "includes/sidenav.html" %}
<h1>Confirm Delete</h1>
<p class="post_content">Are you sure you want to delete the post "{{ post.title }}"?</p>
<form method="post" class="confirm-buttons">
{% csrf_token %}
<button type="submit" class="delete-button">Delete</button>
<a href="{% url 'post_detail' slug=post.slug %}" class="cancel-button">Cancel</a>
</form>
{% endblock content %}
</style>

{% include "includes/sidenav.html" %}
<h1>Confirm Delete</h1>
<p class="post_content">Are you sure you want to delete the post "{{ post.title }}"?</p>
<form method="post" class="confirm-buttons">
{% csrf_token %}
<button type="submit" class="delete-button">Delete</button>
<a href="{% url 'post_detail' slug=post.slug %}" class="cancel-button">Cancel</a>
</form>
{% endblock content %}
48 changes: 25 additions & 23 deletions blog/templates/blog/post_details.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends "base.html" %}

{% block content %}
<style>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
Expand Down Expand Up @@ -82,25 +83,26 @@
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
}
</style>
{% include "includes/sidenav.html" %}
<article class="post-article">
<h1 class="post-title">{{ post.title }}</h1>
<p class="post-meta">By {{ post.author }} on {{ post.created_at }}</p>
<div class="post-content">{{ post.content|safe }}</div>
{% if post.image %}
<div class="post-image">
<img height="200"
width="100%"
src="{{ post.image.url }}"
alt="{{ post.title }}">
</div>
{% endif %}
{% if request.user == post.author %}
<div class="btn-div">
<a href="{% url 'post_update' slug=post.slug %}" class="b-update">Update Post</a>
<a href="{% url 'post_delete' slug=post.slug %}" class="b-delete">Delete Post</a>
</div>
{% endif %}
</article>
{% endblock content %}
</style>

{% include "includes/sidenav.html" %}
<article class="post-article">
<h1 class="post-title">{{ post.title }}</h1>
<p class="post-meta">By {{ post.author }} on {{ post.created_at }}</p>
<div class="post-content">
{{ post.content|safe }}
</div>
{% if post.image %}
<div class="post-image">
<img height="200" width="100%" src="{{ post.image.url }}" alt="{{ post.title }}">
</div>
{% endif %}

{% if request.user == post.author %}
<div class="btn-div">
<a href="{% url 'post_update' slug=post.slug %}" class="b-update">Update Post</a>
<a href="{% url 'post_delete' slug=post.slug %}" class="b-delete">Delete Post</a>
</div>
{% endif %}
</article>
{% endblock content %}
87 changes: 44 additions & 43 deletions blog/templates/blog/post_form.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends "base.html" %}

{% block content %}
<style>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
Expand Down Expand Up @@ -42,45 +43,45 @@
.form-field {
margin-bottom: 15px;
}
</style>
{% include "includes/sidenav.html" %}
<h1 id="form-title">
{% if form.instance.pk %}
Edit
{% else %}
New
{% endif %}
Post
</h1>
<div class="form-container">
<form method="post" enctype="multipart/form-data" novalidate>
{% csrf_token %}
<div class="form-field">
{{ form.title.label }}
<br>
{{ form.title }}
<br>
{% for error in form.title.errors %}<div>{{ error }}</div>{% endfor %}
</div>
<div class="form-field">
{{ form.content.label }}
<br>
{{ form.content }}
<br>
{% for error in form.content.errors %}<div>{{ error }}</div>{% endfor %}
</div>
<div class="form-field">
{{ form.image.label }}
<br>
{{ form.image }}
<br>
{% for error in form.image.errors %}<div>{{ error }}</div>{% endfor %}
</div>
<button type="submit">Save</button>
</form>
</div>
<link rel="stylesheet"
href="https://unpkg.com/easymde/dist/easymde.min.css">
<script src="https://unpkg.com/easymde/dist/easymde.min.js"></script>
<script>var easyMDE = new EasyMDE({ element: document.getElementById('id_content') });</script>
{% endblock content %}
</style>

{% include "includes/sidenav.html" %}
<h1 id="form-title">{% if form.instance.pk %}Edit{% else %}New{% endif %} Post</h1>

<div class="form-container">
<form method="post" enctype="multipart/form-data" novalidate>
{% csrf_token %}
<div class="form-field">
{{ form.title.label }}<br>
{{ form.title }}<br>
{% for error in form.title.errors %}
<div>{{ error }}</div>
{% endfor %}
</div>

<div class="form-field">
{{ form.content.label }}<br>
{{ form.content }}<br>
{% for error in form.content.errors %}
<div>{{ error }}</div>
{% endfor %}
</div>

<div class="form-field">
{{ form.image.label }}<br>
{{ form.image }}<br>
{% for error in form.image.errors %}
<div>{{ error }}</div>
{% endfor %}
</div>

<button type="submit">Save</button>
</form>
</div>

<link rel="stylesheet" href="https://unpkg.com/easymde/dist/easymde.min.css">
<script src="https://unpkg.com/easymde/dist/easymde.min.js"></script>
<script>
var easyMDE = new EasyMDE({ element: document.getElementById('id_content') });
</script>
{% endblock content %}
44 changes: 21 additions & 23 deletions blog/templates/blog/post_list.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends "base.html" %}

{% block content %}
<style>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
Expand Down Expand Up @@ -59,25 +60,22 @@
border-radius: 5px;
margin-bottom: 10px;
}
</style>
{% include "includes/sidenav.html" %}
<h1 class="blog-title">Blog Posts</h1>
<ul class="post-list">
{% for post in posts %}
<a href="{% url 'post_detail' slug=post.slug %}">
<div class="post-item">
<p class="post-link">{{ post.title }} by {{ post.author }}</p>
{% if post.image %}
<img height="200"
width="200"
src="{{ post.image.url }}"
alt="{{ post.title }}"
class="blog_image">
{% endif %}
</div>
</a>
{% empty %}
<p class="no-posts-message">No posts available.</p>
{% endfor %}
</ul>
{% endblock content %}
</style>

{% include "includes/sidenav.html" %}
<h1 class="blog-title">Blog Posts</h1>
<ul class="post-list">
{% for post in posts %}
<a href="{% url 'post_detail' slug=post.slug %}">
<div class="post-item">
<p class="post-link">{{ post.title }} by {{ post.author }}</p>
{% if post.image %}
<img height="200" width="200" src="{{ post.image.url }}" alt="{{ post.title }}" class="blog_image">
{% endif %}
</div>
</a>
{% empty %}
<p class="no-posts-message">No posts available.</p>
{% endfor %}
</ul>
{% endblock content %}

0 comments on commit a8138d2

Please sign in to comment.