-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve handling of published/unpublished data in downloads (#956)
* wip - team level downloads * WIP refactor animal with get_published_only pattern * update the rest of the animal viewset * change permissions to team member or higher instead of can_edit * lint * update epi api and rename serializer * update epi tests * update downloads page * add checkbox for inclusion of unpublished data * remove checkbox from unsupported exports * restore checkbox to some downloads * remove unused template * update in vitro and epimeta apis * update ROB exports * fixes from review * only add the unpublished flag if the checkbox exists * whitespace edits --------- Co-authored-by: Andy Shapiro <shapiromatron@gmail.com>
- Loading branch information
1 parent
f5f6812
commit 9a58cb5
Showing
18 changed files
with
582 additions
and
94 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
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
30 changes: 20 additions & 10 deletions
30
hawc/apps/assessment/templates/assessment/fragments/downloads_select_js.html
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,15 +1,25 @@ | ||
<script type="text/javascript"> | ||
$(document).ready(function(){ | ||
$('{{name_list}}').on('change', function () { | ||
var format = $(this).val(), | ||
$(document).ready(function () { | ||
$('{{name_list}}').on('change', function () { | ||
var format = $(this).val(), | ||
url = $(`#${this.id}-url`).attr("href"); | ||
if (format && url) { | ||
var format_idx = url.indexOf("format="), | ||
if (format && url) { | ||
var format_idx = url.indexOf("format="), | ||
help_text = format === "xlsx" ? "Excel Spreadsheet" : `${format.toUpperCase()} file`; | ||
$(`#${this.id}-url`).attr("href", url.replace(/format=(\w+)/, `format=${format}`)); | ||
$(`#${this.id}-fmt-text`).text(help_text) | ||
} | ||
return false; | ||
$(`#${this.id}-url`).attr("href", url.replace(/format=(\w+)/, `format=${format}`)); | ||
$(`#${this.id}-fmt-text`).text(help_text) | ||
} | ||
return false; | ||
}); | ||
$(`.unpublished-checkbox`).on('change', function () { | ||
var unpublished = $(this).prop('checked'), | ||
url = $(`#${this.dataset.url}`).attr("href"); | ||
if (url) { | ||
$(`#${this.dataset.url}`).attr( | ||
"href", url.replace(/unpublished=(\w+)/, `unpublished=${unpublished}` | ||
)); | ||
} | ||
return false; | ||
}); | ||
}); | ||
}); | ||
</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.