-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1547 from laws-africa/report-issue
Add functionality for reporting a document with an issue
- Loading branch information
Showing
23 changed files
with
5,261 additions
and
631 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,5 @@ | |
|
||
# add middleware to redirect from agp.africanlii.org to africanlii.org | ||
MIDDLEWARE.insert(1, "africanlii.middleware.RedirectAGPMiddleware") # noqa | ||
|
||
ADMINS = [("AfricanLII", "[email protected]")] |
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 |
---|---|---|
|
@@ -7,3 +7,5 @@ | |
# Court codes mappings for legacy lii urls | ||
# Override this in the lii settings.py | ||
COURT_CODE_MAPPINGS = {} | ||
|
||
ADMINS = [("Laws.Africa", "[email protected]")] |
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 |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<template> | ||
<div class="modal-dialog"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 id="documentProblemModalTitle" class="modal-title"> | ||
{{ $t('Is there something wrong with this document?') }} | ||
</h5> | ||
<button | ||
type="button" | ||
class="btn-close" | ||
data-bs-dismiss="modal" | ||
aria-label="Close"/> | ||
</div> | ||
<div class="modal-body"> | ||
<form | ||
v-if="!submitted" | ||
id="document-problem-form" | ||
ref="form" | ||
method="post" | ||
@submit.prevent="onSubmit" | ||
> | ||
<input | ||
type="hidden" | ||
name="document_link" | ||
:value="url" | ||
> | ||
<div class="form-group mb-2"> | ||
<label for="problem_description"> | ||
{{ $t("What's the problem?") }} | ||
<span class="text-danger">*</span> | ||
</label> | ||
<textarea | ||
id="problem_description" | ||
v-model="problem" | ||
class="form-control" | ||
name="problem_description" | ||
rows="4" | ||
required | ||
/> | ||
</div> | ||
<div class="form-group"> | ||
<label for="email_address">{{ $t('Your email address (optional)') }}</label> | ||
<input | ||
id="email_address" | ||
v-model="email" | ||
type="email" | ||
class="form-control" | ||
name="email_address" | ||
placeholder="[email protected]" | ||
> | ||
</div> | ||
</form> | ||
<div v-else> | ||
{{ success ? $t('Thank you for your feedback.') : $t('Something went wrong.') }} | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"> | ||
{{ submitted ? $t('Close') : $t('Cancel') }} | ||
</button> | ||
<button | ||
v-if="!submitted" | ||
type="submit" | ||
class="btn btn-success" | ||
form="document-problem-form" | ||
> | ||
{{ $t('Report problem') }} | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { authHeaders } from '../api'; | ||
export default { | ||
name: 'DocumentProblemModal', | ||
data () { | ||
return { | ||
email: '', | ||
message: '', | ||
problem: '', | ||
submitted: false, | ||
success: true, | ||
url: window.location.toString() | ||
}; | ||
}, | ||
mounted () { | ||
// attach a listener to the bootstrap modal events | ||
this.$el.parentElement.addEventListener('show.bs.modal', this.onShow); | ||
}, | ||
methods: { | ||
onShow () { | ||
this.email = ''; | ||
this.message = ''; | ||
this.problem = ''; | ||
this.submitted = false; | ||
this.success = true; | ||
}, | ||
onSubmit () { | ||
const form = new FormData(this.$refs.form); | ||
fetch('/document-problem/', { | ||
method: 'post', | ||
body: form, | ||
headers: authHeaders() | ||
}).then(response => { | ||
this.submitted = true; | ||
this.success = response.ok; | ||
}).catch(error => { | ||
console.log(error); | ||
}); | ||
} | ||
} | ||
}; | ||
</script> |
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
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
Oops, something went wrong.