Skip to content

Commit 891f1e3

Browse files
authored
Merge pull request #17 from SADiLaR/feature/institutions_view
Feature/institutions view
2 parents 117c794 + 5d61dd2 commit 891f1e3

File tree

9 files changed

+241
-46
lines changed

9 files changed

+241
-46
lines changed

app/app/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
]
4444
if DEBUG:
4545
INSTALLED_APPS += [
46-
"django_extensions",
46+
"django_extensions",
4747
]
4848

4949
AUTH_USER_MODEL = "users.CustomUser"

app/app/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@
2727
path("admin/", admin.site.urls),
2828
path("_health/", views.health, name="health"),
2929
path("", views.home, name="home"),
30+
path("institutions/", views.institutions, name="institutions"),
3031
]

app/app/views.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from django.http import HttpResponse
22
from django.shortcuts import render
33

4+
from general.models import Institution
5+
46

57
def health(request):
68
"""A very basic (minimal dependency) health endpoint."""
@@ -11,6 +13,15 @@ def health(request):
1113

1214
def home(request):
1315
template = "app/home.html"
14-
context = {}
16+
context = {"home_page": "active"}
17+
18+
return render(request, template_name=template, context=context)
19+
20+
21+
def institutions(request):
22+
template = "app/institutions.html"
23+
24+
institutions = Institution.objects.all()
25+
context = {"institutions_page": "active", "institutions": institutions}
1526

1627
return render(request, template_name=template, context=context)

app/general/tests/test_views.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33

44
class TestViews(TestCase):
5-
65
def test_health(self):
76
response = Client().get("/_health/")
87
self.assertIn(b"OK", response.content)

app/static/css/styles.css

Lines changed: 156 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
--text-color: #000000;
99
}
1010

11+
12+
/*General*/
1113
body {
1214
margin: 0;
1315
padding: 0;
@@ -79,15 +81,6 @@ body {
7981
color: var(--primary);
8082
}
8183

82-
.card{
83-
border-color: var(--primary-red);
84-
margin-right: 50px;
85-
}
86-
87-
.fa-search{
88-
margin-right: 30px;
89-
}
90-
9184
.footer {
9285
color: white;
9386
background: var(--primary);
@@ -104,16 +97,162 @@ body {
10497
margin-bottom: 10px;
10598
}
10699

107-
.input-group{
108-
margin: 10px 10px 10px 10px;
100+
.main-logo {
101+
width: 140px;
102+
height: 75px;
103+
margin: 20px 10px 10px 10px;
109104
}
110105

111-
.form-group{
112-
margin-bottom: 10px;
106+
.page-link {
107+
background-color: var(--primary) !important;
108+
color: var(--primary-fg) !important;
113109
}
114110

115-
.main-logo {
116-
width: 140px;
117-
height: 75px;
118-
margin: 10px 10px 10px 10px;
111+
.page-link:hover{
112+
background-color: var(--body-quiet-color) !important;
113+
color: var(--primary-fg) !important;
114+
}
115+
116+
.row {
117+
margin: 10px;
118+
padding: 10px;
119+
}
120+
121+
/*Home page*/
122+
.content-card {
123+
border-color: var(--primary-red);
124+
margin: 0 10px 0 10px;
125+
width: 100%;
126+
}
127+
128+
/*Institutions page*/
129+
.uni-card {
130+
border-color: var(--primary-red);
131+
margin: 0 10px 0 10px;
132+
}
133+
134+
.uni-logo {
135+
width: 50px;
136+
height: 50px;
137+
margin: 10px 0 0 0;
138+
}
139+
140+
/*bootstrap icons*/
141+
.bi {
142+
font-size: 50px;
143+
}
144+
145+
/* Extra small devices (phones, 600px and down) */
146+
@media only screen and (max-width: 600px) {
147+
/*General*/
148+
.header-container {
149+
width: 100%;
150+
}
151+
.section {
152+
padding-right: 30px;
153+
}
154+
155+
/*Institutions page*/
156+
.uni-card {
157+
width: 100%;
158+
font-size: smaller;
159+
}
160+
.all-cards {
161+
width: 98%;
162+
padding-right: 30px;
163+
}
164+
.col-sm-6 {
165+
width: 50%;
166+
}
167+
168+
/*Home page*/
169+
.content-card {
170+
font-size: smaller;
171+
padding-right: 20px;
172+
margin-right: 10px;
173+
}
174+
}
175+
176+
/*small devices (tablets, 600px and up) */
177+
@media screen and (min-width: 600px) {
178+
/*General*/
179+
.header-container {
180+
width: 100%;
181+
}
182+
.section {
183+
padding-right: 20px;
184+
}
185+
186+
/*Institutions page*/
187+
.all-cards {
188+
width: 100%;
189+
padding-right: 10px;
190+
}
191+
.col-sm-6 {
192+
width: 50%;
193+
}
194+
.uni-card {
195+
width: 98%;
196+
height: 200px;
197+
padding-right: 20px;
198+
}
199+
200+
/*Home page*/
201+
.content-card {
202+
font-size: smaller;
203+
}
204+
}
205+
206+
/*Medium screens (tablets, between 768px and 1001px)*/
207+
@media screen and (min-width: 768px) and (max-width: 1001px) {
208+
/*General*/
209+
.header-container {
210+
width: 100%;
211+
}
212+
.section {
213+
padding-right: 20px;
214+
}
215+
216+
/*Institutions page*/
217+
.uni-card {
218+
width: 98%;
219+
font-size: medium;
220+
padding-right: 20px;
221+
height: 200px;
222+
}
223+
.all-cards {
224+
width: 100%;
225+
padding-right: 10px;
226+
}
227+
.col-sm-6 {
228+
width: 50%;
229+
}
230+
}
231+
232+
/*Larger screens (desktops, 1001px and up)*/
233+
@media screen and (min-width: 1001px){
234+
/*General*/
235+
.section {
236+
padding-right: 20px;
237+
}
238+
239+
/*Institutions page*/
240+
.institution-card{
241+
overflow: hidden;
242+
}
243+
.all-cards {
244+
width: 48%;
245+
margin: 10px 10px 10px 10px;
246+
float: left;
247+
padding-right: 10px;
248+
}
249+
.col-sm-6 {
250+
width: 50%;
251+
}
252+
.uni-card {
253+
margin: 10px;
254+
width: 100%;
255+
height: 200px;
256+
font-size: small;
257+
}
119258
}

app/static/img/UP_logo.png

11.7 KB
Loading

app/templates/app/home.html

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<div class="body">
77
<div class="section mt-3 mb-3">
8-
<div class="card">
8+
<div class="card content-card">
99
<div class="card-body">
1010
<h5 class="card-title">About SADiLaR</h5>
1111
<p class="card-text">
@@ -19,26 +19,31 @@ <h5 class="card-title">About SADiLaR</h5>
1919
</div>
2020

2121
<div class="section mt-3 mb-3">
22-
<div class="card">
22+
<div class="card content-card">
2323
<div class="card-body d-flex justify-content-between align-items-end">
2424
<div class="card-items">
2525
<h5 class="card-title">Search</h5>
26-
<button type="submit" class="btn btn-primary">Search a term</button>
26+
<p class="card-text">
27+
Terminology Search
28+
</p>
29+
<p class="card-text">
30+
Click here to search a term
31+
</p>
32+
<button type="submit" class="btn btn-primary">Search a term</button>
2733
</div>
2834
</div>
2935
</div>
3036
</div>
3137

32-
3338
<div class="section mt-3 mb-3">
34-
<div class="card">
39+
<div class="card content-card">
3540
<div class="card-body">
36-
<h5 class="card-title">Register to site</h5>
41+
<h5 class="card-title">Institutions</h5>
3742
<p class="card-text">
38-
Complete Registration
43+
View Institutions
3944
</p>
40-
<a href="#" class="btn btn-primary">
41-
Start
45+
<a href="{% url 'institutions' %}" class="btn btn-primary">
46+
View
4247
</a>
4348
</div>
4449
</div>

app/templates/app/institutions.html

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{% extends "base.html" %}
2+
{% load static %}
3+
4+
{% block content %}
5+
6+
<div class="institution-card w-100">
7+
{% for institution in institutions %}
8+
<div class="all-cards section">
9+
<div class="card uni-card">
10+
<div class="row">
11+
<div class="col-sm-6">
12+
<h5 class="card-title">{{ institution.name }}</h5>
13+
<p class="card-text">
14+
{{ institution.abbreviation }}
15+
</p>
16+
<p class="card-text">
17+
4 applicable projects
18+
</p>
19+
<br>
20+
</div>
21+
<div class="col-sm-6">
22+
<p class="card-text">Profile completion:</p>
23+
<div class="profile-icons">
24+
<i class="bi-star-fill"></i>
25+
<i class="bi-star-fill"></i>
26+
<i class="bi-star-fill"></i>
27+
<i class="bi-star"></i>
28+
<i class="bi-star"></i>
29+
</div>
30+
<br>
31+
<div class="card-logo">
32+
<img src=" {% static 'img/UP_logo.png' %}" class="uni-logo" alt="university logo">
33+
</div>
34+
</div>
35+
</div>
36+
</div>
37+
</div>
38+
{% endfor %}
39+
</div>
40+
41+
{% endblock content %}

app/templates/base.html

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
<meta name="viewport" content="width=device-width, initial-scale=1">
1111

1212
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
13+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css">
1314
<link rel="stylesheet" href="{% static 'css/styles.css' %}">
14-
1515
</head>
16-
<body>
16+
17+
<body class="d-flex flex-column min-vh-100">
1718
<!--header-->
1819
{% block app_header %}
1920
<header>
@@ -24,17 +25,17 @@
2425
<div class="nav-menu">
2526
<ul class="nav nav-pills">
2627
<li class="nav-item">
27-
<a class="nav-link active" aria-current="page" href="#">Home</a>
28-
</li>
29-
<li class="nav-item">
30-
<a class="nav-link" href="#">Search</a>
31-
</li>
32-
<li class="nav-item">
33-
<a class="nav-link" href="#">Register</a>
34-
</li>
35-
<li class="nav-item">
36-
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Admin</a>
37-
</li>
28+
<a class="nav-link {{ home_page }}" aria-current="page" href="{% url 'home' %}">Home</a>
29+
</li>
30+
<li class="nav-item">
31+
<a class="nav-link" href="#">Search</a>
32+
</li>
33+
<li class="nav-item">
34+
<a class="nav-link {{ institutions_page }}" href="{% url 'institutions' %}">Institutions</a>
35+
</li>
36+
<li class="nav-item">
37+
<a class="nav-link" href="{% url 'admin:index' %}">Admin</a>
38+
</li>
3839
</ul>
3940
</div>
4041
</div>
@@ -47,9 +48,9 @@
4748

4849
{% endblock content %}
4950
</div>
50-
51+
<br>
5152
<!-- app footer -->
52-
<footer class="footer my-5">
53+
<footer class="footer my-5 mt-auto">
5354
<div class="text-center p-3">
5455
Developed by <a class="text-white" href="https://sadilar.org">SADiLaR</a>
5556
</div>
@@ -58,5 +59,3 @@
5859

5960
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
6061
</body>
61-
62-

0 commit comments

Comments
 (0)