aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-12-31 11:17:59 -0500
committerBobby <[email protected]>2022-12-31 11:17:59 -0500
commitf7f323657ac2b52ce5a6b3d49ca6a0cdb3320938 (patch)
tree34c54db15f09b99b573488c74271e345b5de740b
parent5c5493387bbcd6d0b025d395df77ae48af65508e (diff)
downloadthatcomputerscientist-f7f323657ac2b52ce5a6b3d49ca6a0cdb3320938.tar.xz
thatcomputerscientist-f7f323657ac2b52ce5a6b3d49ca6a0cdb3320938.zip
Some fixes and removed over engineered things, KISS baby
-rw-r--r--blog_admin/urls.py11
-rw-r--r--blog_admin/views.py189
-rw-r--r--static/css/main.css53
-rw-r--r--templates/blog/partials/sidebar.html38
-rw-r--r--templates/blog/post.html2
-rw-r--r--templates/blog_admin/categories.html53
-rw-r--r--templates/blog_admin/edit_user.html66
-rw-r--r--templates/blog_admin/new_category.html38
-rw-r--r--templates/blog_admin/new_user.html74
-rw-r--r--templates/blog_admin/posts.html49
-rw-r--r--templates/blog_admin/tags.html49
-rw-r--r--templates/blog_admin/users.html63
-rw-r--r--templates/dev_status/home.html22
13 files changed, 117 insertions, 590 deletions
diff --git a/blog_admin/urls.py b/blog_admin/urls.py
index 6d3d96b8..8d89e376 100644
--- a/blog_admin/urls.py
+++ b/blog_admin/urls.py
@@ -3,21 +3,10 @@ from . import views
app_name = 'blog-admin'
urlpatterns = [
- path('/users', views.users, name='users'),
- path('/users/new', views.new_user, name='new-user'),
- path('/users/search', views.users_search, name='users-search'),
- path('/users/<int:user_id>/edit', views.edit_user, name='edit-user'),
path('/posts', views.posts, name='posts'),
path('/posts/new', views.new_post, name='new-post'),
path('/posts/search', views.posts_search, name='posts-search'),
path('/posts/<str:slug>/edit', views.edit_post, name='edit-post'),
path('/posts/<str:slug>/publish', views.publish_post, name='publish-post'),
path('/posts/<str:slug>/unpublish', views.unpublish_post, name='unpublish-post'),
- path('/comments', views.comments, name='comments'),
- path('/categories', views.categories, name='categories'),
- path('/categories/new', views.new_category, name='new-category'),
- path('/categories/<int:category_id>/edit', views.edit_category, name='edit-category'),
- path('/categories/<int:category_id>/delete', views.edit_category, name='delete-category'),
- path('/tags', views.tags, name='tags'),
- path('/new', views.new, name='new'),
] \ No newline at end of file
diff --git a/blog_admin/views.py b/blog_admin/views.py
index 35ab6489..53d24107 100644
--- a/blog_admin/views.py
+++ b/blog_admin/views.py
@@ -29,13 +29,7 @@ def posts_search(request):
q = request.GET.get('q')
if request.user.is_authenticated and (request.user.is_superuser or request.user.is_staff):
if q:
- try:
- # Get the posts where title or body or author or category or tags or slug contains q or the post id is int(q)
- posts = Post.objects.filter(title__icontains=q) | Post.objects.filter(body__icontains=q) | Post.objects.filter(author__username__icontains=q) | Post.objects.filter(category__name__icontains=q) | Post.objects.filter(tags__name__icontains=q) | Post.objects.filter(slug__icontains=q) | Post.objects.filter(id = int(q))
- except:
- # Get the posts where title or body or author or category or tags or slug contains q
- posts = Post.objects.filter(title__icontains=q) | Post.objects.filter(body__icontains=q) | Post.objects.filter(author__username__icontains=q) | Post.objects.filter(category__name__icontains=q) | Post.objects.filter(tags__name__icontains=q) | Post.objects.filter(slug__icontains=q)
-
+ posts = Post.objects.filter(title__icontains=q)
return render(request, 'blog_admin/posts.html', { 'title': 'Search Results for "{}"'.format(q), 'posts': posts })
else:
return redirect('blog-admin:posts')
@@ -156,184 +150,3 @@ def unpublish_post(request, slug):
else:
return redirect('blog:home')
-def comments(request):
- pass
-
-def categories(request):
- if request.user.is_authenticated and (request.user.is_superuser or request.user.is_staff):
- page = request.GET.get('page') if request.GET.get('page') else 1
- try:
- page = int(page)
- except:
- page = 1
- categories = Category.objects.all()[(page-1)*50:page*50]
- num_pages = Category.objects.all().count() // 50 + 1
- url_to_render = 'blog_admin/categories.html?page={}'.format(page) if int(page) and int(page) > 1 else 'blog_admin/categories.html'
- return render(request, url_to_render, { 'title': 'Manage Categories', 'categories': categories, 'num_pages': num_pages, 'page': page })
- else:
- return redirect('blog:home')
-
-def new_category(request):
- if request.user.is_authenticated and (request.user.is_superuser or request.user.is_staff):
- if request.method == 'POST':
- name = request.POST.get('name')
- slug = request.POST.get('slug')
- description = request.POST.get('description') if request.POST.get('description') else ''
- if name and slug:
- try:
- category = Category.objects.create(name = name, slug = slug, description = description)
- messages.success(request, 'Category created successfully!')
- return redirect('blog-admin:categories')
- except Exception as e:
- messages.error(request, 'Error: {}'.format(e), extra_tags='new_category_create_error', data = { 'name': name, 'slug': slug, 'description': description })
- return redirect('blog-admin:new-category')
- else:
- messages.error(request, 'Error: All fields are required!', extra_tags='new_category_create_error', data = { 'name': name, 'slug': slug, 'description': description })
- return redirect('blog-admin:new-category')
- else:
- return render(request, 'blog_admin/new_category.html', { 'title': 'New Category' })
- else:
- return redirect('blog:home')
-
-def edit_category(request, slug):
- pass
-
-def delete_category(request, slug):
- pass
-
-def tags(request):
- if request.user.is_authenticated and (request.user.is_superuser or request.user.is_staff):
- page = request.GET.get('page') if request.GET.get('page') else 1
- try:
- page = int(page)
- except:
- page = 1
- tags = Tag.objects.all()[(page-1)*50:page*50]
- num_pages = Tag.objects.all().count() // 50 + 1
- # add post count to each tag
- for tag in tags:
- # post_count which contain this tag slug
- post_count = Post.objects.filter(tags__slug = tag.slug).count()
- tag.post_count = post_count
- url_to_render = 'blog_admin/tags.html?page={}'.format(page) if int(page) and int(page) > 1 else 'blog_admin/tags.html'
- return render(request, url_to_render, { 'title': 'Manage Tags', 'tags': tags, 'num_pages': num_pages, 'page': page })
- else:
- return redirect('blog:home')
-
-def new(request):
- pass
-
-def users(request):
- if request.user.is_authenticated and (request.user.is_superuser or request.user.is_staff):
- page = request.GET.get('page') if request.GET.get('page') else 1
- try:
- page = int(page)
- except:
- page = 1
- users = User.objects.filter(is_superuser=False)[(page-1)*50:page*50]
- num_pages = User.objects.filter(is_superuser=False).count() // 50 + 1
- url_to_render = 'blog_admin/users.html?page={}'.format(page) if int(page) and int(page) > 1 else 'blog_admin/users.html'
- return render(request, url_to_render, { 'title': 'Manage Users', 'normal_users': users, 'num_pages': num_pages, 'page': page })
- else:
- return redirect('blog:home')
-
-def users_search(request):
- q = request.GET.get('q')
- if request.user.is_authenticated and (request.user.is_superuser or request.user.is_staff):
- if q:
- try:
- # Get the normal users where username or email or first_name or last_name contains q or the user id is int(q)
- users = User.objects.filter(is_superuser=False).filter(username__icontains=q) | User.objects.filter(is_superuser=False).filter(email__icontains=q) | User.objects.filter(is_superuser=False).filter(first_name__icontains=q) | User.objects.filter(is_superuser=False).filter(last_name__icontains=q) | User.objects.filter(is_superuser=False).filter(id = int(q))
- except:
- # Get the normal users where username or email or first_name or last_name contains q
- users = User.objects.filter(is_superuser=False).filter(username__icontains=q) | User.objects.filter(is_superuser=False).filter(email__icontains=q) | User.objects.filter(is_superuser=False).filter(first_name__icontains=q) | User.objects.filter(is_superuser=False).filter(last_name__icontains=q)
-
- return render(request, 'blog_admin/users.html', { 'title': 'Search Results for "{}"'.format(q), 'normal_users': users })
- else:
- return redirect('blog-admin:users')
- else:
- return redirect('blog:home')
-
-def new_user(request):
- if request.user.is_authenticated and (request.user.is_superuser or request.user.is_staff):
- if request.method == 'POST':
- username = request.POST.get('username')
- email = request.POST.get('email')
- first_name = request.POST.get('first_name')
- last_name = request.POST.get('last_name')
- password = request.POST.get('password')
- is_superuser = True if request.POST.get('is_superuser') == 'on' else False
- is_staff = True if request.POST.get('is_staff') == 'on' else False
- is_active = True if request.POST.get('is_active') == 'on' else False
-
- # User Profile Data
- bio = request.POST.get('bio')
- location = request.POST.get('location')
- gravatar_email = request.POST.get('gravatar_email')
- is_public = False if request.POST.get('is_public') == 'on' else False
- email_public = False if request.POST.get('email_public') == 'on' else False
- email_verified = True if request.POST.get('email_verified') == 'on' else False
-
- # Create the user
- try:
- user = User.objects.create_user(username=username, email=email, first_name=first_name, last_name=last_name, password=password, is_superuser=is_superuser, is_staff=is_staff, is_active=is_active)
-
- # Create the user profile
- user_profile = UserProfile(user=user, bio=bio, location=location, gravatar_email=gravatar_email, is_public=is_public, email_public=email_public, email_verified=email_verified)
- user_profile.save()
-
- messages.success(request, 'User created successfully!')
- return redirect('blog-admin:users')
- # maybe user name is taken
- except Exception as e:
- messages.error(request, 'Error: {}'.format(e), extra_tags='new_user_create_error')
- return redirect('blog-admin:new-user')
-
- else:
- return render(request, 'blog_admin/new_user.html', { 'title': 'Create New User' })
- else:
- return redirect('blog:home')
-
-def edit_user(request, user_id):
- if request.user.is_authenticated and (request.user.is_superuser or request.user.is_staff):
- if request.method == 'POST':
- request_user = request.user
- user = User.objects.get(id=user_id)
- user.username = request.POST.get('username')
- user.email = request.POST.get('email')
- user.first_name = request.POST.get('first_name')
- user.last_name = request.POST.get('last_name')
- user.is_superuser = request.POST.get('is_superuser') == 'on' if request_user.is_superuser else user.is_superuser
- user.is_staff = request.POST.get('is_staff') == 'on' if request_user.is_superuser else user.is_staff
- user.is_active = True if request.POST.get('is_active') == 'on' else False
-
- # User Profile Data
- try:
- user_profile = UserProfile.objects.get(user=user)
- except:
- user_profile = UserProfile(user=user)
- user_profile.bio = request.POST.get('bio')
- user_profile.location = request.POST.get('location')
- user_profile.gravatar_email = request.POST.get('gravatar_email')
- user_profile.email_verified = True if request.POST.get('email_verified') == 'on' else False
-
- # Save the user
- try:
- user.save()
- user_profile.save()
- messages.success(request, 'User updated successfully!')
- return redirect('blog-admin:users')
- # maybe user name is taken
- except Exception as e:
- messages.error(request, 'Error: {}'.format(e), extra_tags='edit_user_update_error')
- return redirect('blog-admin:edit-user', user_id=user_id)
-
- else:
- user = User.objects.get(id=user_id)
- try:
- user_profile = UserProfile.objects.get(user=user)
- except:
- user_profile = None
- return render(request, 'blog_admin/edit_user.html', { 'title': 'Edit User', 'edit_user': user, 'edit_user_profile': user_profile })
- else:
- return redirect('blog:home') \ No newline at end of file
diff --git a/static/css/main.css b/static/css/main.css
index 5c87e59a..a3d7c516 100644
--- a/static/css/main.css
+++ b/static/css/main.css
@@ -46,6 +46,59 @@ input, textarea {
font-family: Verdana,Helvetica,Arial,Sans-Serif;
}
+/* Full width auto spacing table... ellipsis if text overflows */
+#posts {
+ width: 100%;
+ border-collapse: collapse;
+ border-spacing: 0;
+ table-layout: fixed;
+}
+
+#posts td {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ padding: 5px 0px;
+}
+
+#posts th {
+ text-align: left;
+ padding: 5px 0px;
+ border-bottom: solid 1px #dddddd;
+ font-weight: bold;
+ text-transform: uppercase;
+ font-size: 11px;
+}
+
+#posts tr {
+ border-bottom: solid 1px #dddddd;
+}
+
+
+/* Pagination Table */
+#pagination {
+ margin: 20px auto;
+ border-collapse: collapse;
+ font-weight: bold;
+}
+
+#pagination a {
+ display: inline-block;
+ padding: 5px 10px;
+}
+
+
+.active {
+ color: #fff;
+}
+
+.disabled {
+ color: #dddddd;
+ /* show invalid cursor */
+ cursor: not-allowed;
+}
+
+
.button {
background-color: #3E4245;
border-radius: 5px;
diff --git a/templates/blog/partials/sidebar.html b/templates/blog/partials/sidebar.html
index b7903bff..0bcdf445 100644
--- a/templates/blog/partials/sidebar.html
+++ b/templates/blog/partials/sidebar.html
@@ -188,29 +188,27 @@
</ul>
</div>
-{% if user.is_staff %}
+{% if user.is_superuser %}
<div id="admin-area" class="mtsbitem">
<h2>Admin</h2>
<ul>
- {% if user.is_superuser %}
<li>
<span>
<img src="{% static 'images/site/icons/right_hand.gif' %}" alt="Archive" border="0">
</span>
<span>
- <a href="{% url 'admin:index' %}">
- Admin Area
+ <a href="{% url 'blog-admin:new-post' %}">
+ Create New Post
</a>
</span>
</li>
- {% endif %}
<li>
<span>
<img src="{% static 'images/site/icons/right_hand.gif' %}" alt="Archive" border="0">
</span>
<span>
- <a href="{% url 'blog-admin:users' %}">
- Manage Users
+ <a href="{% url 'blog-admin:posts' %}">
+ Manage Posts
</a>
</span>
</li>
@@ -219,8 +217,18 @@
<img src="{% static 'images/site/icons/right_hand.gif' %}" alt="Archive" border="0">
</span>
<span>
- <a href="{% url 'blog-admin:posts' %}">
- Manage Posts
+ <a href="#">
+ Manage Comments
+ </a>
+ </span>
+ </li>
+ <li>
+ <span>
+ <img src="{% static 'images/site/icons/right_hand.gif' %}" alt="Archive" border="0">
+ </span>
+ <span>
+ <a href="{% url 'admin:auth_user_changelist' %}">
+ Manage Users
</a>
</span>
</li>
@@ -229,7 +237,7 @@
<img src="{% static 'images/site/icons/right_hand.gif' %}" alt="Archive" border="0">
</span>
<span>
- <a href="{% url 'blog-admin:categories' %}">
+ <a href="{% url 'admin:blog_category_changelist' %}">
Manage Categories
</a>
</span>
@@ -239,7 +247,7 @@
<img src="{% static 'images/site/icons/right_hand.gif' %}" alt="Archive" border="0">
</span>
<span>
- <a href="{% url 'blog-admin:tags' %}">
+ <a href="{% url 'admin:blog_tag_changelist' %}">
Manage Tags
</a>
</span>
@@ -249,8 +257,8 @@
<img src="{% static 'images/site/icons/right_hand.gif' %}" alt="Archive" border="0">
</span>
<span>
- <a href="{% url 'blog-admin:comments' %}">
- Manage Comments
+ <a href="{% url 'admin:announcements_announcement_changelist' %}">
+ Manage Announcements
</a>
</span>
</li>
@@ -259,8 +267,8 @@
<img src="{% static 'images/site/icons/right_hand.gif' %}" alt="Archive" border="0">
</span>
<span>
- <a href="{% url 'blog-admin:new-post' %}">
- Create New Post
+ <a href="{% url 'admin:index' %}">
+ Admin Area
</a>
</span>
</li>
diff --git a/templates/blog/post.html b/templates/blog/post.html
index 9a20f506..8bce0765 100644
--- a/templates/blog/post.html
+++ b/templates/blog/post.html
@@ -39,6 +39,7 @@
</p>
<p>
<span id="comment-body-{{ comment.id }}">{{ comment.body }}</span>
+ {% if comment.user == user %}
<form action="{% url 'blog:edit_comment' post.slug %}" method="POST" id="edit-form-{{ comment.id }}" style="display: none;">
{% csrf_token %}
<input type = "hidden" name="comment_id" value="{{ comment.id }}">
@@ -46,6 +47,7 @@
<input type="submit" value="Update" class="button button-special">
<input type="button" value="Cancel" onclick="cancelEdit({{ comment.id }})" class="button">
</form>
+ {% endif %}
</p>
</td>
</tr>
diff --git a/templates/blog_admin/categories.html b/templates/blog_admin/categories.html
deleted file mode 100644
index 9a3152bd..00000000
--- a/templates/blog_admin/categories.html
+++ /dev/null
@@ -1,53 +0,0 @@
-{% extends 'blog/partials/base.html' %} {% block content %}
-<div class="main">
- <section>
- {% include 'blog_admin/partials/category_topbar.html' %}
- <table class="table table-striped">
- <thead>
- <tr>
- <th>Category Name</th>
- <th>Category Description</th>
- <th>Category Slug</th>
- <th>Created At</th>
- <th>Actions</th>
- </tr>
- </thead>
- <tbody>
- {% for category in categories %}
- <tr>
- <td>{{ category.name }}</td>
- <td>{{ category.description }}</td>
- <td>{{ category.slug }}</td>
- <td>{{ category.created_at }}</td>
- <td>
- <a href="{% url 'blog-admin:edit-category' category.id %}">Edit</a>
- <a href="{% url 'blog-admin:delete-category' category.id %}">Delete</a>
- </td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% if num_pages and page %}
- <div class="pagination">
- {% if page == 1 %}
- <a href="#" class="disabled">&laquo;</a>
- <a href="#" class="disabled">&lsaquo;</a>
- {% else %}
- <a href="{% url 'blog-admin:categories'%}?page=1">&laquo;</a>
- <a href="{% url 'blog-admin:categories'%}?page={{ page|add:-1 }}">&lsaquo;</a>
- {% endif %}
- {% for i in num_pages|make_list %}
- <a href="{% url 'blog-admin:categories'%}?page={{ i }}">{{ i }}</a>
- {% endfor %}
- {% if page == num_pages %}
- <a href="#" class="disabled">&rsaquo;</a>
- <a href="#" class="disabled">&raquo;</a>
- {% else %}
- <a href="{% url 'blog-admin:categories'%}?page={{ page|add:1 }}">&rsaquo;</a>
- <a href="{% url 'blog-admin:categories'%}?page={{ num_pages }}">&raquo;</a>
- {% endif %}
- </div>
- {% endif %}
- </section>
-</div>
-{% endblock %}
diff --git a/templates/blog_admin/edit_user.html b/templates/blog_admin/edit_user.html
deleted file mode 100644
index 9b508e11..00000000
--- a/templates/blog_admin/edit_user.html
+++ /dev/null
@@ -1,66 +0,0 @@
-{% extends 'blog/partials/base.html' %} {% block content %}
-<div class="main">
- <section>
- {% include 'blog_admin/partials/users_topbar.html' %}
- <form action="{% url 'blog-admin:edit-user' edit_user.id %}" method="post">
- {% csrf_token %}
- <div class="form-group">
- <label for="username">Username</label>
- <input type="text" class="form-control" id="username" name="username" placeholder="Username" value="{{ edit_user.username }}">
- </div>
- <div class="form-group">
- <label for="email">First Name</label>
- <input type="text" class="form-control" id="first_name" name="first_name" placeholder="First Name" value="{{ edit_user.first_name }}">
- </div>
- <div class="form-group">
- <label for="email">Last Name</label>
- <input type="text" class="form-control" id="last_name" name="last_name" placeholder="Last Name" value="{{ edit_user.last_name }}">
- </div>
- <div class="form-group">
- <label for="email">Email</label>
- <input type="email" class="form-control" id="email" name="email" placeholder="Email" value="{{ edit_user.email }}">
- </div>
- {% if user.is_superuser %}
- <div class="form-group">
- <input style="display:inline-block" type="checkbox" class="form-control" id="is_superuser" name="is_superuser" {% if edit_user.is_superuser %}checked{% endif %}>
- <label style="display:inline-block" for="is_superuser">Superuser</label>
- </div>
- <div class="form-group">
- <input style="display:inline-block" type="checkbox" class="form-control" id="is_staff" name="is_staff" {% if edit_user.is_staff %}checked{% endif %}>
- <label style="display:inline-block" for="is_staff">Staff</label>
- </div>
- {% endif %}
- <div class="form-group">
- <input style="display:inline-block" type="checkbox" class="form-control" id="is_active" name="is_active" {% if edit_user.is_active %}checked{% endif %}>
- <label style="display:inline-block" for="is_active">Active</label>
- </div>
- <div class="form-group">
- <label for="bio">Bio</label>
- <textarea class="form-control" id="bio" name="bio" placeholder="Bio"></textarea value="{{ edit_user_profile.bio }}">
- </div>
- <div class="form-group">
- <label for="location">Location</label>
- <input type="text" class="form-control" id="location" name="location" placeholder="Location" value="{{ edit_user_profile.location }}">
- </div>
- <div class="form-group">
- <label for="gravatar_email">Gravatar Email</label>
- <input type="email" class="form-control" id="gravatar_email" name="gravatar_email" placeholder="Gravatar Email" value="{{ edit_user_profile.gravatar_email }}">
- </div>
- <div class="form-group">
- <input style="display:inline-block" type="checkbox" class="form-control" id="is_public" name="is_public" disabled>
- <label style="display:inline-block" for="is_public">Public</label>
- </div>
- <div class="form-group">
- <input style="display:inline-block" type="checkbox" class="form-control" id="email_public" name="email_public" disabled>
- <label style="display:inline-block" for="email_public">Email Public</label>
- </div>
- <div class="form-group">
- <input style="display:inline-block" type="checkbox" class="form-control" id="email_verified" name="email_verified" {% if edit_user_profile.email_verified %}checked{% endif %}>
- <label style="display:inline-block" for="email_verified">Email Verified</label>
- </div>
- <div class="form-group">
- <input type="submit" name="submit" value="Save User Details" id="submit">
- </div>
- </section>
-</div>
-{% endblock %}
diff --git a/templates/blog_admin/new_category.html b/templates/blog_admin/new_category.html
deleted file mode 100644
index ed27767e..00000000
--- a/templates/blog_admin/new_category.html
+++ /dev/null
@@ -1,38 +0,0 @@
-{% extends 'blog/partials/base.html' %} {% block content %}
-<div class="main">
- <section>
- {% include 'blog_admin/partials/category_topbar.html' %}
- <form action="{% url 'blog-admin:new-category' %}" method="post">
- {% csrf_token %}
- <div class="form-group">
- <label for="name">Name</label>
- <input type="text" class="form-control" id="name" name="name" placeholder="Enter name" value="{{ category.name }}">
- </div>
- <div class="form-group">
- <label for="slug">Slug</label>
- <input type="text" class="form-control" id="slug" name="slug" placeholder="Enter slug" value="{{ category.slug }}">
- </div>
- <div class="form-group">
- <label for="description">Description</label>
- <textarea class="form-control" id="description" name="description" rows="3" placeholder="Enter description">{{ category.description }}</textarea>
- </div>
- <button type="submit" class="btn btn-primary">Submit</button>
- </form>
- </section>
-</div>
-<script>
- function slugify(text) {
- return text.toString().toLowerCase()
- .replace(/\s+/g, '-') // Replace spaces with -
- .replace(/[^\w\-]+/g, '') // Remove all non-word chars
- .replace(/\-\-+/g, '-') // Replace multiple - with single -
- .replace(/^-+/, '') // Trim - from start of text
- .replace(/-+$/, ''); // Trim - from end of text
- }
- const name = document.getElementById('name');
- const slug = document.getElementById('slug');
- name.addEventListener('keyup', function() {
- slug.value = slugify(name.value);
- });
-</script>
-{% endblock %} \ No newline at end of file
diff --git a/templates/blog_admin/new_user.html b/templates/blog_admin/new_user.html
deleted file mode 100644
index 217018d2..00000000
--- a/templates/blog_admin/new_user.html
+++ /dev/null
@@ -1,74 +0,0 @@
-{% extends 'blog/partials/base.html' %} {% block content %}
-<div class="main">
- <section>
- {% include 'blog_admin/partials/users_topbar.html' %}
- <form action="{% url 'blog-admin:new-user' %}" method="post">
- {% csrf_token %}
- <div class="form-group">
- <label for="username">Username</label>
- <input type="text" class="form-control" id="username" name="username" placeholder="Username">
- </div>
- <div class="form-group">
- <label for="email">First Name</label>
- <input type="text" class="form-control" id="first_name" name="first_name" placeholder="First Name">
- </div>
- <div class="form-group">
- <label for="email">Last Name</label>
- <input type="text" class="form-control" id="last_name" name="last_name" placeholder="Last Name">
- </div>
- <div class="form-group">
- <label for="email">Email</label>
- <input type="email" class="form-control" id="email" name="email" placeholder="Email">
- </div>
- <div class="form-group">
- <label for="password">Password</label>
- <input type="password" class="form-control" id="password" name="password" placeholder="Password">
- </div>
- <div class="form-group">
- <label for="password">Confirm Password</label>
- <input type="password" class="form-control" id="confirm_password" name="confirm_password" placeholder="Confirm Password">
- </div>
- {% if user.is_superuser %}
- <div class="form-group">
- <input style="display:inline-block" type="checkbox" class="form-control" id="is_superuser" name="is_superuser" {% if edit_user.is_superuser %}checked{% endif %}>
- <label style="display:inline-block" for="is_superuser">Superuser</label>
- </div>
- <div class="form-group">
- <input style="display:inline-block" type="checkbox" class="form-control" id="is_staff" name="is_staff" {% if edit_user.is_staff %}checked{% endif %}>
- <label style="display:inline-block" for="is_staff">Staff</label>
- </div>
- {% endif %}
- <div class="form-group">
- <input style="display:inline-block" type="checkbox" class="form-control" id="is_active" name="is_active" {% if edit_user.is_active %}checked{% endif %}>
- <label style="display:inline-block" for="is_active">Active</label>
- </div>
- <div class="form-group">
- <label for="bio">Bio</label>
- <textarea class="form-control" id="bio" name="bio" placeholder="Bio"></textarea>
- </div>
- <div class="form-group">
- <label for="location">Location</label>
- <input type="text" class="form-control" id="location" name="location" placeholder="Location">
- </div>
- <div class="form-group">
- <label for="gravatar_email">Gravatar Email</label>
- <input type="email" class="form-control" id="gravatar_email" name="gravatar_email" placeholder="Gravatar Email">
- </div>
- <div class="form-group">
- <input style="display:inline-block" type="checkbox" class="form-control" id="is_public" name="is_public" disabled>
- <label style="display:inline-block" for="is_public">Public</label>
- </div>
- <div class="form-group">
- <input style="display:inline-block" type="checkbox" class="form-control" id="email_public" name="email_public" disabled>
- <label style="display:inline-block" for="email_public">Email Public</label>
- </div>
- <div class="form-group">
- <input style="display:inline-block" type="checkbox" class="form-control" id="email_verified" name="email_verified">
- <label style="display:inline-block" for="email_verified">Email Verified</label>
- </div>
- <div class="form-group">
- <input type="submit" name="submit" value="Create User" id="submit">
- </div>
- </section>
-</div>
-{% endblock %}
diff --git a/templates/blog_admin/posts.html b/templates/blog_admin/posts.html
index a996986c..aabfbba9 100644
--- a/templates/blog_admin/posts.html
+++ b/templates/blog_admin/posts.html
@@ -1,8 +1,8 @@
{% extends 'blog/partials/base.html' %} {% block content %}
<div class="main">
- <section>
+ <div>
{% include 'blog_admin/partials/posts_topbar.html' %}
- <table class="table table-striped">
+ <table id="posts">
<thead>
<tr>
<th>Title</th>
@@ -23,7 +23,7 @@
<td style="position: relative;"> {% if post.is_public %} <span class="label label-success">Published</span> {% else %} <span class="label label-warning">Draft</span> {% endif %} </td>
<td>
<a href="{% url 'blog-admin:edit-post' post.slug %}">Edit</a>
- <a href="#" class="error">Delete</a>
+ <a href="{% url 'admin:blog_post_delete' post.id %}" class="error">Delete</a>
{% if post.is_public %}
<a href="{% url 'blog-admin:unpublish-post' post.slug %}" class="error" onclick="return confirm('This post will immediately be hidden from users. Proceed?')">Unpublish</a>
{% else %}
@@ -36,25 +36,32 @@
</table>
{% if num_pages and page %}
<div class="pagination">
- {% if page == 1 %}
- <a href="#" class="disabled">&laquo;</a>
- <a href="#" class="disabled">&lsaquo;</a>
- {% else %}
- <a href="{% url 'blog-admin:posts'%}?page=1">&laquo;</a>
- <a href="{% url 'blog-admin:posts'%}?page={{ page|add:-1 }}">&lsaquo;</a>
- {% endif %}
- {% for i in num_pages|make_list %}
- <a href="{% url 'blog-admin:posts'%}?page={{ i }}">{{ i }}</a>
- {% endfor %}
- {% if page == num_pages %}
- <a href="#" class="disabled">&rsaquo;</a>
- <a href="#" class="disabled">&raquo;</a>
- {% else %}
- <a href="{% url 'blog-admin:posts'%}?page={{ page|add:1 }}">&rsaquo;</a>
- <a href="{% url 'blog-admin:posts'%}?page={{ num_pages }}">&raquo;</a>
- {% endif %}
+ <center>
+ <table id="pagination">
+ <tr>
+ {% if page == 1 %}
+ <td><a class="disabled">&laquo;</a></td>
+ <td style="margin-right: 15px;"><a class="disabled">&lsaquo;</a></td>
+ {% else %}
+ <td><a href="{% url 'blog-admin:posts' %}?page=1">&laquo;</a></td>
+ <td style="margin-right: 15px;"><a href="{% url 'blog-admin:posts' %}?page={{ page|add:'-1' }}">&lsaquo;</a></td>
+ {% endif %}
+ {% load times %}
+ {% for i in num_pages|times %}
+ <td><a {% if i == page %}class="active"{% endif %} href="{% url 'blog-admin:posts' %}?page={{ i }}">{{ i }}</a></td>
+ {% endfor %}
+ {% if page == num_pages %}
+ <td style="margin-left: 15px;" class="disabled"><a class="disabled">&rsaquo;</a></td>
+ <td><a class="disabled">&raquo;</a></td>
+ {% else %}
+ <td style="margin-left: 15px;"><a href="{% url 'blog-admin:posts' %}?page={{ page|add:'1' }}">&rsaquo;</a></td>
+ <td><a href="{% url 'blog-admin:posts' %}?page={{ num_pages }}">&raquo;</a></td>
+ {% endif %}
+ </tr>
+ </table>
+ </center>
</div>
{% endif %}
- </section>
+ </div>
</div>
{% endblock %}
diff --git a/templates/blog_admin/tags.html b/templates/blog_admin/tags.html
deleted file mode 100644
index 3d3d10d2..00000000
--- a/templates/blog_admin/tags.html
+++ /dev/null
@@ -1,49 +0,0 @@
-{% extends 'blog/partials/base.html' %} {% block content %}
-<div class="main">
- <section>
- {% include 'blog_admin/partials/tags_topbar.html' %}
- <table class="table table-striped">
- <thead>
- <tr>
- <th>Slug</th>
- <th>tags</th>
- <th>Actions</th>
- </tr>
- </thead>
- <tbody>
- {% for tag in tags %}
- <tr>
- <td>{{ tag.slug }}</td>
- <td>{{ tag.post_count }}</td>
- <td>
- <a href="#" class="btn btn-default btn-xs">Edit</a>
- <a href="#" class="btn btn-danger btn-xs">Delete</a>
- </td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% if num_pages and page %}
- <div class="pagination">
- {% if page == 1 %}
- <a href="#" class="disabled">&laquo;</a>
- <a href="#" class="disabled">&lsaquo;</a>
- {% else %}
- <a href="{% url 'blog-admin:tags'%}?page=1">&laquo;</a>
- <a href="{% url 'blog-admin:tags'%}?page={{ page|add:-1 }}">&lsaquo;</a>
- {% endif %}
- {% for i in num_pages|make_list %}
- <a href="{% url 'blog-admin:tags'%}?page={{ i }}">{{ i }}</a>
- {% endfor %}
- {% if page == num_pages %}
- <a href="#" class="disabled">&rsaquo;</a>
- <a href="#" class="disabled">&raquo;</a>
- {% else %}
- <a href="{% url 'blog-admin:tags'%}?page={{ page|add:1 }}">&rsaquo;</a>
- <a href="{% url 'blog-admin:tags'%}?page={{ num_pages }}">&raquo;</a>
- {% endif %}
- </div>
- {% endif %}
- </section>
-</div>
-{% endblock %}
diff --git a/templates/blog_admin/users.html b/templates/blog_admin/users.html
deleted file mode 100644
index 8b69cd69..00000000
--- a/templates/blog_admin/users.html
+++ /dev/null
@@ -1,63 +0,0 @@
-{% extends 'blog/partials/base.html' %} {% block content %}
-<div class="main">
- <section>
- {% include 'blog_admin/partials/users_topbar.html' %}
- <table class="table table-striped">
- <thead>
- <tr>
- <th scope="col">User ID</th>
- <th scope="col">Username</th>
- <th scope="col">First Name</th>
- <th scope="col">Last Name</th>
- <th scope="col">Email</th>
- <th scope="col">Role(s)</th>
- <th scope="col">Actions</th>
- </tr>
- </thead>
- <tbody>
- {% for current_user in normal_users %}
- {% if current_user.id != user.id %}
- <tr>
- <td>{{ current_user.id }}</td>
- <td>{{ current_user.username }}</td>
- <td>{{ current_user.first_name }}</td>
- <td>{{ current_user.last_name }}</td>
- <td>{{ current_user.email }}</td>
- <td>
- {% if current_user.is_superuser %}Super user, {% endif %}
- {% if current_user.is_staff %}Staff, {% endif %}
- {% if current_user.is_active %}Active{% endif %}
- </td>
- <td>
- <a href="{% url 'blog-admin:edit-user' current_user.id %}" class="btn btn-primary btn-sm">Edit</a>
- <a href="#" class="btn btn-danger btn-sm">Delete</a>
- </td>
- </tr>
- {% endif %}
- {% endfor %}
- </tbody>
- </table>
- {% if num_pages and page %}
- <div class="pagination">
- {% if page == 1 %}
- <a href="#" class="disabled">&laquo;</a>
- <a href="#" class="disabled">&lsaquo;</a>
- {% else %}
- <a href="{% url 'blog-admin:users' %}?page=1">&laquo;</a>
- <a href="{% url 'blog-admin:users' %}?page={{ page|add:-1 }}">&lsaquo;</a>
- {% endif %}
- {% for i in num_pages|make_list %}
- <a href="{% url 'blog-admin:users' %}?page={{ i }}">{{ i }}</a>
- {% endfor %}
- {% if page == num_pages %}
- <a href="#" class="disabled">&rsaquo;</a>
- <a href="#" class="disabled">&raquo;</a>
- {% else %}
- <a href="{% url 'blog-admin:users' %}?page={{ page|add:1 }}">&rsaquo;</a>
- <a href="{% url 'blog-admin:users' %}?page={{ num_pages }}">&raquo;</a>
- {% endif %}
- </div>
- {% endif %}
- </section>
-</div>
-{% endblock %}
diff --git a/templates/dev_status/home.html b/templates/dev_status/home.html
index 2b3e34d0..6c494fe5 100644
--- a/templates/dev_status/home.html
+++ b/templates/dev_status/home.html
@@ -65,26 +65,24 @@
</div>
<div class="pagination">
<center>
- <table style="margin: 0 auto; border-spacing: 5px; border-collapse: separate;">
+ <table id="pagination">
<tr>
{% if page == 1 %}
- <td class="page page-disabled"><a class="page-disabled" href="#">&laquo;</a></td>
- <td class="page page-disabled" style="margin-right: 15px;"><a class="page-disabled" href="#">&lsaquo;</a></td>
+ <td><a class="disabled">&laquo;</a></td>
+ <td style="margin-right: 15px;"><a class="disabled">&lsaquo;</a></td>
{% else %}
- <td class="page"><a style="color: #8693e1;" href="{% url 'dev_status:home'%}?search={{ search }}&items={{ items }}&filter={{ filter }}&sort={{ sort }}&direction={{ direction }}&page=1">&laquo;</a></td>
- <td class="page" style="margin-right: 15px; color: #8693e1;"><a href="{% url 'dev_status:home'%}?search={{ search }}&items={{ items }}&filter={{ filter }}&sort={{ sort }}&direction={{ direction }}&page={{ page|add:-1 }}">&lsaquo;</a></td>
+ <td><a href="{% url 'dev_status:home'%}?search={{ search }}&items={{ items }}&filter={{ filter }}&sort={{ sort }}&direction={{ direction }}&page=1">&laquo;</a></td>
+ <td style="margin-right: 15px;"><a href="{% url 'dev_status:home'%}?search={{ search }}&items={{ items }}&filter={{ filter }}&sort={{ sort }}&direction={{ direction }}&page={{ page|add:-1 }}">&lsaquo;</a></td>
{% endif %}
- <td class="page-separator"> </td>
{% for i in num_pages|times %}
- <td class="page {% if i == page %}page-active{% endif %}"><a {% if i == page %}style="color: white;" {% endif %} href="{% url 'dev_status:home'%}?search={{ search }}&items={{ items }}&filter={{ filter }}&sort={{ sort }}&direction={{ direction }}&page={{ i }}">{{ i }}</a></td>
+ <td><a {% if i == page %}class="active"{% endif %} href="{% url 'dev_status:home'%}?search={{ search }}&items={{ items }}&filter={{ filter }}&sort={{ sort }}&direction={{ direction }}&page={{ i }}">{{ i }}</a></td>
{% endfor %}
- <td class="page-separator"> </td>
{% if page == num_pages %}
- <td class="page page-disabled" style="margin-left: 15px;"><a class="page-disabled" href="#">&rsaquo;</a></td>
- <td class="page page-disabled"><a class="page-disabled" href="#">&raquo;</a></td>
+ <td style="margin-left: 15px;"><a class="disabled">&rsaquo;</a></td>
+ <td><a class="disabled">&raquo;</a></td>
{% else %}
- <td class="page" style="margin-left: 15px;"><a style="color: #8693e1;" href="{% url 'dev_status:home'%}?search={{ search }}&items={{ items }}&filter={{ filter }}&sort={{ sort }}&direction={{ direction }}&page={{ page|add:1 }}">&rsaquo;</a></td>
- <td class="page"><a style="color: #8693e1;" href="{% url 'dev_status:home'%}?search={{ search }}&items={{ items }}&filter={{ filter }}&sort={{ sort }}&direction={{ direction }}&page={{ num_pages }}">&raquo;</a></td>
+ <td style="margin-left: 15px;"><a href="{% url 'dev_status:home'%}?search={{ search }}&items={{ items }}&filter={{ filter }}&sort={{ sort }}&direction={{ direction }}&page={{ page|add:1 }}">&rsaquo;</a></td>
+ <td><a href="{% url 'dev_status:home'%}?search={{ search }}&items={{ items }}&filter={{ filter }}&sort={{ sort }}&direction={{ direction }}&page={{ num_pages }}">&raquo;</a></td>
{% endif %}
</tr>
</table>