Skip to content

Commit 1497d90

Browse files
committed
Initialize setting review / proposal stage page
1 parent 7b9f2cd commit 1497d90

File tree

9 files changed

+143
-0
lines changed

9 files changed

+143
-0
lines changed

Diff for: src/locale/zh_Hant/LC_MESSAGES/django.po

+6
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,12 @@ msgstr "更改密碼"
12981298
msgid "Reviews"
12991299
msgstr "審查"
13001300

1301+
#: templates/default/_includes/dashboard_tablist.html:28
1302+
#: templates/default/reviews/review_change.html:12
1303+
#: templates/default/reviews/review_change.html:18
1304+
msgid "Change Review"
1305+
msgstr "更改審查設定"
1306+
13011307
#: templates/default/_includes/nav/dashboard_nav.html:10
13021308
msgid "Log out"
13031309
msgstr "登出"

Diff for: src/static/css/components/_texts.scss

+4
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@
88
.text-emphasize {
99
@include roboto-medium();
1010
}
11+
12+
.input-customized-size input{
13+
width: 16.2em;
14+
}

Diff for: src/static/css/components/_toggle.scss

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
.material-switch > input[type="checkbox"] {
2+
display: none;
3+
}
4+
5+
.material-switch > label {
6+
cursor: pointer;
7+
height: 0px;
8+
position: relative;
9+
width: 40px;
10+
}
11+
12+
.material-switch > label::before {
13+
background: rgb(0, 0, 0);
14+
box-shadow: inset 0px 0px 10px rgba(0, 0, 0, 0.5);
15+
border-radius: 8px;
16+
content: '';
17+
height: 16px;
18+
margin-top: -8px;
19+
position:absolute;
20+
opacity: 0.3;
21+
transition: all 0.4s ease-in-out;
22+
width: 40px;
23+
}
24+
.material-switch > label::after {
25+
background: rgb(255, 255, 255);
26+
border-radius: 16px;
27+
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3);
28+
content: '';
29+
height: 24px;
30+
left: -4px;
31+
margin-top: -8px;
32+
position: absolute;
33+
top: -4px;
34+
transition: all 0.3s ease-in-out;
35+
width: 24px;
36+
}
37+
.material-switch > input[type="checkbox"]:checked + label::before {
38+
background: inherit;
39+
opacity: 0.5;
40+
}
41+
.material-switch > input[type="checkbox"]:checked + label::after {
42+
background: inherit;
43+
left: 20px;
44+
}

Diff for: src/static/css/main.scss

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
@import "components/tables";
2121
@import "components/texts";
2222
@import "components/lists";
23+
@import "components/toggle";
2324

2425
// Pages
2526
@import "pages/proposals";

Diff for: src/templates/default/_includes/dashboard_tablist.html

+6
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,10 @@
2222
{% endif %}
2323
</li>
2424
{% endif %}
25+
26+
{% if user.is_admin %}
27+
<li class="{% if active == 'admin' %}active{% endif %}">
28+
<a href="{% url 'review_change' %}">{% trans 'Change Review' %}</a>
29+
</li>
30+
{% endif %}
2531
</ul>

Diff for: src/templates/default/reviews/review_change.html

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{% extends 'dashboard_base.html' %}
2+
3+
{% load i18n crispy_forms_tags %}
4+
5+
{% block dashboard_tablist %}
6+
{% include '_includes/dashboard_tablist.html' with active='admin' %}
7+
{% endblock dashboard_tablist %}
8+
9+
{% block main-content %}
10+
11+
<h3 class="dashboard-header">
12+
<span class="header-title">{% trans 'Change Review' %}</span>
13+
</h3>
14+
15+
<div class="col-md-9">
16+
<div class="dashboard-body">
17+
<div class="panel panel-default">
18+
<div class="panel-heading">{% trans 'Change Review' %}</div>
19+
<ul class="list-group">
20+
<li class="panel-title list-group-item">
21+
pycontw-2020.proposals.creatable
22+
<div class="material-switch pull-right">
23+
<input id="pycontw-2020.proposals.creatable" name="pycontw-2020.proposals.creatable" type="checkbox" />
24+
<label for="pycontw-2020.proposals.creatable" class="label-info"></label>
25+
</div>
26+
</li>
27+
<li class="panel-title list-group-item">
28+
pycontw-2020.proposals.editable
29+
<div class="material-switch pull-right">
30+
<input id="pycontw-2020.proposals.editable" name="pycontw-2020.proposals.editable" type="checkbox" />
31+
<label for="pycontw-2020.proposals.editable" class="label-info"></label>
32+
</div>
33+
</li>
34+
<li class="panel-title list-group-item">
35+
pycontw-2020.proposals.withdrawable
36+
<div class="material-switch pull-right">
37+
<input id="pycontw-2020.proposals.withdrawable" name="pycontw-2020.proposals.withdrawable" type="checkbox" />
38+
<label for="pycontw-2020.proposals.withdrawable" class="label-info"></label>
39+
</div>
40+
</li>
41+
<li class="panel-title list-group-item">
42+
pycontw-2020.reviews.visible.to.submitters
43+
<div class="material-switch pull-right">
44+
<input id="pycontw-2020.reviews.visible.to.submitters" name="pycontw-2020.reviews.visible.to.submitters" type="checkbox" />
45+
<label for="pycontw-2020.reviews.visible.to.submitters" class="label-info"></label>
46+
</div>
47+
</li>
48+
<li class="panel-title list-group-item">
49+
pycontw-2020.reviews.stage
50+
<div class="input-customized-size pull-right">
51+
<input id="pycontw-2020.reviews.stage" name="pycontw-2020.reviews.stage" type="number" min="0" max="2" placeholder="Int" required >
52+
</div>
53+
</li>
54+
<li class="panel-title list-group-item">
55+
pycontw-2020.proposals.disable.after
56+
<div class="input-customized-size pull-right">
57+
<input id="pycontw-2020.proposals.disable.after" name="pycontw-2020.proposals.disable.after" type="datetime-local" step="1" placeholder="yyyy-mm-dd hh:mm:ss"
58+
required>
59+
</div>
60+
</li>
61+
</ul>
62+
</div>
63+
64+
<form action="{% url 'review_change' %}" method="post">
65+
{% csrf_token %}
66+
<div class="nesting-form-group">
67+
{{ form|crispy }}
68+
<button type="submit" class="btn btn-primary">
69+
{% trans 'Submit' %}
70+
</button>
71+
</div>
72+
</div>
73+
</div>
74+
</form>
75+
76+
{% endblock main-content %}

Diff for: src/users/models.py

+3
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ def is_valid_speaker(self):
246246
def is_reviewer(self):
247247
return self.has_perm('reviews.add_review')
248248

249+
def is_admin(self):
250+
return self.is_superuser
251+
249252
@property
250253
def cospeaking_info_set(self):
251254
return self.additionalspeaker_set.filter(

Diff for: src/users/urls.py

+1
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@
3232

3333
url(r'^agreement/$',
3434
views.coc_agree, name='coc_agreement'),
35+
url(r'^review-change/$', views.review_change, name='review_change'),
3536

3637
]

Diff for: src/users/views.py

+2
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ def get_context_data(self, **kwargs):
195195
context.update(**reviews_state()._asdict())
196196
return context
197197

198+
def review_change(request):
199+
return render(request, 'reviews/review_change.html')
198200

199201
login = auth_views.LoginView.as_view(authentication_form=AuthenticationForm)
200202
logout = auth_views.LogoutView.as_view()

0 commit comments

Comments
 (0)