Skip to content

Commit

Permalink
Clean codes
Browse files Browse the repository at this point in the history
  • Loading branch information
FuHsinyu committed Aug 5, 2024
1 parent 1aaa405 commit a9f5492
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
5 changes: 2 additions & 3 deletions admin/templates/admin/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h2 class="card-title">Set Maintenance Banner</h2>
<button type="submit" class="btn btn-primary" name="Set Banner">Set Banner</button>
</form>
<!-- Form to remove the maintenance banner -->
<form action="{{ url_for('admin_bp.remove_banner') }}" method="POST">
<form action="{{ url_for('admin_bp.remove_banner') }}" method="POST" class="flex-shrink-1">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="btn btn-secondary" name="Remove Banner">Remove Banner</button>
</form>
Expand All @@ -57,8 +57,7 @@ <h2 class="card-title">Change Portal Theme</h2>
<!-- Add default theme option -->
{% set current_theme = config.get('YODA_THEME', 'uu') %}
{% for folder in theme_directories %}
<option value="{{ folder }}" {% if folder==current_theme %}selected{% endif %}> {{
config.get('YODA_THEME_MAPPING').get(folder, folder) }}</option>
<option value="{{ folder }}" {% if folder==current_theme %}selected{% endif %}>{{config.get('YODA_THEME_MAPPING').get(folder, folder) }}</option>
{% endfor %}
</select>
</div>
Expand Down
2 changes: 0 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
__copyright__ = 'Copyright (c) 2021-2023, Utrecht University'
__license__ = 'GPLv3, see LICENSE'


import json
from os import path
from typing import Any, Dict, Optional
Expand Down Expand Up @@ -136,7 +135,6 @@ def load_admin_setting() -> Dict[str, Any]:
monitor_thread = Monitor(app.config)
monitor_thread.start()


# Register blueprints
with app.app_context():
app.register_blueprint(general_bp)
Expand Down
18 changes: 9 additions & 9 deletions vault/static/vault/js/vault.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,28 +177,28 @@ $(function () {
})

$('body').on('click', 'button.action-confirm-data-package-select', function () {
var dataPackage = $('#submitPublication .modal-body input[type="radio"]:checked').val();
$('#submitPublication').modal('hide');
dataPackage = $('#submitPublication .modal-body input[type="radio"]:checked').val()
$('#submitPublication').modal('hide')

$('#confirmAgreementConditions .modal-body').text(''); // Clear it first
$('#confirmAgreementConditions .modal-body').text('') // clear it first

// Fetch publication terms from the Flask endpoint
$.ajax({
url: '/admin/api/publication-terms',
type: 'GET',
success: function(response) {
$('#confirmAgreementConditions .modal-body').html(response.terms);
$('#confirmAgreementConditions .modal-body').html(response.terms)

// Set default status and show dialog.
$('.action-confirm-submit-for-publication').prop('disabled', true);
$('#confirmAgreementConditions .confirm-conditions').prop('checked', false);
$('.action-confirm-submit-for-publication').prop('disabled', true)
$('#confirmAgreementConditions .confirm-conditions').prop('checked', false)

$('#confirmAgreementConditions').modal('show');
$('#confirmAgreementConditions').modal('show')
},
error: function() {
console.error("Failed to load publication terms.");
console.error("Failed to load publication terms.")
// Handle error case
$('#confirmAgreementConditions .modal-body').html("Failed to load publication terms.");
$('#confirmAgreementConditions .modal-body').html("Failed to load publication terms.")
}
});
});
Expand Down

0 comments on commit a9f5492

Please sign in to comment.