Skip to content
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

YDA-5720 config publication terms #341

Merged
merged 25 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a9059eb
add basic ui for publication terms
FuHsinyu Aug 1, 2024
914eda2
add endpoint to retrive local terms and add preview window for terms …
FuHsinyu Aug 1, 2024
e62bb72
add reading default terms from irods, if current terms not exist in /…
FuHsinyu Aug 1, 2024
38f7510
add endpoint to update terms displayed when user click publication
FuHsinyu Aug 1, 2024
0a9f535
add saving terms to /config if there is no such in the /config directory
FuHsinyu Aug 1, 2024
ef1f03c
add the modal for preview publication terms
FuHsinyu Aug 2, 2024
d47d2c2
let preiview function retrive current terms from endpoints instead of…
FuHsinyu Aug 2, 2024
a8cdfeb
Rearrange UI components to make admin page slightly consistent in vis…
FuHsinyu Aug 2, 2024
7cda848
Move create_preview js script out of the html to a separate .js file …
FuHsinyu Aug 5, 2024
034198d
refacorized codes
FuHsinyu Aug 5, 2024
94c7668
Add type hint and doc strings
FuHsinyu Aug 5, 2024
1aaa405
Remove unused codes
FuHsinyu Aug 5, 2024
a9f5492
Clean codes
FuHsinyu Aug 5, 2024
247ea0f
Formatted codes
FuHsinyu Aug 5, 2024
ff15b0b
Fix the vault js to fetch terms from flask endpoint
FuHsinyu Aug 5, 2024
f106c69
Let the preview function preview the terms in textarea
FuHsinyu Aug 6, 2024
d6afcd7
Add DOMpurify to santinize html content
FuHsinyu Aug 6, 2024
ddb9671
move purify to /static/lib/ and add purify map
FuHsinyu Aug 6, 2024
a778e35
Merge branch 'development' into YDA-5720-config-publication-terms
lwesterhof Aug 6, 2024
6af3638
Fix javascript problems
lwesterhof Aug 6, 2024
054fb80
add comment to global createPreview for JS lint
FuHsinyu Aug 6, 2024
6c15755
disable no-unused-vars for createPreview
FuHsinyu Aug 6, 2024
7c954c2
Refactor to remove eslint ignore
lwesterhof Aug 6, 2024
7a47233
Add missing document ready
lwesterhof Aug 6, 2024
1d20bcf
Fix id name
lwesterhof Aug 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions admin/static/admin/js/create_preview.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Function to preview publication terms in a specific modal
function createPreview() {
// Get the content of the textarea
// Get the content of the textarea and sanitize it
var termsText = document.getElementById('publicationTerms').value;
const sanitizedContent = DOMPurify.sanitize(termsText);

// Set the content in the modal body for preview
const modalBody = document.querySelector('#confirmAgreementConditions .modal-body');
modalBody.innerHTML = termsText;
modalBody.innerHTML = sanitizedContent;

// Show the modal
var myModal = new bootstrap.Modal(document.getElementById('confirmAgreementConditions'));
Expand Down
3 changes: 2 additions & 1 deletion admin/templates/admin/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

{% block scripts %}
<script src="{{ url_for('admin_bp.static', filename='js/create_preview.js') }}"></script>
lwesterhof marked this conversation as resolved.
Show resolved Hide resolved
<script src="{{ url_for('static', filename='js/purify.min.js') }}"></script>
lwesterhof marked this conversation as resolved.
Show resolved Hide resolved
{% endblock scripts %}

{% block content %}
Expand All @@ -25,7 +26,7 @@ <h2 class="card-title">Set Maintenance Banner</h2>
<div class="mb-3">
<label for="banner">Banner Details:</label>
<textarea class="form-control" name="banner" id="banner" rows="2"
placeholder="Enter system maintenance details..." style="width: 110%;"
placeholder="Enter system maintenance details..."
required>{{config.get('banner').get('message','')}}</textarea>
</div>
<!-- Checkbox to mark the banner as important -->
Expand Down
Loading