Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widgets_FEKK
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kyla Martin
widgets_FEKK
Commits
5c3b03e1
Commit
5c3b03e1
authored
May 16, 2022
by
Emmanuel Linus T. Evangelista
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'evangelista/forum' into 'master'
Evangelista/forum See merge request
!11
parents
c20478ae
12737867
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
187 additions
and
17 deletions
+187
-17
details.css
WidgetFEKK/Forum/static/Forum/details.css
+50
-0
index.css
WidgetFEKK/Forum/static/Forum/index.css
+29
-0
styles.css
WidgetFEKK/Forum/static/Forum/styles.css
+38
-0
thumbnail.jpg
WidgetFEKK/Forum/static/Forum/thumbnail.jpg
+0
-0
details.html
WidgetFEKK/Forum/templates/Forum/details.html
+37
-0
index.html
WidgetFEKK/Forum/templates/Forum/index.html
+22
-0
views.py
WidgetFEKK/Forum/views.py
+9
-17
urls.py
WidgetFEKK/WidgetFEKK/urls.py
+2
-0
No files found.
WidgetFEKK/Forum/static/Forum/details.css
0 → 100644
View file @
5c3b03e1
body
{
padding
:
64px
160px
;
}
#back
{
margin
:
0
0
32px
;
display
:
flex
;
align-items
:
center
;
}
#back
a
{
color
:
black
;
text-decoration
:
none
;
margin-left
:
8px
;
}
#back
a
:hover
{
text-decoration
:
underline
;
}
#thumbnail
{
width
:
150px
;
height
:
150px
;
object-fit
:
cover
;
object-position
:
center
;
margin
:
0
0
16px
;
}
#title
{
margin
:
0
0
16px
;
}
#subtitle
{
margin
:
0
0
32px
;
}
.body-text
{
margin
:
0
0
64px
;
width
:
80%
;
}
.replies
{
padding
:
0
;
}
.replies
>
li
{
margin
:
0
0
16px
;
width
:
60%
;
}
\ No newline at end of file
WidgetFEKK/Forum/static/Forum/index.css
0 → 100644
View file @
5c3b03e1
body
{
padding
:
64px
160px
;
}
#title
{
margin
:
0
0
64px
;
}
#subtitle
{
margin
:
0
0
16px
;
}
.posts
{
padding
:
0
;
}
.posts
>
li
{
margin
:
0
0
16px
;
width
:
80%
;
}
.posts
>
li
a
{
color
:
black
;
text-decoration
:
none
;
}
.posts
>
li
a
:hover
{
text-decoration
:
underline
;
}
\ No newline at end of file
WidgetFEKK/Forum/static/Forum/styles.css
0 → 100644
View file @
5c3b03e1
@import
url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&family=Montserrat:ital,wght@0,100;0,200;0,300;0,500;0,700;0,800;0,900;1,400;1,500&display=swap')
;
*
{
font-family
:
'Inter'
,
sans-serif
;
}
html
,
body
{
margin
:
0
;
}
h1
{
font-size
:
61.04px
;
}
h2
{
font-size
:
48.83px
;
}
h3
{
font-size
:
39.06px
;
}
h4
{
font-size
:
31.25px
;
}
h5
{
font-size
:
25.00px
;
}
h6
{
font-size
:
16.00px
;
}
:root
{
font-size
:
16.00px
;
}
\ No newline at end of file
WidgetFEKK/Forum/static/Forum/thumbnail.jpg
0 → 100644
View file @
5c3b03e1
126 KB
WidgetFEKK/Forum/templates/Forum/details.html
0 → 100644
View file @
5c3b03e1
{% extends "base.html" %}
{% load static %}
{% block styles %}
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'Forum/styles.css' %}"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'Forum/details.css' %}"
>
{% endblock %}
{% block title %}
{{ post.post_title }}
{% endblock %}
{% block content %}
<article>
<div
id=
"back"
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"16"
height=
"16"
fill=
"currentColor"
viewBox=
"0 0 16 16"
>
<path
fill-rule=
"evenodd"
d=
"M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"
stroke=
"black"
/>
</svg>
<a
href=
"/forum"
>
Back to all posts
</a>
</div>
<img
id=
"thumbnail"
src=
"{% static 'Forum/thumbnail.jpg' %}"
alt=
"placeholder image"
/>
<h1
id=
"title"
>
{{ post.post_title }}
</h1>
<h4
id=
"subtitle"
>
by {{ post.author.first_name }} {{ post.author.last_name }}, {{ post.pub_date|date:"d/m/Y" }}
</h4>
<p
class=
"body-text"
>
{{ post.post_body }}
</p>
<ul
class=
"replies"
>
{% for reply in replies_sorted %}
<li><strong>
{{ reply.author.first_name }} {{ reply.author.last_name }}, {{ reply.pub_date|date:"d/m/Y" }}:
</strong>
{{ reply.reply_body }}
</li>
{% endfor %}
</ul>
</article>
{% endblock %}
\ No newline at end of file
WidgetFEKK/Forum/templates/Forum/index.html
0 → 100644
View file @
5c3b03e1
{% extends "base.html" %}
{% load static %}
{% block styles %}
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'Forum/styles.css' %}"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'Forum/index.css' %}"
>
{% endblock %}
{% block title %}Widget's Forum{% endblock %}
{% block content %}
<main>
<h1
id=
"title"
>
Welcome to Widget's Forum!
</h1>
<h5
id=
"subtitle"
>
Forum posts:
</h5>
<ul
class=
"posts"
>
{% for post in posts_sorted %}
<li><a
href=
"/posts/{{ post.pk }}/details"
><strong>
{{ post.post_title }}
</strong>
by
<strong>
{{ post.author.first_name }} {{ post.author.last_name }}
</strong>
dated
<strong>
{{ post.pub_date|date:"d/m/Y" }}
</strong></a></li>
{% endfor %}
</ul>
</main>
{% endblock %}
\ No newline at end of file
WidgetFEKK/Forum/views.py
View file @
5c3b03e1
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
,
Http404
from
django.shortcuts
import
render
from
.models
import
Post
,
Reply
def
get_readable_time
(
timestamp
):
return
timestamp
.
strftime
(
"
%
m/
%
d/
%
Y"
)
def
index
(
request
):
out
=
"FORUM POSTS: <br />"
return
render
(
request
,
'Forum/index.html'
,
{
'posts_sorted'
:
Post
.
objects
.
order_by
(
'-pub_date'
)})
posts
=
Post
.
objects
.
all
()
for
post
in
posts
:
out
+=
f
'{post.post_title} by {post.author.first_name} {post.author.last_name} dated {get_readable_time(post.pub_date)}: <br />'
out
+=
f
'{post.post_body} <br />'
post_replies
=
post
.
reply_set
.
all
()
for
reply
in
post_replies
:
out
+=
f
'Reply by {reply.author.first_name} {reply.author.last_name} dated {get_readable_time(reply.pub_date)}: <br />'
out
+=
f
'{reply.reply_body} <br />'
out
+=
'<br />'
return
HttpResponse
(
out
)
\ No newline at end of file
def
details
(
request
,
post_id
):
try
:
post
=
Post
.
objects
.
get
(
pk
=
post_id
)
except
Post
.
DoesNotExist
:
raise
Http404
(
'Post does not exist'
)
return
render
(
request
,
'Forum/details.html'
,
{
'post'
:
post
,
'replies_sorted'
:
post
.
reply_set
.
order_by
(
'-pub_date'
)})
\ No newline at end of file
WidgetFEKK/WidgetFEKK/urls.py
View file @
5c3b03e1
...
...
@@ -15,10 +15,12 @@ Including another URLconf
"""
from
django.contrib
import
admin
from
django.urls
import
path
,
include
import
Forum.views
as
Forum_views
urlpatterns
=
[
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
'forum/'
,
include
(
'Forum.urls'
,
namespace
=
'Forum'
)),
path
(
'posts/<int:post_id>/details/'
,
Forum_views
.
details
,
name
=
'post_details'
),
path
(
'homepage/'
,
include
(
'Homepage.urls'
,
namespace
=
"Homepage"
)),
path
(
'announcements/'
,
include
(
'Announcements.urls'
,
namespace
=
"Announcements"
)),
path
(
'assignments/'
,
include
(
'Assignments.urls'
,
namespace
=
"Assignments"
)),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment