View progress and index css

This commit is contained in:
teras 2017-10-08 00:58:20 +03:00
parent 2e2802bf52
commit 3635ab5997
6 changed files with 92 additions and 17 deletions

View File

@ -25,9 +25,9 @@ urlpatterns = [
url(r'^login/', views.login_view),
url(r'^logout/', views.logout_view),
url(r'^register/', views.register),
url(r'^challenge/', views.challenge),
url(r'^challenge/(?P<id>[0-9]+)', views.challenge),
url(r'^challenges/', views.dashboard),
url(r'^halloffame/', views.hall_of_fame),
url(r'^profile/(?P<username>[\w-]+)', views.profile)
url(r'^profile/(?P<username>[\w.-]+)', views.profile)
] + static(settings.STATIC_URL, document_root=settings.STATICFILES_DIRS) + \
static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

View File

@ -59,7 +59,7 @@ def logout_view(request):
return HttpResponse('logged out')
def challenge(request):
def challenge(request, id):
if request.method == 'GET':
return render(request, 'challenge.html')
elif request.method == 'POST':
@ -86,7 +86,12 @@ def hall_of_fame(request):
return render(request, 'hall_of_fame.html', data)
def profile(request, username):
def profile(request, username=''):
if request.method == 'GET':
return render(request, 'profile.html')
user = User.objects.get(username=username)
challenges = UserChallenge.objects.filter(user=user)
data = {
'user': user,
'challenges': challenges
}
return render(request, 'profile.html', data)

69
static/css/index.css Normal file
View File

@ -0,0 +1,69 @@
h1, h2 {
font-family: 'Orbitron', cursive;
}
.challenges .btn-large {
background-color: #3498db;
}
.headerblock {
height: 25em;
/*background-image: url("http://robot.itcollege.ee/assets/img/sumoesp-soldered.jpg");*/
/*background-size: cover;*/
position: relative;
overflow: hidden;
z-index: 0;
}
.headerblock > div {
/*position: relative;*/
}
.headerblock .fadeimage {
position: absolute;
top:0;
left:0;
width: 100%;
height: 100%;
transition: 1s ease;
opacity: 0;
background-size: cover;
background-position: center center;
}
.fadeimage {
}
.header {
position: absolute;
width: 100%;
left:0;
bottom:0;
background-color: rgba(255,255,255,0.8)
}
.slogan {
color: #3498db;
}
footer, .map {
background-color: #34495e !important;
}
.card{
width: 800px;
margin: 0 auto;
}
.progress{
height:10px;
}
.profile{
width:300px;
}
ul {
font-size: 20px;
line-height: 38px;
}

View File

@ -7,8 +7,8 @@
<title>K-space</title>
<link href="https://fonts.googleapis.com/css?family=Orbitron" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="static/css/materialize.min.css">
<link rel="stylesheet" href="static/css/app.css">
<link rel="stylesheet" href="/static/css/materialize.min.css">
<link rel="stylesheet" href="/static/css/app.css">
</head>
<body>
@ -90,7 +90,7 @@
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/js/materialize.min.js"></script>
<script src="static/js/app.js"></script>
<script src="/static/js/app.js"></script>
</body>
</html>

View File

@ -8,7 +8,7 @@
<link href="https://fonts.googleapis.com/css?family=Orbitron" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="/static/css/materialize.min.css">
<link rel="stylesheet" href="/static/css/app.css">
<link rel="stylesheet" href="/static/css/index.css">
</head>
<body>

View File

@ -29,23 +29,24 @@
<div class="col s12 m5" style="height:600px;padding-top: 10px;">
<div>
<div class="image">
<img style="height: 450px;" src="https://image.freepik.com/free-icon/profile-image-square-of-facebook_318-37395.jpg">
<img style="height: 450px;" src="/media/{{ user.profile.icon }}">
</div>
</div>
</div>
<div class="col s12 m3 l3" >
<h2 class="center-align" style="font-weight:bold;font-size: 50px;">Username<br></h2>
<h2 class="center-align" style="font-weight:bold;font-size: 50px;">{{ user.username }}<br></h2>
<div class="card" style="width:700px;background-color: #34495e;border-radius: 5px;margin: auto 0">
<div class="card-content white-text">
<span class="card-title" style="font-weight: normal">Description</span>
<p style="font-size: 18px;">I am a very simple man. I am good at processing small bits of information.
I am convenient because I require little food to function effectively.</p><br>
<span class="card-title" style="font-weight: normal">Achievements</span>
<span class="card-title" style="font-weight: normal">Challenges</span>
<ul>
<li><a class="grey-text text-lighten-3" href="#!">Achievement 1</a></li>
<li><a class="grey-text text-lighten-3" href="#!">Achievement 2</a></li>
<li><a class="grey-text text-lighten-3" href="#!">Achievement 3</a></li>
<li><a class="grey-text text-lighten-3" href="#!">Achievement 4</a></li>
{% for challenge in challenges %}
<li><a class="grey-text text-lighten-3" href="/challenge/{{ challenge.id }}">{{ challenge.name }}</a></li>
{% empty %}
<li>User has not completed any challenges</li>
{% endfor %}
</ul>
</div>
</div>