Skip to content

Commit 7922fee

Browse files
anubhakushwahatapaswenipathak
authored andcommitted
Added journey page
1 parent 43c8b86 commit 7922fee

File tree

8 files changed

+142
-3
lines changed

8 files changed

+142
-3
lines changed

oshc/main/admin.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33

44
from django.contrib import admin
55

6-
from main.models import chatSession, Contest
6+
from main.models import chatSession, Contest, Journey
77

88

99
class chatSessionAdmin(admin.ModelAdmin):
1010
list_display = ('title', 'start_date')
1111

1212

13+
class journeyAdmin(admin.ModelAdmin):
14+
list_display = ('title', 'start_date')
15+
16+
1317
class contestAdmin(admin.ModelAdmin):
1418
list_display = ('name', 'link', 'description', 'start_date', 'end_date',
1519
'approved')
@@ -26,4 +30,5 @@ def approve_contest(self, request, queryset):
2630

2731

2832
admin.site.register(chatSession, chatSessionAdmin)
33+
admin.site.register(Journey, journeyAdmin)
2934
admin.site.register(Contest, contestAdmin)

oshc/main/migrations/0002_journey.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.6 on 2017-12-17 21:29
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('main', '0001_initial'),
12+
]
13+
14+
operations = [
15+
migrations.CreateModel(
16+
name='Journey',
17+
fields=[
18+
('id', models.AutoField(auto_created=True,
19+
primary_key=True, serialize=False, verbose_name='ID')),
20+
('title', models.CharField(help_text='Journey title',
21+
max_length=128)),
22+
('description', models.TextField(help_text='Session details',
23+
max_length=512)),
24+
('start_date', models.DateTimeField()),
25+
],
26+
),
27+
]

oshc/main/models.py

+8
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,11 @@ class Contest(models.Model):
2929

3030
def __str__(self):
3131
return self.name
32+
33+
34+
class Journey(models.Model):
35+
title = models.CharField(max_length=128, help_text="Journey title")
36+
start_date = models.DateField(null=True)
37+
38+
def __str__(self):
39+
return self.title

oshc/main/static/main/css/app.css

+69
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,72 @@ footer .container {
420420
.subtitle {
421421
margin: 0 !important;
422422
}
423+
424+
/* TIMELINE CHANGES */
425+
426+
body {
427+
background: #d4e5f7;
428+
}
429+
430+
.timeline ul {
431+
background: #d4e5f7;
432+
padding: 50px 0;
433+
}
434+
435+
.timeline ul li {
436+
list-style-type: none;
437+
position: relative;
438+
width: 6px;
439+
margin: 0 auto;
440+
padding-top: 50px;
441+
background: #ffffff;
442+
}
443+
444+
.timeline ul li::after {
445+
content: '';
446+
position: absolute;
447+
left: 50%;
448+
bottom: 0;
449+
transform: translateX(-50%);
450+
width: 30px;
451+
height: 30px;
452+
border-radius: 50%;
453+
background: inherit;
454+
}
455+
456+
.timeline ul li div {
457+
position: relative;
458+
bottom: 0;
459+
width: 400px;
460+
padding: 15px;
461+
background: #ffffff;
462+
}
463+
464+
.timeline ul li div::before {
465+
content: '';
466+
position: absolute;
467+
bottom: 7px;
468+
width: 0;
469+
height: 0;
470+
border-style: solid;
471+
}
472+
473+
.timeline ul li:nth-child(odd) div {
474+
left: 45px;
475+
}
476+
477+
.timeline ul li:nth-child(odd) div::before {
478+
left: -15px;
479+
border-width: 8px 16px 8px 0;
480+
border-color: transparent #ffffff transparent transparent;
481+
}
482+
483+
.timeline ul li:nth-child(even) div {
484+
left: -439px;
485+
}
486+
487+
.timeline ul li:nth-child(even) div::before {
488+
right: -15px;
489+
border-width: 8px 0 8px 16px;
490+
border-color: transparent transparent transparent #ffffff;
491+
}

oshc/main/templates/base.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
</ul>
3434
</li>
3535
<li><a href="https://github.com/OpenSourceHelpCommunity" target="_blank">Resources</a></li>
36-
<li><a href="{% url 'contests' %}" target="_blank">Contests</a></li>
36+
<li><a href="{% url 'contests' %}" target="_blank">Contests</a></li>
37+
<li><a href="{% url 'journey' %}" target="_blank">Journey</a></li>
3738
<li><a href="mailto:[email protected]" target="_blank">Contact</a></li>
3839
<li><a href="https://opensourcehelp.herokuapp.com/" target="_blank">Join Us!</a></li>
3940
{% if user.is_authenticated %}

oshc/main/templates/journey.html

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{% extends 'base.html' %}
2+
{% load static %}
3+
{% block content %}
4+
<section class="timeline">
5+
<body>
6+
<ul>
7+
{% if Journey %}
8+
{% for j in Journey %}
9+
<li>
10+
<div> {{j.start_date}}<br>{{j.title}} </div>
11+
</li>
12+
<!-- more list items here -->
13+
{% endfor %}
14+
{% else %}
15+
<li>
16+
<div> No journey available </div>
17+
</li>
18+
{% endif %}
19+
</ul>
20+
</body>
21+
</section>
22+
{% endblock %}

oshc/main/urls.py

+1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
url(r'^contest_new/', views.contest_new, name="contest_new"),
99
url(r'^add_contest/', views.add_contest, name="add_contest"),
1010
url(r'^submit_contest/', views.submit_contest, name="submit_contest"),
11+
url(r'^journey/', views.journey, name="journey"),
1112
]

oshc/main/views.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from django.shortcuts import render
22
from django.http import HttpResponseRedirect
3-
from main.models import chatSession, Contest
3+
from main.models import chatSession, Contest, Journey
44
from .forms import ContestForm
55

66

@@ -38,3 +38,9 @@ def add_contest(request):
3838

3939
def submit_contest(request):
4040
return render(request, 'contest_submission.html')
41+
42+
43+
def journey(request):
44+
journey_list = Journey.objects.order_by('start_date')
45+
return render(request, 'journey.html',
46+
context={'Journey': journey_list})

0 commit comments

Comments
 (0)