-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add file submission to problem page #1933
Draft
alexwaeseperlman
wants to merge
7
commits into
DMOJ:master
Choose a base branch
from
alexwaeseperlman:add-file-submission
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d136240
Add file submission to the problem page
alexwaeseperlman b0624a3
don't allow empty submissions
alexwaeseperlman f382bd3
don't show upload button when user is not logged in
alexwaeseperlman 9996eea
fix style issues
alexwaeseperlman ab696eb
make submit file feature only modify client side
alexwaeseperlman 99563b6
make javascript submitting less hacky
alexwaeseperlman 36fd5a8
replace tabs with spaces
alexwaeseperlman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
{% extends "common-content.html" %} | ||
{% block js_media %} | ||
{{ form.media.js }} | ||
{% endblock %} | ||
{% block content_media %} | ||
{% include "comments/media-css.html" %} | ||
{{ form.media.css }} | ||
<style> | ||
.title-state { | ||
font-size: 2em; | ||
|
@@ -34,13 +38,17 @@ | |
min-width: 12.5em; | ||
} | ||
|
||
#problem-types, #allowed-langs, #available-judges { | ||
#problem-types, #allowed-langs, #available-judges, #file-upload { | ||
padding-top: 1em; | ||
} | ||
|
||
.problem-info-entry { | ||
padding-top: 0.5em; | ||
} | ||
|
||
#file-upload-form > div { | ||
margin-top: 5px; | ||
} | ||
</style> | ||
{% endblock %} | ||
|
||
|
@@ -98,7 +106,7 @@ <h2 style="color:#393630; display: inline-block">{{ title }}</h2> | |
{% if request.user.is_authenticated and request.in_contest and submission_limit %} | ||
{% if submissions_left > 0 %} | ||
<a href="{{ url('problem_submit', problem.code) }}" class="unselectable button full"> | ||
{{ _('Submit solution') }} | ||
{{ _('Go to editor') }} | ||
</a> | ||
<div class="submissions-left"> | ||
{% trans trimmed counter=submissions_left %} | ||
|
@@ -108,14 +116,40 @@ <h2 style="color:#393630; display: inline-block">{{ title }}</h2> | |
{% endtrans %} | ||
</div> | ||
{% else %} | ||
<a class="unselectable button full disabled">{{ _('Submit solution') }}</a> | ||
<a class="unselectable button full disabled">{{ _('Go to editor') }}</a> | ||
<div class="no-submissions-left submissions-left">{{ _('0 submissions left') }}</div> | ||
{% endif %} | ||
{% else %} | ||
<a href="{{ url('problem_submit', problem.code) }}" class="unselectable button full"> | ||
{{ _('Submit solution') }} | ||
{{ _('Go to editor') }} | ||
</a> | ||
{% endif %} | ||
{% if request.user.is_authenticated and (not request.in_contest or submission_limit) %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: please use spaces instead of tabs. |
||
<form id="file-upload" method="post" action="{{ url('problem_submit', problem.code) }}" enctype="multipart/form-data"> | ||
{% csrf_token %} | ||
{{ form.non_field_errors() }} | ||
|
||
<div class="toggle closed unselectable"> | ||
<i class="fa fa-chevron-right fa-fw"></i>Upload a file | ||
</div> | ||
<div style="display:none" class="toggled" id="file-upload-form"> | ||
<div> | ||
{{ form.file }} | ||
</div> | ||
<div id="language-select"> | ||
<select id="id_language" name="language" class="full"> | ||
{% for lang in form.fields.language.queryset %} | ||
<option value="{{ lang.id }}" {% if request.user.is_authenticated and lang.id == default_lang.id %}selected{% endif %}>{{ lang.name }}</option> | ||
{% endfor %} | ||
</select> | ||
</div> | ||
<div> | ||
<input value="{{ _('Submit!') }}" type="submit" id="submit-file-button" class="unselectable button full" | ||
{% if request.in_contest and submission_limit and not submissions_left %}disabled{% endif %} /> | ||
</div> | ||
</div> | ||
</form> | ||
{% endif %} | ||
|
||
<hr style="padding-bottom: 0.3em"> | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: don't delete newline.