Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
grady
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan Maximilian Michal
grady
Commits
09bb2f25
Commit
09bb2f25
authored
7 years ago
by
Jan Maximilian Michal
Browse files
Options
Downloads
Patches
Plain Diff
Added download button to submission
parent
752e2ee0
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
core/templates/core/feedback_form.html
+6
-3
6 additions, 3 deletions
core/templates/core/feedback_form.html
core/urls.py
+1
-0
1 addition, 0 deletions
core/urls.py
core/views/feedback.py
+17
-1
17 additions, 1 deletion
core/views/feedback.py
with
24 additions
and
4 deletions
core/templates/core/feedback_form.html
+
6
−
3
View file @
09bb2f25
...
...
@@ -11,7 +11,10 @@
<div
class=
"col my-2 nopadding-right"
>
<div
class=
"card mb-2"
>
<h4
class=
"card-header"
>
{{feedback.of_submission.type.name}}
</h4>
<div
class=
"card-header form-inline pb-1"
>
<h4
class=
"mr-2"
>
{{feedback.of_submission.type.name}}
</h4>
<a
href=
"{% url 'download_submissions' feedback.of_submission.slug %}"
class=
"btn btn-sm btn-outline-secondary mb-1"
>
Download
</a>
</div>
<div
class=
"card-block"
>
<div
id=
"student_text"
class=
"editor editor-code"
></div>
</div>
...
...
@@ -98,11 +101,11 @@
{# Beware! compares status and origin #}
{% if feedback.status == feedback.NEEDS_REVIEW or feedback.status == feedback.EDITABLE %}
<button
type=
"submit"
form=
"form1"
class=
"btn btn-success mr-1 mb-1"
name=
"update"
value=
"Next"
>
Next
</button>
<button
type=
"submit"
form=
"form1"
class=
"btn btn-success mr-1 mb-1"
name=
"update"
value=
"Next"
>
Next
</button>
{% endif %}
{% if feedback.origin != feedback.MANUAL %}
<a
href=
"{% url 'FeedbackDelete' feedback.slug %}"
class=
"btn btn-outline-danger mr-1 mb-1"
name=
"delete"
value=
"Delete"
>
Delete auto feedback
</a>
<a
href=
"{% url 'FeedbackDelete' feedback.slug %}"
class=
"btn btn-outline-danger mr-1 mb-1"
name=
"delete"
value=
"Delete"
>
Delete auto feedback
</a>
{% endif %}
{% if feedback.status == feedback.ACCEPTED %}
...
...
This diff is collapsed.
Click to expand it.
core/urls.py
+
1
−
0
View file @
09bb2f25
...
...
@@ -16,6 +16,7 @@ urlpatterns = [
url
(
r
'
^feedback/delete/(?P<feedback_slug>\w+)/$
'
,
views
.
delete_feedback
,
name
=
'
FeedbackDelete
'
),
url
(
r
'
^submission/view/(?P<slug>\w+)/$
'
,
views
.
SubmissionView
.
as_view
(),
name
=
'
SubmissionView
'
),
url
(
r
'
^submission/download/(?P<slug>\w+)/$
'
,
views
.
download_submissions
,
name
=
'
download_submissions
'
),
url
(
r
'
^csv/$
'
,
views
.
export_csv
,
name
=
'
export
'
)
]
...
...
This diff is collapsed.
Click to expand it.
core/views/feedback.py
+
17
−
1
View file @
09bb2f25
from
random
import
choice
from
django.contrib
import
messages
from
django.http
import
Http404
,
HttpResponseRedirect
from
django.http
import
Http404
,
HttpResponseRedirect
,
HttpResponse
from
django.urls
import
reverse
from
django.utils.decorators
import
method_decorator
from
django.views.generic.edit
import
UpdateView
...
...
@@ -56,6 +56,8 @@ class FeedbackEdit(UpdateView):
elif
instance
.
status
==
Feedback
.
OPEN
:
instance
.
reassign_to_tutor
(
self
.
request
.
user
)
return
instance
elif
not
(
instance
.
of_tutor
==
self
.
request
.
user
or
in_groups
(
self
.
request
.
user
,
(
'
Reviewers
'
,
))):
messages
.
error
(
self
.
request
,
"
Get your hands of somebody else
'
s feedback!
"
)
raise
Http404
def
form_valid
(
self
,
form
):
...
...
@@ -90,3 +92,17 @@ class FeedbackEdit(UpdateView):
context
=
super
(
FeedbackEdit
,
self
).
get_context_data
(
**
kwargs
)
context
[
'
grady_says
'
]
=
choice
(
grady_says
)
return
context
@group_required
(
'
Reviewers
'
,
'
Tutors
'
)
def
download_submissions
(
request
,
slug
):
submission
=
Submission
.
objects
.
get
(
slug
=
slug
)
if
not
(
submission
.
feedback
.
of_tutor
==
request
.
user
or
in_groups
(
request
.
user
,
(
'
Reviewers
'
,
))):
messages
.
error
(
request
,
"
Get your hands of somebody else
'
s feedback!
"
)
return
HttpResponseRedirect
(
reverse
(
'
start
'
))
response
=
HttpResponse
(
content_type
=
'
text/plain
'
)
response
[
'
Content-Disposition
'
]
=
'
attachment; filename=
"
%s_%s.c
"'
%
(
submission
.
type
.
name
,
submission
.
slug
)
response
.
write
(
submission
.
text
)
return
response
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment