Skip to content
This repository was archived by the owner on May 23, 2020. It is now read-only.

Commit e7a409b

Browse files
committed
edited typo, sidebar, detail, css, else
1 parent c78633b commit e7a409b

File tree

9 files changed

+104
-100
lines changed

9 files changed

+104
-100
lines changed

blog/templates/base.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@
7979
{% include "includes/menu.html" %}
8080

8181
<div class="container main__container">
82-
<div class="blog-header"></div>
83-
8482
<div class="row">
8583
<div class="col-sm-8 blog-main">
8684
{% block content %}{% endblock %}
Lines changed: 68 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{% extends "base.html" %}
2+
{% load staticfiles %}
23
{% block title %}{{ object.title }} - {{ block.super }}{% endblock %}
34
{% block canonical_url %}https://{{ request.get_host }}{% url 'detail_post_page' slug=object.slug %}{% endblock %}
45

@@ -32,98 +33,91 @@
3233
<div class="post" id="printable">
3334
<h2><a href="{% url "detail_post_page" slug=object.slug %}">{{ object.title }}</a></h2>
3435
<div class="meta">
35-
Created: {{ object.created }} - Modified: {{ object.modified }}<br />
36-
Author: <a href="{% url 'author_posts_page' username=object.author.user.username %}">{{ object.author }}</a>
37-
38-
<div class="pull-right">
39-
<i>Your IP:</i> <span class="label label-danger">{{ get_client_ip }}</span>
40-
<i>Views:</i> <span class="label label-primary">{{ visitor_counter }}</span>
41-
</div>
36+
By: <a href="{% url 'author_posts_page' username=object.author.user.username %}" style="text-transform:uppercase">{{ object.author }}</a> &#9679;
37+
at {{ object.created }} &#9679; and modified at {{ object.modified }}<br />
38+
Posted under:
39+
{% for tag in object.tags.all %}
40+
<a href="{% url 'tag_posts_page' slug=tag.slug %}">#{{ tag }}</a>{% if not forloop.last %}, {% endif %}
41+
{% empty %}Uncategories
42+
{% endfor %}
43+
<br />
44+
Your ip address: {{ get_client_ip }} &#9679; views: {{ visitor_counter }} times.
4245
</div>
43-
<hr>
4446

4547
<p>
4648
{% if object.cover %}
4749
<caption align="bottom">
48-
<img class="cover-post" src="/media/{{ object.cover }}" title="{{ object.title }}" alt="{{ object.title }}"/>
50+
<img style="width:100%" class="cover-post" src="//{{ request.get_host }}/media/{{ object.cover }}" title="{{ object.title }}" alt="{{ object.title }}"/>
4951
<span style="margin-left: 1px;background: #F2F4F3; padding: 0 5px; text-shadow: 1px 1px 1px #fff;">{{ object.title }}</span>
5052
</caption>
5153
{% endif %}
5254
</p>
5355
{{ object.description|safe }}
5456

55-
<p>
56-
Tagged under:
57-
{% for tag in object.tags.all %}
58-
<a href="{% url 'tag_posts_page' slug=tag.slug %}">#{{ tag }}</a>{% if not forloop.last %}, {% endif %}
59-
{% empty %}Uncategories
60-
{% endfor %}
61-
</p>
62-
63-
<div class="share panel-body" id="non-printable">
64-
<span>Share on: </span>
65-
<a class="btn btn-sm btn-primary cst__radius" href="https://www.facebook.com/sharer/sharer.php?u=https://python.web.id{% url "detail_post_page" slug=object.slug %}" target="_blank">Facebook</a>
66-
<a class="btn btn-sm btn-danger cst__radius" href="https://plus.google.com/share?url=https://python.web.id{% url "detail_post_page" slug=object.slug %}" target="_blank">Google+</a>
67-
<a class="btn btn-sm btn-info cst__radius" href="https://twitter.com/share" target="_blank">Twitter</a>
68-
<a class="btn btn-sm btn-success cst__radius" href="javascript:window.print()">Print Page</a>
69-
</div>
57+
<div class="share panel-body" id="non-printable">
58+
<span>Share on: </span>
59+
<a class="btn btn-sm btn-primary cst__radius" href="https://www.facebook.com/sharer/sharer.php?u=https://python.web.id{% url "detail_post_page" slug=object.slug %}" target="_blank">Facebook</a>
60+
<a class="btn btn-sm btn-danger cst__radius" href="https://plus.google.com/share?url=https://python.web.id{% url "detail_post_page" slug=object.slug %}" target="_blank">Google+</a>
61+
<a class="btn btn-sm btn-info cst__radius" href="https://twitter.com/share" target="_blank">Twitter</a>
62+
<a class="btn btn-sm btn-success cst__radius" href="javascript:window.print()">Print Page</a>
63+
</div>
7064

71-
<style type="text/css" media="print">
72-
@media print {
73-
#non-printable, .ip-client { display: none; }
74-
#printable { display: block; width: 100%;height: 100%;}
75-
a[href]::after {content: "";} /*content: " (" attr(href) ")"*/
76-
}
77-
</style>
65+
<style type="text/css" media="print">
66+
@media print {
67+
#non-printable, .ip-client { display: none; }
68+
#printable { display: block; width: 100%;height: 100%;}
69+
a[href]::after {content: "";} /*content: " (" attr(href) ")"*/
70+
}
71+
</style>
7872

79-
<div class="panel panel-default" id="non-printable">
80-
<div class="panel-heading">Author</div>
81-
<div class="panel-body">
82-
<div class="media">
83-
<div class="media-left media-middle" style="float: left;margin-right: 10px;">
84-
<a href="{% url 'author_posts_page' username=object.author.user.username %}">
85-
<img class="media-object" alt="{{ object.author }}" title="{{ object.author }}" src="{% if object.author.avatar %}/media/{{ object.author.avatar }}{% else %}/static/assets/icons/avatar.jpeg{% endif %}" style="width: 64px; height: 64px;">
86-
</a>
73+
<div class="panel panel-default" id="non-printable">
74+
<div class="panel-heading">Author</div>
75+
<div class="panel-body">
76+
<div class="media">
77+
<div class="media-left media-middle" style="float: left;margin-right: 10px;">
78+
<a href="{% url 'author_posts_page' username=object.author.user.username %}">
79+
<img class="media-object" alt="{{ object.author }}" title="{{ object.author }}" src="{% if object.author.avatar %}/media/{{ object.author.avatar }}{% else %}/static/assets/icons/avatar.jpeg{% endif %}" style="width: 64px; height: 64px;">
80+
</a>
81+
</div>
82+
<div class="media-body">
83+
<h4 class="media-heading">{{ object.author }}</h4>
84+
{{ object.author.about|safe }}<br />
85+
Website: <a href="{{ object.author.website }}" target="_blank">{{ object.author.website }}</a>
86+
</div>
87+
</div>
8788
</div>
88-
<div class="media-body">
89-
<h4 class="media-heading">{{ object.author }}</h4>
90-
{{ object.author.about|safe }}<br />
91-
Website: <a href="{{ object.author.website }}" target="_blank">{{ object.author.website }}</a>
89+
</div>
90+
91+
<div class="panel panel-default related" id="non-printable">
92+
<div class="panel-heading">
93+
<h3 class="panel-title">Related Posts</h3>
9294
</div>
95+
<ul class="list-group">
96+
{% for post in related_posts %}
97+
<li class="list-group-item"><a href="{% url "detail_post_page" slug=post.slug %}">{{ post.title }}</a> - <i>{{ post.created }}</i></li>
98+
{% empty %}
99+
<p style="margin: 1em;">No related posts!</p>
100+
{% endfor %}
101+
</ul>
93102
</div>
94-
</div>
95-
</div>
96103

97-
<div class="panel panel-default related" id="non-printable">
98-
<div class="panel-heading">
99-
<h3 class="panel-title">Related Posts</h3>
100-
</div>
101-
<ul class="list-group">
102-
{% for post in related_posts %}
103-
<li class="list-group-item"><a href="{% url "detail_post_page" slug=post.slug %}">{{ post.title }}</a> - <i>{{ post.created }}</i></li>
104-
{% empty %}
105-
<p style="margin: 1em;">No related posts!</p>
106-
{% endfor %}
104+
<ul class="pager" id="non-printable">
105+
<li class="previous">
106+
{% if object.get_previous_by_created %}
107+
<a href="{% url 'detail_post_page' slug=object.get_previous_by_created.slug %}">&larr; Previous</a>
108+
{% endif %}
109+
</li>
110+
<li class="next">
111+
{% if object.get_next_by_created %}
112+
<a href="{% url 'detail_post_page' slug=object.get_next_by_created.slug %}">Next &rarr;</a>
113+
{% endif %}
114+
</li>
107115
</ul>
108-
</div>
109-
110-
<ul class="pager" id="non-printable">
111-
<li class="previous">
112-
{% if object.get_previous_by_created %}
113-
<a href="{% url 'detail_post_page' slug=object.get_previous_by_created.slug %}">&larr; Previous</a>
114-
{% endif %}
115-
</li>
116-
<li class="next">
117-
{% if object.get_next_by_created %}
118-
<a href="{% url 'detail_post_page' slug=object.get_next_by_created.slug %}">Next &rarr;</a>
119-
{% endif %}
120-
</li>
121-
</ul>
122116

123-
{% load disqus_tags %}
124-
{% set_disqus_identifier "blogpost_" object.title %}
125-
{% set_disqus_title object.title %}
126-
{% disqus_show_comments %}
127-
<!-- disqus_dev -->
117+
{% load disqus_tags %}
118+
{% set_disqus_identifier "blogpost_" object.title %}
119+
{% set_disqus_title object.title %}
120+
{% disqus_show_comments %}
121+
<!-- disqus_dev -->
128122
</div>
129123
{% endblock %}

blog/templates/blog/blog_home.html

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{% extends "base.html" %}
2+
{% load staticfiles %}
23

34
{% block content %}
45
{% block message_info_homepage %}{% endblock %}
@@ -7,18 +8,19 @@
78
<div class="post">
89
<h2 class="title__bold"><a href="{% url 'detail_post_page' slug=object.slug %}">{{ object.title }}</a></h2>
910
<p class="meta">
10-
Created: {{ object.created }} -
11-
By: <a href="{% url 'author_posts_page' username=object.author.user.username %}">{{ object.author }}</a> -
12-
Tagged under:
11+
By: <a href="{% url 'author_posts_page' username=object.author.user.username %}" style="text-transform:uppercase">{{ object.author }}</a> &#9679;
12+
at {{ object.created }} &#9679;
13+
Posted under:
1314
{% for tag in object.tags.all %}
14-
<a href="{% url 'tag_posts_page' slug=tag.slug %}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
15+
<a href="{% url 'tag_posts_page' slug=tag.slug %}">#{{ tag }}</a>{% if not forloop.last %}, {% endif %}
1516
{% empty %}Uncategories
1617
{% endfor %}
1718
</p>
19+
1820
{% if object.cover %}
1921
<div class="cst__cover__posts">
2022
<a href="{% url 'detail_post_page' slug=object.slug %}">
21-
<img style="width:100%" src="/media/{{ object.cover }}" alt="{{ object.title }}">
23+
<img style="width:100%" src="/media/{{ object.cover }}" alt="{{ object.title }}" title="{{ object.title }}">
2224
</a>
2325
</div>
2426
{% endif %}
@@ -36,21 +38,21 @@ <h2 class="title__bold"><a href="{% url 'detail_post_page' slug=object.slug %}">
3638
{% if request.GET.q %}
3739
<ul class="pagination">
3840
<li {% if not page_obj.has_previous %}class="disabled"{% endif %}>
39-
<a {% if page_obj.has_previous %}href="?csrfmiddlewaretoken={{ csrf_token }}&amp;q={{ query }}&amp;page={{ page_obj.previous_page_number }}" aria-label="Previous" {% endif %}><span aria-hidden="true">&laquo;</span></a>
41+
<a {% if page_obj.has_previous %}href="?q={{ query }}&amp;page={{ page_obj.previous_page_number }}" aria-label="Previous" {% endif %}><span aria-hidden="true">&laquo;</span></a>
4042
</li>
41-
<li><a href="?csrfmiddlewaretoken={{ csrf_token }}&amp;q={{ query }}&amp;page=1">First</a></li>
43+
<li><a href="?q={{ query }}&amp;page=1">First</a></li>
4244
{% for linkpage in page_range %}
4345
{% ifequal linkpage page_obj.number %}
4446
<li class="active">
4547
<a>{{ page_obj.number }}<span class="sr-only">(current)</span></a>
4648
</li>
4749
{% else %}
48-
<li><a href="?csrfmiddlewaretoken={{ csrf_token }}&amp;q={{ query }}&amp;page={{ linkpage }}">{{ linkpage }}</a></li>
50+
<li><a href="?q={{ query }}&amp;page={{ linkpage }}">{{ linkpage }}</a></li>
4951
{% endifequal %}
5052
{% endfor %}
51-
<li><a href="?csrfmiddlewaretoken={{ csrf_token }}&amp;q={{ query }}&amp;page={{ page_obj.paginator.num_pages }}">Last</a></li>
53+
<li><a href="?q={{ query }}&amp;page={{ page_obj.paginator.num_pages }}">Last</a></li>
5254
<li {% if not page_obj.has_next %}class="disabled"{% endif %}>
53-
<a {% if page_obj.has_next %}href="?csrfmiddlewaretoken={{ csrf_token }}&amp;q={{ query }}&amp;page={{ page_obj.next_page_number }}" aria-label="Next" {% endif %}><span aria-hidden="true">&raquo;</span></a>
55+
<a {% if page_obj.has_next %}href="?q={{ query }}&amp;page={{ page_obj.next_page_number }}" aria-label="Next" {% endif %}><span aria-hidden="true">&raquo;</span></a>
5456
</li>
5557
</ul>
5658
{% else %}

blog/templates/includes/sidebar.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ <h4>Recent Posts</h4>
4444
</div>
4545

4646
<div class="sidebar-module sidebar-module-inset">
47-
<h4>All Tags</h4>
47+
<h4>Entire Tags</h4>
4848
{% populartags as populartags_list %}
4949
{% for tag in populartags_list %}
50-
<a class="btn btn-sm btn-default cst__radius cst__tags" href="{% url 'tag_posts_page' slug=tag.tag.slug %}">
51-
{{ tag.tag.title }} <span class="badge">{{ tag.total }}</span>
50+
<a class="btn btn-sm btn-block btn-default cst__radius cst__tags" href="{% url 'tag_posts_page' slug=tag.tag.slug %}">
51+
{{ tag.tag.title }} <span class="badge pull-right">{{ tag.total }}</span>
5252
</a>
5353
{% empty %}
5454
<p>No tags yet!</p>

blog/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717

1818
def handler400(request):
1919
response = render_to_response('error_page.html', {'title': '400 Bad Request', 'message': '400'},
20-
context_instance=RequestContext(request, {'message': '400'}))
20+
context_instance=RequestContext(request))
2121
response.status_code = 400
2222
return response
2323

2424

2525
def handler403(request):
2626
response = render_to_response('error_page.html', {'title': '403 Permission Denied', 'message': '403'},
27-
context_instance=RequestContext(request, {'message': '403'}))
27+
context_instance=RequestContext(request))
2828
response.status_code = 403
2929
return response
3030

@@ -38,7 +38,7 @@ def handler404(request):
3838

3939
def handler500(request):
4040
response = render_to_response('error_page.html', {'title': '500 Server Error', 'message': '500'},
41-
context_instance=RequestContext(request, {'message': '500'}))
41+
context_instance=RequestContext(request))
4242
response.status_code = 500
4343
return response
4444

@@ -94,7 +94,7 @@ def get_context_data(self, **kwargs):
9494
context_data = super(DetailPostView, self).get_context_data(**kwargs)
9595
related_posts = Post.objects.filter(
9696
tags__in=list(self.object.tags.all())
97-
).exclude(id=self.object.id)
97+
).exclude(id=self.object.id).distinct()
9898
context_data['related_posts'] = related_posts[:5] # limit for post
9999
context_data['get_client_ip'] = self.get_client_ip()
100100
context_data['visitor_counter'] = self.visitorCounter()

media/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
covers/*

static/assets/css/blog.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ h6, .h6 {
7878
* Blog name and description
7979
*/
8080

81-
.blog-header {
81+
/*.blog-header {
8282
padding-top: 20px;
8383
padding-bottom: 20px;
84-
}
84+
}*/
8585
.blog-title {
8686
margin-top: 30px;
8787
margin-bottom: 0;

static/assets/css/style.css

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700,300);
1+
@import 'https://fonts.googleapis.com/css?family=Raleway';
22
body {
3-
font-size: 12px;
4-
font-family: 'Open Sans', sans-serif;
3+
font-size: 13px;
4+
font-family: 'Raleway', sans-serif;
55
}
66
a {
77
-webkit-transition: color .15s cubic-bezier(.33,.66,.66,1);
@@ -27,8 +27,10 @@ img.cover-post {
2727
}
2828
.message__info {
2929
background-color: #F5F5F5;
30-
padding: 0 5px;
30+
padding: 10px;
3131
border: 1px solid #EFECEC;
32+
margin-bottom: 2em;
33+
text-align: center;
3234
}
3335
.btn {
3436
border: none;
@@ -60,14 +62,15 @@ img.cover-post {
6062
}
6163
.cst__tags {
6264
margin-bottom: .5em;
65+
text-align: left;
6366
}
6467
.cst__cover__posts {
6568
margin-bottom: 1em;
6669
max-height: 200px;
6770
overflow: hidden;
6871
}
6972
.main__container {
70-
margin-top: 6em
73+
margin-top: 8em;
7174
}
7275
.sitemap ul li {
7376
background: #FAFAFA;
@@ -77,6 +80,12 @@ img.cover-post {
7780
padding-left: 5px;
7881
list-style: decimal;
7982
}
83+
.post__info {
84+
color: #999;
85+
}
86+
.author__avatar {
87+
border-radius: 50%
88+
}
8089
.sitemap ul li:nth-child(odd) {
8190
background: #FFF;
8291
}

static/assets/images/avatar.jpg

8.37 KB
Loading

0 commit comments

Comments
 (0)