Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
project_questboard
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Aedin Hunter A. Clay
project_questboard
Commits
24351d19
Commit
24351d19
authored
Apr 10, 2021
by
Aedin Hunter A. Clay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved design and ui/ux of website
parent
69976415
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
303 additions
and
47 deletions
+303
-47
forms.py
board/forms.py
+8
-2
0003_auto_20210410_1446.py
board/migrations/0003_auto_20210410_1446.py
+28
-0
0004_auto_20210410_1452.py
board/migrations/0004_auto_20210410_1452.py
+29
-0
models.py
board/models.py
+4
-3
views.py
board/views.py
+5
-0
board.css
static/board/board.css
+63
-0
styles.css
static/styles.css
+115
-0
base.html
templates/base.html
+3
-2
board.html
templates/board/board.html
+33
-27
edit_board.html
templates/board/edit_board.html
+13
-7
view_board.html
templates/board/view_board.html
+0
-4
homepage.html
templates/homepage/homepage.html
+2
-2
No files found.
board/forms.py
View file @
24351d19
from
django
import
forms
from
.models
import
Questboard
,
Quest
from
.models
import
Questboard
,
Quest
from
django
import
forms
class
QuestboardForm
(
forms
.
ModelForm
):
class
QuestboardForm
(
forms
.
ModelForm
):
class
Meta
:
class
Meta
:
model
=
Questboard
model
=
Questboard
fields
=
[
'name'
,
'description'
,
'required_stars'
]
fields
=
[
'name'
,
'description'
,
'required_stars'
]
widgets
=
{
'description'
:
forms
.
Textarea
(),
'required_stars'
:
forms
.
NumberInput
(
attrs
=
{
'min'
:
0
}),
}
class
QuestForm
(
forms
.
ModelForm
):
class
QuestForm
(
forms
.
ModelForm
):
class
Meta
:
class
Meta
:
model
=
Quest
model
=
Quest
fields
=
[
'board_id'
,
'name'
,
'description'
,
'stars'
,
'for_everyone'
,
'student1'
,
'student2'
,
'student3'
]
fields
=
[
'board_id'
,
'name'
,
'description'
,
'stars'
,
'for_everyone'
,
'student1'
,
'student2'
,
'student3'
]
widgets
=
{
'board_id'
:
forms
.
HiddenInput
(),
widgets
=
{
'board_id'
:
forms
.
HiddenInput
(),
'description'
:
forms
.
Textarea
(),
'stars'
:
forms
.
NumberInput
(
attrs
=
{
'min'
:
0
}),
'student1'
:
forms
.
HiddenInput
(),
'student1'
:
forms
.
HiddenInput
(),
'student2'
:
forms
.
HiddenInput
(),
'student2'
:
forms
.
HiddenInput
(),
'student3'
:
forms
.
HiddenInput
(),
'student3'
:
forms
.
HiddenInput
(),
...
@@ -36,6 +42,6 @@ class EditBoardDescForm(forms.Form):
...
@@ -36,6 +42,6 @@ class EditBoardDescForm(forms.Form):
class
EditBoardStarsForm
(
forms
.
Form
):
class
EditBoardStarsForm
(
forms
.
Form
):
board_id
=
forms
.
IntegerField
(
widget
=
forms
.
HiddenInput
())
board_id
=
forms
.
IntegerField
(
widget
=
forms
.
HiddenInput
())
required_stars
=
forms
.
IntegerField
()
required_stars
=
forms
.
IntegerField
(
widget
=
forms
.
NumberInput
(
attrs
=
{
'min'
:
0
})
)
board/migrations/0003_auto_20210410_1446.py
0 → 100644
View file @
24351d19
# Generated by Django 3.1.7 on 2021-04-10 06:46
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'board'
,
'0002_auto_20210409_1815'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'quest'
,
name
=
'board_id'
,
field
=
models
.
PositiveIntegerField
(
default
=
0
),
),
migrations
.
AlterField
(
model_name
=
'quest'
,
name
=
'stars'
,
field
=
models
.
PositiveIntegerField
(
default
=
0
),
),
migrations
.
AlterField
(
model_name
=
'questboard'
,
name
=
'required_stars'
,
field
=
models
.
PositiveIntegerField
(),
),
]
board/migrations/0004_auto_20210410_1452.py
0 → 100644
View file @
24351d19
# Generated by Django 3.1.7 on 2021-04-10 06:52
import
django.core.validators
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'board'
,
'0003_auto_20210410_1446'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'quest'
,
name
=
'board_id'
,
field
=
models
.
PositiveIntegerField
(
default
=
0
,
validators
=
[
django
.
core
.
validators
.
MinValueValidator
(
1
)]),
),
migrations
.
AlterField
(
model_name
=
'quest'
,
name
=
'stars'
,
field
=
models
.
PositiveIntegerField
(
default
=
0
,
validators
=
[
django
.
core
.
validators
.
MinValueValidator
(
0
)]),
),
migrations
.
AlterField
(
model_name
=
'questboard'
,
name
=
'required_stars'
,
field
=
models
.
PositiveIntegerField
(
validators
=
[
django
.
core
.
validators
.
MinValueValidator
(
1
)]),
),
]
board/models.py
View file @
24351d19
from
django.core.validators
import
MinValueValidator
from
django.db
import
models
from
django.db
import
models
class
Questboard
(
models
.
Model
):
class
Questboard
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
50
)
name
=
models
.
CharField
(
max_length
=
50
)
description
=
models
.
CharField
(
max_length
=
300
)
description
=
models
.
CharField
(
max_length
=
300
)
required_stars
=
models
.
IntegerField
(
)
required_stars
=
models
.
PositiveIntegerField
(
validators
=
[
MinValueValidator
(
0
)]
)
class
Quest
(
models
.
Model
):
class
Quest
(
models
.
Model
):
board_id
=
models
.
IntegerField
(
default
=
0
)
board_id
=
models
.
PositiveIntegerField
(
default
=
0
,
validators
=
[
MinValueValidator
(
0
)]
)
name
=
models
.
CharField
(
max_length
=
60
,
default
=
''
)
name
=
models
.
CharField
(
max_length
=
60
,
default
=
''
)
description
=
models
.
CharField
(
max_length
=
300
,
default
=
''
)
description
=
models
.
CharField
(
max_length
=
300
,
default
=
''
)
stars
=
models
.
IntegerField
(
default
=
0
)
stars
=
models
.
PositiveIntegerField
(
default
=
0
,
validators
=
[
MinValueValidator
(
0
)]
)
for_everyone
=
models
.
BooleanField
(
default
=
False
)
for_everyone
=
models
.
BooleanField
(
default
=
False
)
student1
=
models
.
CharField
(
max_length
=
60
,
default
=
''
,
blank
=
True
)
student1
=
models
.
CharField
(
max_length
=
60
,
default
=
''
,
blank
=
True
)
student2
=
models
.
CharField
(
max_length
=
60
,
default
=
''
,
blank
=
True
)
student2
=
models
.
CharField
(
max_length
=
60
,
default
=
''
,
blank
=
True
)
...
...
board/views.py
View file @
24351d19
from
django.shortcuts
import
redirect
,
render
from
django.shortcuts
import
redirect
,
render
from
django.http
import
HttpRequest
from
.models
import
Quest
,
Questboard
from
.models
import
Quest
,
Questboard
from
.forms
import
*
from
.forms
import
*
...
@@ -10,6 +11,7 @@ def edit_board_view(request, pk):
...
@@ -10,6 +11,7 @@ def edit_board_view(request, pk):
{
{
'questboard'
:
Questboard
.
objects
.
get
(
pk
=
pk
),
'questboard'
:
Questboard
.
objects
.
get
(
pk
=
pk
),
'quests'
:
Quest
.
objects
.
filter
(
board_id
=
pk
),
'quests'
:
Quest
.
objects
.
filter
(
board_id
=
pk
),
'share_url'
:
get_share_url
(
request
,
pk
),
'edit_board_name_form'
:
EditBoardNameForm
(
initial
=
{
'board_id'
:
pk
}),
'edit_board_name_form'
:
EditBoardNameForm
(
initial
=
{
'board_id'
:
pk
}),
'edit_board_desc_form'
:
EditBoardDescForm
(
initial
=
{
'board_id'
:
pk
}),
'edit_board_desc_form'
:
EditBoardDescForm
(
initial
=
{
'board_id'
:
pk
}),
'edit_board_stars_form'
:
EditBoardStarsForm
(
initial
=
{
'board_id'
:
pk
}),
'edit_board_stars_form'
:
EditBoardStarsForm
(
initial
=
{
'board_id'
:
pk
}),
...
@@ -25,9 +27,12 @@ def view_board_view(request, pk):
...
@@ -25,9 +27,12 @@ def view_board_view(request, pk):
{
{
'questboard'
:
Questboard
.
objects
.
get
(
pk
=
pk
),
'questboard'
:
Questboard
.
objects
.
get
(
pk
=
pk
),
'quests'
:
Quest
.
objects
.
filter
(
board_id
=
pk
),
'quests'
:
Quest
.
objects
.
filter
(
board_id
=
pk
),
'share_url'
:
get_share_url
(
request
,
pk
),
'signup_form'
:
StudentSignupForm
(
auto_id
=
'signup_
%
s'
)
'signup_form'
:
StudentSignupForm
(
auto_id
=
'signup_
%
s'
)
}
}
)
)
def
get_share_url
(
request
,
pk
):
return
request
.
build_absolute_uri
(
'/questboard/view/'
+
str
(
pk
))
def
add_quest
(
request
):
def
add_quest
(
request
):
if
request
.
method
==
"POST"
:
if
request
.
method
==
"POST"
:
...
...
static/board/board.css
0 → 100644
View file @
24351d19
.dropdown
{
position
:
relative
;
display
:
inline-block
;
}
.dropdown-content
{
display
:
none
;
position
:
absolute
;
background-color
:
gainsboro
;
min-width
:
6vw
;
box-shadow
:
0vw
0.5vw
1vw
0vw
rgba
(
0
,
0
,
0
,
0.2
);
z-index
:
1
;
}
.dropdown-content
button
{
padding-top
:
0.2vw
;
padding-bottom
:
0.2vw
;
width
:
100%
;
text-align
:
center
;
text-decoration
:
none
;
display
:
inline-block
;
}
.dropdown
:hover
.dropdown-content
{
display
:
block
;}
.infobox
{
width
:
70vw
;
border
:
1px
solid
black
;
padding-left
:
1vw
;
}
.questbox_wrapper
{
display
:
inline
;
float
:
left
;
margin-left
:
1vw
;
margin-right
:
1vw
;
height
:
70vh
;
width
:
320px
;
}
.questbox
{
border
:
1px
solid
black
;
padding
:
2vw
;
}
.questbox_name
{
font-size
:
large
;
font-weight
:
bold
;
text-align
:
center
;
}
.questbox_description
{
text-align
:
center
;
}
.questbox_stars
{
text-align
:
center
;
}
.questbox_students
{
display
:
block
;
margin
:
auto
;
padding-top
:
1vh
;
padding-bottom
:
1vh
;
}
.questbox_actions
{
display
:
block
;
margin
:
auto
;
padding-top
:
1vh
;
padding-bottom
:
1vh
;
}
\ No newline at end of file
static/styles.css
0 → 100644
View file @
24351d19
*
{
line-height
:
1.5
;
font-family
:
'Roboto'
,
sans-serif
;
}
dialog
{
width
:
35vw
;
}
dialog
form
input
{
display
:
block
;
}
dialog
form
label
{
font-weight
:
bold
;
display
:
block
;
}
dialog
form
textarea
{
display
:
block
;
}
dialog
form
button
{
font-weight
:
bold
;
display
:
block
;
margin-top
:
0.5vw
;
padding
:
0.2vw
1vw
;
border-width
:
0.4vw
;
}
table
,
table
tr
,
table
tr
th
,
table
tr
td
{
border
:
1px
solid
black
;
}
table
{
border-collapse
:
collapse
;
}
table
tr
td
,
table
tr
th
{
padding-left
:
1vw
;
padding-right
:
3vw
;
padding-top
:
.5vw
;
padding-bottom
:
.5vw
;
text-align
:
left
;
max-width
:
30vw
;
}
#contents
{
float
:
left
;
width
:
70vw
;
margin-left
:
10vw
;
margin-right
:
10vw
;
padding
:
3vh
5vw
;
background-color
:
white
;
}
.menu
{
margin
:
0
;
padding
:
0
;
overflow
:
hidden
;
list-style-type
:
none
;
background-color
:
#333
;
}
.menu
li
{
float
:
left
;
}
.menu
li
a
{
color
:
white
;
display
:
block
;
text-align
:
center
;
padding
:
14px
16px
;
text-decoration
:
none
;
}
.menu
li
a
:hover
{
background-color
:
#111
;
}
.homepage_link
{
margin-top
:
3vh
;
margin-left
:
3vw
;
}
.website_header
{
font-size
:
48px
;
font-weight
:
bold
;
font-style
:
italic
;
color
:
darkslateblue
;
line-height
:
0.0
;
}
.website_author
{
font-style
:
italic
;
}
.page_header
{
font-weight
:
bold
;
font-size
:
x-large
;
}
.large_header
{
font-weight
:
bold
;
text-align
:
center
;
font-size
:
xx-large
;
}
.sub_header
{
font-size
:
large
;
font-weight
:
bold
;
}
.button
{
padding
:
0.2vw
1vw
;
margin-top
:
0.5vw
;
text-align
:
center
;
text-decoration
:
none
;
display
:
inline-block
;
}
templates/base.html
View file @
24351d19
...
@@ -20,9 +20,10 @@
...
@@ -20,9 +20,10 @@
</head>
</head>
<body>
<body>
<a
href =
"/home/"
><p
class =
"website_header"
>
QUESTBOARD
</p></a>
<a
href =
"/home/"
><p
class =
"homepage_link"
>
Back to Homepage
</p></a>
<div
id=
"contents"
>
<div
id=
"contents"
>
<a
href =
"/home/"
><p
class =
"website_header"
>
Questboard!
</p></a>
<p
class =
"website_author"
>
Implemented by Aedin Clay
</p>
<p
class =
"page_header"
>
{% block header %}{% endblock %}
</p>
<p
class =
"page_header"
>
{% block header %}{% endblock %}
</p>
{% block content %}{% endblock %}
{% block content %}{% endblock %}
</div>
</div>
...
...
templates/board/board.html
View file @
24351d19
...
@@ -11,16 +11,19 @@
...
@@ -11,16 +11,19 @@
{% block content %}
{% block content %}
Required Stars: {{questboard.required_stars}}
<br/>
<div
class =
"infobox"
>
{{questboard.description}}
<br/>
<p><b>
Description:
</b>
{{questboard.description}}
</p>
<p><b>
Required stars:
</b>
{{questboard.required_stars}}
</p>
</div>
<!-- Copy questboard link -->
<!-- Copy questboard link -->
<button
onclick =
"copyQuestboardLink()"
>
Copy Questboard Link
</button><br/
>
<button
onclick =
"copyQuestboardLink()"
class =
"button"
>
Copy Questboard Link
</button
>
<script>
<script>
function
copyQuestboardLink
(){
function
copyQuestboardLink
(){
var
link_area
=
document
.
createElement
(
"textarea"
)
var
link_area
=
document
.
createElement
(
"textarea"
)
document
.
body
.
appendChild
(
link_area
);
document
.
body
.
appendChild
(
link_area
);
link_area
.
value
=
window
.
location
.
href
;
link_area
.
value
=
'{{ share_url }}'
;
link_area
.
select
();
link_area
.
select
();
document
.
execCommand
(
"copy"
);
document
.
execCommand
(
"copy"
);
document
.
body
.
removeChild
(
link_area
);
document
.
body
.
removeChild
(
link_area
);
...
@@ -28,20 +31,20 @@ function copyQuestboardLink(){
...
@@ -28,20 +31,20 @@ function copyQuestboardLink(){
</script>
</script>
{% block extra_content %}{% endblock %}
{% block extra_content %}{% endblock %}
<br/>
<p
class =
"sub_header"
>
Quests:
</p>
{% if quests %}
{% if quests %}
Quests in the Questboard:
<div
id =
"quest_display"
>
<div
id =
"quest_display"
>
{% for quest in quests %}
{% for quest in quests %}
<div
class =
"questbox_wrapper"
>
<div
class =
"questbox"
>
<div
class =
"questbox"
>
<p
class =
"questbox_name"
>
{{ quest.name }}
</p>
<p
class =
"questbox_name"
>
{{ quest.name }}
</p>
<p
class =
"questbox_description"
>
{{ quest.description }}
</p>
<p
class =
"questbox_description"
>
{{ quest.description }}
</p>
<p
class =
"questbox_stars"
>
Stars : {{quest.stars}}
</p>
<p
class =
"questbox_stars"
>
Stars : {{quest.stars}}
</p>
<div
class =
"questbox_students"
>
<div
class =
"questbox_students"
>
{% if quest.for_everyone is True %}
{% if quest.for_everyone is True %}
<b>
for everyone
</b>
This Quest is for everyone.
{% else %}
{% else %}
<ol>
<ol>
<li>
{{quest.student1}}
</li>
<li>
{{quest.student1}}
</li>
...
@@ -54,8 +57,11 @@ function copyQuestboardLink(){
...
@@ -54,8 +57,11 @@ function copyQuestboardLink(){
{% block questbox_actions %}{% endblock %}
{% block questbox_actions %}{% endblock %}
</span>
</span>
</div>
</div>
</div>
{% endfor %}
{% endfor %}
</div>
</div>
{% else %}
<i>
No Quests so Far
</i>
{% endif %}
{% endif %}
...
...
templates/board/edit_board.html
View file @
24351d19
...
@@ -2,10 +2,16 @@
...
@@ -2,10 +2,16 @@
{% load static %}
{% load static %}
{% block extra_content %}
{% block extra_content %}
<button
onclick=
"showEditBoardName()"
>
Edit Questboard Name
</button>
<div
class =
"dropdown"
>
<button
onclick=
"showEditBoardDesc()"
>
Edit Questboard Description
</button>
<button
class =
"button"
>
Edit Options
</button>
<button
onclick=
"showEditBoardStars()"
>
Edit Questboard Required Stars
</button>
<div
class =
"dropdown-content"
>
<button
onclick=
"showAddQuest()"
>
Add Quest
</button>
<button
onclick=
"showEditBoardName()"
>
Edit Name
</button>
<button
onclick=
"showEditBoardDesc()"
>
Edit Description
</button>
<button
onclick=
"showEditBoardStars()"
>
Edit Required Stars
</button>
</div>
</div>
<button
class =
"button"
onclick=
"showAddQuest()"
>
Add Quest
</button>
<br/>
<br/>
<dialog
id=
"edit_board_name"
>
<dialog
id=
"edit_board_name"
>
<form
action =
"/questboard/edit/edit_board_name/"
method =
"post"
>
<form
action =
"/questboard/edit/edit_board_name/"
method =
"post"
>
...
@@ -66,10 +72,10 @@
...
@@ -66,10 +72,10 @@
{% block questbox_actions %}
{% block questbox_actions %}
<!-- If no student has signed up yet or the quest is for everyone, then the quest can be edited / deleted -->
<!-- If no student has signed up yet or the quest is for everyone, then the quest can be edited / deleted -->
{% if quest.student1 == '' and quest.student2 == '' and quest.student3 == '' %}
{% if quest.student1 == '' and quest.student2 == '' and quest.student3 == '' %}
<button
onclick=
"showEditQuest({{quest.pk}})"
>
Edit Quest
</button>
<button
onclick=
"showEditQuest({{quest.pk}})"
class =
"button"
>
Edit Quest
</button>
<button
onclick=
"showDeleteQuest({{quest.pk}})"
>
Delete Quest
</button>
<button
onclick=
"showDeleteQuest({{quest.pk}})"
class =
"button"
>
Delete Quest
</button>
{% else %}
{% else %}
<p>
Cannot Edit Quest: students
signed up alsready
</p>
<p>
Cannot Edit Quest: students
have already signed up.
</p>
{% endif %}
{% endif %}
{% endblock %}
{% endblock %}
...
...
templates/board/view_board.html
View file @
24351d19
...
@@ -13,10 +13,6 @@
...
@@ -13,10 +13,6 @@
{% endblock %}
{% endblock %}
{% block extra_content %}
{% block extra_content %}
<!-- Display current URL so it can be copied and sent to students -->
<p>
Share this course by copying this link! :
</p>
<dialog
id =
"quest_signup"
>
<dialog
id =
"quest_signup"
>
Please enter your name to sign up for this quest.
Please enter your name to sign up for this quest.
<form
action =
"/questboard/view/student_signup/"
method =
"post"
>
<form
action =
"/questboard/view/student_signup/"
method =
"post"
>
...
...
templates/homepage/homepage.html
View file @
24351d19
...
@@ -23,10 +23,10 @@
...
@@ -23,10 +23,10 @@
<td>
{{ board.name }}
</td>
<td>
{{ board.name }}
</td>
<td>
<td>
<a
href =
"/questboard/edit/{{ board.pk }}"
>
<a
href =
"/questboard/edit/{{ board.pk }}"
>
<button
class =
"button"
>
Edit Questboard
as Teacher
</button>
<button
>
Edit
as Teacher
</button>
</a>
</a>
<a
href =
"/questboard/view/{{ board.pk }}"
>
<a
href =
"/questboard/view/{{ board.pk }}"
>
<button
class =
"button"
>
View Questboard
as Student
</button>
<button
>
View
as Student
</button>
</a>
</a>
</td>
</td>
</tr>
</tr>
...
...
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