Skip to content

Commit

Permalink
Initialize setting review / proposal stage page
Browse files Browse the repository at this point in the history
  • Loading branch information
alice6373 committed Jul 18, 2020
1 parent 7b9f2cd commit 1497d90
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/locale/zh_Hant/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,12 @@ msgstr "更改密碼"
msgid "Reviews"
msgstr "審查"

#: templates/default/_includes/dashboard_tablist.html:28
#: templates/default/reviews/review_change.html:12
#: templates/default/reviews/review_change.html:18
msgid "Change Review"
msgstr "更改審查設定"

#: templates/default/_includes/nav/dashboard_nav.html:10
msgid "Log out"
msgstr "登出"
Expand Down
4 changes: 4 additions & 0 deletions src/static/css/components/_texts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@
.text-emphasize {
@include roboto-medium();
}

.input-customized-size input{
width: 16.2em;
}
44 changes: 44 additions & 0 deletions src/static/css/components/_toggle.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.material-switch > input[type="checkbox"] {
display: none;
}

.material-switch > label {
cursor: pointer;
height: 0px;
position: relative;
width: 40px;
}

.material-switch > label::before {
background: rgb(0, 0, 0);
box-shadow: inset 0px 0px 10px rgba(0, 0, 0, 0.5);
border-radius: 8px;
content: '';
height: 16px;
margin-top: -8px;
position:absolute;
opacity: 0.3;
transition: all 0.4s ease-in-out;
width: 40px;
}
.material-switch > label::after {
background: rgb(255, 255, 255);
border-radius: 16px;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3);
content: '';
height: 24px;
left: -4px;
margin-top: -8px;
position: absolute;
top: -4px;
transition: all 0.3s ease-in-out;
width: 24px;
}
.material-switch > input[type="checkbox"]:checked + label::before {
background: inherit;
opacity: 0.5;
}
.material-switch > input[type="checkbox"]:checked + label::after {
background: inherit;
left: 20px;
}
1 change: 1 addition & 0 deletions src/static/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
@import "components/tables";
@import "components/texts";
@import "components/lists";
@import "components/toggle";

// Pages
@import "pages/proposals";
Expand Down
6 changes: 6 additions & 0 deletions src/templates/default/_includes/dashboard_tablist.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,10 @@
{% endif %}
</li>
{% endif %}

{% if user.is_admin %}
<li class="{% if active == 'admin' %}active{% endif %}">
<a href="{% url 'review_change' %}">{% trans 'Change Review' %}</a>
</li>
{% endif %}
</ul>
76 changes: 76 additions & 0 deletions src/templates/default/reviews/review_change.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{% extends 'dashboard_base.html' %}

{% load i18n crispy_forms_tags %}

{% block dashboard_tablist %}
{% include '_includes/dashboard_tablist.html' with active='admin' %}
{% endblock dashboard_tablist %}

{% block main-content %}

<h3 class="dashboard-header">
<span class="header-title">{% trans 'Change Review' %}</span>
</h3>

<div class="col-md-9">
<div class="dashboard-body">
<div class="panel panel-default">
<div class="panel-heading">{% trans 'Change Review' %}</div>
<ul class="list-group">
<li class="panel-title list-group-item">
pycontw-2020.proposals.creatable
<div class="material-switch pull-right">
<input id="pycontw-2020.proposals.creatable" name="pycontw-2020.proposals.creatable" type="checkbox" />
<label for="pycontw-2020.proposals.creatable" class="label-info"></label>
</div>
</li>
<li class="panel-title list-group-item">
pycontw-2020.proposals.editable
<div class="material-switch pull-right">
<input id="pycontw-2020.proposals.editable" name="pycontw-2020.proposals.editable" type="checkbox" />
<label for="pycontw-2020.proposals.editable" class="label-info"></label>
</div>
</li>
<li class="panel-title list-group-item">
pycontw-2020.proposals.withdrawable
<div class="material-switch pull-right">
<input id="pycontw-2020.proposals.withdrawable" name="pycontw-2020.proposals.withdrawable" type="checkbox" />
<label for="pycontw-2020.proposals.withdrawable" class="label-info"></label>
</div>
</li>
<li class="panel-title list-group-item">
pycontw-2020.reviews.visible.to.submitters
<div class="material-switch pull-right">
<input id="pycontw-2020.reviews.visible.to.submitters" name="pycontw-2020.reviews.visible.to.submitters" type="checkbox" />
<label for="pycontw-2020.reviews.visible.to.submitters" class="label-info"></label>
</div>
</li>
<li class="panel-title list-group-item">
pycontw-2020.reviews.stage
<div class="input-customized-size pull-right">
<input id="pycontw-2020.reviews.stage" name="pycontw-2020.reviews.stage" type="number" min="0" max="2" placeholder="Int" required >
</div>
</li>
<li class="panel-title list-group-item">
pycontw-2020.proposals.disable.after
<div class="input-customized-size pull-right">
<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"
required>
</div>
</li>
</ul>
</div>

<form action="{% url 'review_change' %}" method="post">
{% csrf_token %}
<div class="nesting-form-group">
{{ form|crispy }}
<button type="submit" class="btn btn-primary">
{% trans 'Submit' %}
</button>
</div>
</div>
</div>
</form>

{% endblock main-content %}
3 changes: 3 additions & 0 deletions src/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ def is_valid_speaker(self):
def is_reviewer(self):
return self.has_perm('reviews.add_review')

def is_admin(self):
return self.is_superuser

@property
def cospeaking_info_set(self):
return self.additionalspeaker_set.filter(
Expand Down
1 change: 1 addition & 0 deletions src/users/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@

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

]
2 changes: 2 additions & 0 deletions src/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ def get_context_data(self, **kwargs):
context.update(**reviews_state()._asdict())
return context

def review_change(request):
return render(request, 'reviews/review_change.html')

login = auth_views.LoginView.as_view(authentication_form=AuthenticationForm)
logout = auth_views.LogoutView.as_view()
Expand Down

0 comments on commit 1497d90

Please sign in to comment.