Skip to content

Commit 1f99ed3

Browse files
committed
Update templates
Rearreanged some templates. home.html now inherits from base.html. search_results.html inherits from home.html. Namespaced the 'app' app with the name 'app'. Named the URL patterns and replaced absolute links with url template tag. Renamed tagslink.html to taglinks.html. Named the 'api' app's homepage as 'api-home' and used that name with the url template tag in base.html.
1 parent 9065f70 commit 1f99ed3

13 files changed

Lines changed: 75 additions & 186 deletions

File tree

api/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from . import views
33

44
urlpatterns = [
5-
path('', views.index),
5+
path('', views.index, name='api-home'),
66
path('tutorials/<str:tags>/', views.tutorial_Tags),
77
path('tutorials/<str:tags>/<str:category>/', views.tutorial_Tags_Category),
88
path('tutorials/', views.tutorials),

app/templates/about.html

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
{% extends 'base.html'%}
22
{% load staticfiles %}
3-
43
{% block content %}
5-
64
<section class="hero is-medium is-primary is-bold">
7-
<div class="hero-body">
8-
<h1 class="title">About</h1>
9-
<div class="container">
10-
<center>
11-
<img src="{% static 'app/computer2.svg' %}" height="170" width="170"><br><br>
12-
</center>
13-
<ul class="list title is-5">
14-
<li class="list-item">
15-
tutorialdb is a small scale search engine for programming/dev tutorials, it is meant to help anyone who is getting started to learn a new technology.
16-
</li>
17-
<li class="list-item">
18-
The sole purpose of tutorialdb is to help people get to resoures which might help them learn new things for e.g sometimes there are tutorials on personal blogs which do not get indexed in google easily.
19-
</li>
20-
<li class="list-item">
21-
All the content (tutorials) is owned by the respective authors/sites.<br>
22-
tutorialdb maintains its own database saving the links to tutorials and some meta info.
23-
</li>
24-
</ul>
25-
</div>
26-
</div>
5+
<div class="hero-body">
6+
<h1 class="title">About</h1>
7+
<div class="container">
8+
<center>
9+
<img src="{% static 'app/computer2.svg' %}" height="170" width="170"><br><br>
10+
</center>
11+
<ul class="list title is-5">
12+
<li class="list-item">
13+
tutorialdb is a small scale search engine for programming/dev tutorials, it is meant to help anyone who is getting started to learn a new technology.
14+
</li>
15+
<li class="list-item">
16+
The sole purpose of tutorialdb is to help people get to resoures which might help them learn new things for e.g sometimes there are tutorials on personal blogs which do not get indexed in google easily.
17+
</li>
18+
<li class="list-item">
19+
All the content (tutorials) is owned by the respective authors/sites.<br>
20+
tutorialdb maintains its own database saving the links to tutorials and some meta info.
21+
</li>
22+
</ul>
23+
</div>
24+
</div>
2725
</section>
2826
{% endblock %}

app/templates/base.html

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@
1919
<meta property="twitter:title" content="tutorialdb" />
2020
<meta property="og:image" content="{% static 'app/tutorialdb.png' %}"/>
2121
<meta name="twitter:image" content="{% static 'app/tutorialdb.png' %}">
22-
2322
<link rel="shortcut icon" type="image/png" href="{% static 'app/tutorialdb.png' %}"/>
2423
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.min.css">
24+
<link rel="stylesheet" type="text/css" href="{% static 'app/css/customCSS.css' %}">
25+
<link rel="manifest" href="{% static 'app/manifest.json' %}"/>
2526
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
2627
<script defer src="{% static 'app/js/burger.js' %}"></script>
27-
<link rel="stylesheet" type="text/css" href="{% static 'app/css/customCSS.css' %}">
2828
</head>
2929
<body>
3030
<nav class="navbar is-active is-dark" role="navigation" aria-label="main navigation">
3131
<div class="navbar-brand">
32-
<a class="navbar-item" href="/">
32+
<a class="navbar-item" href="{% url 'app:home' %}">
3333
<img src="{% static 'app/tutorialdb.png' %}" width="112" height="28">
3434
</a>
3535
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample" name="customBurger">
@@ -40,35 +40,34 @@
4040
</div>
4141
<div id="navbarBasicExample" class="navbar-menu is-dark" >
4242
<div class="navbar-start is-dark">
43-
<a class="navbar-item" href="/">
43+
<a class="navbar-item" href="{% url 'app:home' %}">
4444
Home
4545
</a>
46-
<a class="navbar-item" href="/api">
46+
<a class="navbar-item" href="{% url 'api-home' %}">
4747
API
4848
</a>
49-
<a class="navbar-item" href="/latest">
49+
<a class="navbar-item" href="{% url 'app:latest' %}">
5050
Latest
5151
</a>
52-
<a class="navbar-item" href="/tags">
52+
<a class="navbar-item" href="{% url 'app:tags' %}">
5353
Tags
5454
</a>
55-
<a class="navbar-item" href="/about">
55+
<a class="navbar-item" href="{% url 'app:about' %}">
5656
About
5757
</a>
5858
</div>
5959
<div class="navbar-end">
6060
<div class="navbar-item">
6161
<div class="buttons">
62-
<a class="button is-primary" href="/contribute">
62+
<a class="button is-primary" href="{% url 'app:contribute' %}">
6363
<strong>Contribute</strong>
6464
</a>
6565
</div>
6666
</div>
6767
</div>
6868
</div>
6969
</nav>
70-
{% block content %}
71-
{% endblock content %}
70+
{% block content %}{% endblock content %}
7271
<footer class="footer">
7372
<div class="content has-text-centered">
7473
<p>

app/templates/contribute.html

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{% extends 'base.html' %}
22
{% load staticfiles %}
33
{% block content %}
4-
54
<section class="hero is-medium is-primary is-bold">
65
<div class="hero-body">
76
<div class="container">
@@ -14,7 +13,6 @@ <h1 class="title" align="center">
1413
</div>
1514
</div>
1615
</section>
17-
1816
<section class="hero is-medium is-dark is-bold">
1917
<div class="hero-body">
2018
<div class="container">
@@ -32,15 +30,14 @@ <h1 class="title" align="center">Or just,<br>
3230
<h2 class="title is-3"><i>{{ error }}</i></h2>
3331
{% endif %}
3432
<div class="container">
35-
<form action="/thankyou/" method="post">
33+
<form action="{% url 'app:thankyou' %}" method="post">
3634
{% csrf_token %}
3735
<div class="field">
3836
<label class="label">Link</label>
3937
<div class="control">
4038
<input class="input is-rounded" type="url" name="tlink" placeholder="paste tutorial link here" autofocus>
4139
</div>
4240
</div>
43-
4441
<div class="field">
4542
<label class="label">Type</label>
4643
<div class="control">
@@ -56,7 +53,6 @@ <h2 class="title is-3"><i>{{ error }}</i></h2>
5653
</div>
5754
</div>
5855
</div>
59-
6056
<div class="field is-grouped">
6157
<div class="control">
6258
<button class="button is-link is-rounded" type="submit">Submit</button>
@@ -66,6 +62,4 @@ <h2 class="title is-3"><i>{{ error }}</i></h2>
6662
</div>
6763
</div>
6864
</section>
69-
70-
{% endblock content %}
71-
65+
{% endblock content %}

app/templates/home.html

Lines changed: 7 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,7 @@
1+
{% extends 'base.html' %}
12
{% load staticfiles %}
2-
<!DOCTYPE html>
3-
<html>
4-
<head>
5-
<title>tutorialdb</title>
6-
<meta charset="utf-8" />
7-
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
8-
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
9-
<link rel="shortcut icon" type="image/png" href="{% static 'app/tutorialdb.png' %}"/>
10-
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0'>
11-
<meta name="keywords" content="tutorials, programming, developers">
12-
<meta name="description" content="A search engine for programming/dev tutorials">
13-
<meta property="og:description" content="A search engine for programming/dev tutorials"/>
14-
<meta name="twitter:card" content="summary_large_image">
15-
<meta name="twitter:creator" content="@bhupeshimself">
16-
<meta name="twitter:title" content="tutorialdb">
17-
<meta name="twitter:description" content="A search engine for programming/dev tutorials">
18-
<meta name="author" content="Bhupesh Varshney" />
19-
<meta property="og:title" content="tutorialdb" />
20-
<meta property="twitter:title" content="tutorialdb" />
21-
<meta property="og:image" content="{% static 'app/tutorialdb.png' %}"/>
22-
<meta name="twitter:image" content="{% static 'app/tutorialdb.png' %}">
23-
24-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.min.css">
25-
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
26-
<script defer src="{% static 'app/js/burger.js' %}"></script>
27-
<link rel="stylesheet" type="text/css" href="{% static 'app/css/customCSS.css' %}">
28-
<link rel="manifest" href="{% static 'app/manifest.json' %}"/>
29-
</head>
30-
<body>
31-
<nav class="navbar is-active is-dark" role="navigation" aria-label="main navigation">
32-
<div class="navbar-brand">
33-
<a class="navbar-item" href="/">
34-
<img src="{% static 'app/tutorialdb.png' %}" width="112" height="28">
35-
</a>
36-
<a role="button" class="navbar-burger burger is-dark" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample" name="customBurger">
37-
<span aria-hidden="true"></span>
38-
<span aria-hidden="true"></span>
39-
<span aria-hidden="true"></span>
40-
</a>
41-
</div>
42-
<div id="navbarBasicExample" class="navbar-menu is-dark" >
43-
<div class="navbar-start is-dark">
44-
<a class="navbar-item" href="/">
45-
Home
46-
</a>
47-
<a class="navbar-item" href="/api">
48-
API
49-
</a>
50-
<a class="navbar-item" href="/latest">
51-
Latest
52-
</a>
53-
<a class="navbar-item" href="/tags">
54-
Tags
55-
</a>
56-
<a class="navbar-item" href="/about">
57-
About
58-
</a>
59-
</div>
60-
<div class="navbar-end">
61-
<div class="navbar-item">
62-
<div class="buttons">
63-
<a class="button is-primary" href="/contribute">
64-
<strong>Contribute</strong>
65-
</a>
66-
</div>
67-
</div>
68-
</div>
69-
</div>
70-
</nav>
71-
<section class="hero is-medium is-dark is-bold">
3+
{% block content %}
4+
<section class="hero is-medium is-dark is-bold">
725
<div class="hero-body" style="background-color: #04243B">
736
<center>
747
<div class="container">
@@ -97,7 +30,7 @@ <h1 class="title" align="center">Search Tutorials</h1>
9730
<img src="{% static 'app/search.png' %}" height="100" width="100">
9831
</center>
9932
<br>
100-
<form action="{% url 'search_results' %}" method="get">
33+
<form action="{% url 'app:search-results' %}" method="get">
10134
<div class="field">
10235
<div class="control has-icons-left">
10336
<input class="input is-rounded" name="q" type="text" placeholder="to do app in ..">
@@ -130,32 +63,6 @@ <h1 class="title" align="center">Search Tutorials</h1>
13063
</form>
13164
</div>
13265
</section>
133-
{% block content %}
134-
{% endblock %}
135-
<footer class="footer">
136-
<div class="content has-text-centered">
137-
<p>
138-
<strong>tutorialdb</strong> built with 💓 and 🎶 by <a href="https://twitter.com/bhupeshimself">Bhupesh Varshney</a>.<br>
139-
Illustrations by <a href="https://lukaszadam.com/illustrations">lukaszadam</a>
140-
</p>
141-
<center>
142-
<a href="https://www.patreon.com/bePatron?u=18082750">
143-
<img src="{% static 'app/patreon.png' %}" height="140" width="140">
144-
</a>
145-
</center>
146-
<br>
147-
<a href="https://twitter.com/intent/tweet?url=https://tutorialdb.pythonanywhere.com&text=Hey Guys 😃 ! Try tutorialdb, it's a search engine for programming/dev tutorials."><img src="{% static 'app/twitter.svg' %}" height="35" width="35"></a>
148-
<a href="https://github.com/Bhupesh-V/tutorialdb"><img src="{% static 'app/github.svg' %}" height="35" width="35"></a>
149-
<a href="https://www.facebook.com/sharer/sharer.php?u=https://tutorialdb.pythonanywhere.com"><img src="{% static 'app/fb.svg' %}" height="35" width="35"></a>
150-
<a href="https://www.linkedin.com/shareArticle?mini=true&url=https://tutorialdb.pythonanywhere.com"><img src="{% static 'app/linkedin.svg' %}" height="35" width="35"></a>
151-
</div>
152-
</footer>
153-
154-
<script async src="{% static 'app/js/custom.js' %}"></script>
155-
<script type="text/javascript">
156-
window.onload = function() {
157-
registerSW();
158-
};
159-
</script>
160-
</body>
161-
</html>
66+
{% block results %}
67+
{% endblock results %}
68+
{% endblock content %}

app/templates/latest.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{% extends 'base.html'%}
22
{% load staticfiles %}
3-
43
{% block content %}
5-
64
{% if results %}
75
<div class="section">
86
<h3 class="title">Latest in tutorialdb </h3>
@@ -14,7 +12,7 @@ <h3 class="title">Latest in tutorialdb </h3>
1412
<div class="tile">
1513
{% for tag in tutorial.tags.all %}
1614
<span class="tag">
17-
<b><a href="/tags/tag={{ tag }}" > 📌 {{ tag }}</a></b>
15+
<b><a href="{% url 'app:tag-links' tag %}" > 📌 {{ tag }}</a></b>
1816
</span>&nbsp;
1917
{% endfor %}
2018
<button class="fa fa-share-alt is-pulled-right" id="shareIcon"

app/templates/search_results.html

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
{% extends 'home.html' %}
22
{% load staticfiles %}
3-
{% block content %}
4-
3+
{% block results %}
54
<div id="focus-here">
65
{% if object_list %}
76
<div class="section">
87
<h3 class="subtitle">Search Results for "{{ tquery }}"</h3>
98
<p>About {{ total }} results ({{ time }} seconds)</p><br>
109
<div class="container">
11-
1210
{% for tutorial in object_list %}
1311
<div class="box">
1412
<a href="{{ tutorial.link }}" target="_blank" id="tutorial-tag">{{ tutorial.title }}</a>
1513
<div class="tile">
1614
{% for tag in tutorial.tags.all %}
1715
<span class="tag">
18-
<b><a href="/tags/tag={{ tag }}" > 📌 {{ tag }}</a></b>
16+
<b><a href="{% url 'app:tag-links' tag %}" > 📌 {{ tag }}</a></b>
1917
</span>&nbsp;
2018
{% endfor %}
2119
<button class="fa fa-share-alt is-pulled-right" id="shareIcon"
@@ -25,7 +23,6 @@ <h3 class="subtitle">Search Results for "{{ tquery }}"</h3>
2523
{% endfor %}
2624
</div>
2725
</div>
28-
2926
<div class="section">
3027
<div class="container">
3128
{% if object_list.has_other_pages %}
@@ -53,12 +50,11 @@ <h3 class="subtitle">Search Results for "{{ tquery }}"</h3>
5350
{% endif %}
5451
</div>
5552
</div>
56-
5753
{% else %}
5854
<h2 class="subtitle notification is-primary title is-3" align="center">
5955
Ah! Sorry, No Results<br>
6056
<img src="{% static 'app/search404.svg' %}" height="160" width="160">
6157
</h2>
6258
{% endif %}
6359
</div>
64-
{% endblock content %}
60+
{% endblock results %}
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ <h2 class="title is-4">Tutorials Tagged
1515
<div class="tile">
1616
{% for tag in tutorial.tags.all %}
1717
<span class="tag">
18-
<b><a href="/tags/tag={{ tag }}" > 📌 {{ tag }}</a></b>
18+
<b><a href="{% url 'app:tag-links' tag %}" > 📌 {{ tag }}</a></b>
1919
</span>&nbsp;
2020
{% endfor %}
2121
<button class="fa fa-share-alt is-pulled-right" id="shareIcon"
@@ -27,7 +27,7 @@ <h2 class="title is-4">Tutorials Tagged
2727
<button class="button is-pulled-left" onclick="window.history.back();">❮ Go Back</button>
2828
</div>
2929
<div class="field">
30-
<a class="button is-pulled-right" href="/tags">See All Tags</a>
30+
<a class="button is-pulled-right" href="{% url 'app:tags' %}">See All Tags</a>
3131
</div>
3232
</div>
3333
</div>
@@ -37,5 +37,4 @@ <h2 class="subtitle notification is-primary title is-3" align="center">
3737
<img src="{% static 'app/search404.svg' %}" height="160" width="160">
3838
</h2>
3939
{% endif %}
40-
41-
{% endblock %}
40+
{% endblock %}

0 commit comments

Comments
 (0)