forked from enviPath/enviPy
Current Dev State
This commit is contained in:
35
templates/modals/objects/delete_compound_modal.html
Normal file
35
templates/modals/objects/delete_compound_modal.html
Normal file
@ -0,0 +1,35 @@
|
||||
{% load static %}
|
||||
<!-- Delete Compound -->
|
||||
<div id="delete_compound_modal" class="modal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">Delete Compound</h3>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Deletes the Compound and associated Structures.
|
||||
<form id="delete-compound-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" id="hidden" name="hidden" value="delete-compound"/>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="delete-compound-modal-submit">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
$('#delete-compound-modal-submit').click(function(e){
|
||||
e.preventDefault();
|
||||
$('#delete-compound-modal-form').submit();
|
||||
});
|
||||
|
||||
})
|
||||
</script>
|
||||
36
templates/modals/objects/delete_package_modal.html
Normal file
36
templates/modals/objects/delete_package_modal.html
Normal file
@ -0,0 +1,36 @@
|
||||
{% load static %}
|
||||
<!-- Delete Package -->
|
||||
<div id="delete_package_modal" class="modal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">Delete Package</h3>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Deleting a Package deletes the very Package
|
||||
as well as all Objects stored in the Package.
|
||||
<form id="delete-package-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" id="hidden" name="hidden" value="delete-package"/>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="delete-package-modal-submit">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
$('#delete-package-modal-submit').click(function(e){
|
||||
e.preventDefault();
|
||||
$('#delete-package-modal-form').submit();
|
||||
});
|
||||
|
||||
})
|
||||
</script>
|
||||
38
templates/modals/objects/delete_user_modal.html
Normal file
38
templates/modals/objects/delete_user_modal.html
Normal file
@ -0,0 +1,38 @@
|
||||
{% load static %}
|
||||
<!-- Delete User -->
|
||||
<div id="delete_user_modal" class="modal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">Delete User</h3>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-danger">
|
||||
Clicking "Delete" will <strong>permanently</strong> delete the User and associated data.
|
||||
This action can't be undone!
|
||||
</div>
|
||||
<form id="delete-user-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="hidden" value="delete-model">
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-danger" id="delete-user-modal-submit">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
$('#delete-user-modal-submit').click(function(e){
|
||||
e.preventDefault();
|
||||
$('#delete-user-modal-form').submit();
|
||||
});
|
||||
|
||||
})
|
||||
</script>
|
||||
46
templates/modals/objects/edit_compound_modal.html
Normal file
46
templates/modals/objects/edit_compound_modal.html
Normal file
@ -0,0 +1,46 @@
|
||||
{% load static %}
|
||||
<!-- Edit Compound -->
|
||||
<div id="edit_compound_modal" class="modal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Create a Compound</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Edit a Compound.</p>
|
||||
<form id="edit-compound-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||
{% csrf_token %}
|
||||
<p>
|
||||
<label for="compound-name">Name</label>
|
||||
<input id="compound-name" class="form-control" name="compound-name" value="{{ compound.name}}">
|
||||
</p>
|
||||
<p>
|
||||
<label for="compound-description">Description</label>
|
||||
<input id="compound-description" type="text" class="form-control"
|
||||
value="{{ compound.description }}"
|
||||
name="compound-description">
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="edit-compound-modal-submit">Create</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
$('#edit-compound-modal-submit').click(function(e){
|
||||
e.preventDefault();
|
||||
$('#edit-compound-modal-form').submit();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
45
templates/modals/objects/edit_compound_structure_modal.html
Normal file
45
templates/modals/objects/edit_compound_structure_modal.html
Normal file
@ -0,0 +1,45 @@
|
||||
{% load static %}
|
||||
<!-- Edit Compound -->
|
||||
<div id="edit_compound_structure_modal" class="modal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Create a Compound</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Edit a Compound Structure.</p>
|
||||
<form id="edit-compound-structure-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||
{% csrf_token %}
|
||||
<p>
|
||||
<label for="compound-structure-name">Name</label>
|
||||
<input id="compound-structure-name" class="form-control" name="compound-structure-name" value="{{ structure.name }}">
|
||||
</p>
|
||||
<p>
|
||||
<label for="compound-structure-description">Description</label>
|
||||
<input id="compound-structure-description" type="text" class="form-control"
|
||||
value="{{ structure.description }}" name="compound-structure-description">
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="edit-compound-structure-modal-submit">Create</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
$('#edit-compound-structure-modal-submit').click(function(e){
|
||||
e.preventDefault();
|
||||
$('#edit-compound-structure-modal-form').submit();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
0
templates/modals/objects/edit_group_modal.html
Normal file
0
templates/modals/objects/edit_group_modal.html
Normal file
44
templates/modals/objects/edit_package_modal.html
Normal file
44
templates/modals/objects/edit_package_modal.html
Normal file
@ -0,0 +1,44 @@
|
||||
{% load static %}
|
||||
<!-- Edit Package -->
|
||||
<div id="edit_package_modal" class="modal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Create a Package</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Edit a Package.</p>
|
||||
<form id="edit-package-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||
{% csrf_token %}
|
||||
<p>
|
||||
<label for="package-name">Name</label>
|
||||
<input id="package-name" class="form-control" name="package-name" value="{{ package.name}}">
|
||||
</p>
|
||||
<p>
|
||||
<label for="package-description">Description</label>
|
||||
<input id="package-description" type="text" class="form-control"
|
||||
value="{{ package.description }}"
|
||||
name="package-description">
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="edit-package-modal-submit">Update</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
$('#edit-package-modal-submit').click(function(e){
|
||||
e.preventDefault();
|
||||
$('#edit-package-modal-form').submit();
|
||||
});
|
||||
|
||||
})
|
||||
</script>
|
||||
46
templates/modals/objects/edit_password_modal.html
Normal file
46
templates/modals/objects/edit_password_modal.html
Normal file
@ -0,0 +1,46 @@
|
||||
{% load static %}
|
||||
<!-- Edit Package -->
|
||||
<div id="edit_password_modal" class="modal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Update your Password</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>To change your password please fill out the following inputs</p>
|
||||
<form id="edit-password-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||
{% csrf_token %}
|
||||
<p>
|
||||
<label for="old-password">Old Password</label>
|
||||
<input id="old-password" class="form-control" name="old-password" type="password" autocomplete="current-password">
|
||||
</p>
|
||||
<p>
|
||||
<label for="new-password">New Password</label>
|
||||
<input id="new-password" class="form-control" name="new-password" type="password", autocomplete="new-password">
|
||||
</p>
|
||||
<p>
|
||||
<label for="new-password-repeat">Repeat New Password</label>
|
||||
<input id="new-password-repeat" class="form-control" name="new-password-repeat" type="password" autocomplete="new-password">
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="edit-password-modal-submit">Update</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
$('#edit-password-modal-submit').click(function(e){
|
||||
e.preventDefault();
|
||||
$('#edit-password-modal-form').submit();
|
||||
});
|
||||
|
||||
})
|
||||
</script>
|
||||
106
templates/modals/objects/edit_prediction_setting_modal.html
Normal file
106
templates/modals/objects/edit_prediction_setting_modal.html
Normal file
@ -0,0 +1,106 @@
|
||||
{% load static %}
|
||||
<!-- Edit Package -->
|
||||
<div id="update_prediction_settings_modal" class="modal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Update Prediction Setting</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>To update your prediction setting modify parameters in the form below und click "Update"</p>
|
||||
<form id="edit-prediction-setting-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||
{% csrf_token %}
|
||||
<div id="prediction-setting" class="panel-collapse collapse in">
|
||||
<div class="panel-body list-group-item">
|
||||
|
||||
<table class="table table-bordered table-hover">
|
||||
<tr style="background-color: rgba(0, 0, 0, 0.08);">
|
||||
<th scope="col" width="20%">Parameter</th>
|
||||
<th scope="col" width="80%">Value</th>
|
||||
</tr>
|
||||
<tbody>
|
||||
{% if 'model' in user.prediction_settings %}
|
||||
<tr>
|
||||
<td width="20%">Model</td>
|
||||
<td width="80%">
|
||||
<table width="100%" class="table table-bordered table-hover">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<select id="model" name="model" class="form-control" data-width='100%'>
|
||||
{% for m in models %}
|
||||
<option value="{{ m.id }}" {% if user.prediction_settings.model.url == m.url %}selected{% endif %}>{{ m.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
{% for k, v in user.prediction_settings.model_parameters.items %}
|
||||
<tr>
|
||||
<th width="20%">Model Parameter</th>
|
||||
<th width="80%">Parameter Value</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%">
|
||||
{% if k == 'threshold' %}
|
||||
Threshold
|
||||
{% endif %}
|
||||
</td>
|
||||
<td width="80%">
|
||||
{% if k == 'threshold' %}
|
||||
<input type="number" class="form-control" name="{{k}}" value="{{v}}"
|
||||
min="0" max="1" step="0.05">
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% for k, v in user.prediction_settings.truncator.items %}
|
||||
<tr>
|
||||
<td><p>
|
||||
{% if k == 'max_nodes' %}
|
||||
Max Nodes
|
||||
{% elif k == 'max_depth' %}
|
||||
Max Depth
|
||||
{% endif %}
|
||||
</p></td>
|
||||
<td><p>
|
||||
{% if k == 'max_nodes' %}
|
||||
<input type="number" class="form-control" name="{{k}}" value="{{v}}" min="1"
|
||||
max="50" step="1">
|
||||
{% elif k == 'max_depth' %}
|
||||
<input type="number" class="form-control" name="{{k}}" value="{{v}}" min="1"
|
||||
max="8" step="1">
|
||||
{% endif %}
|
||||
</p></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="edit-prediction-setting-modal-submit">Update</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
$('#edit-prediction-setting-modal-submit').click(function(e){
|
||||
e.preventDefault();
|
||||
$('#edit-prediction-setting-modal-form').submit();
|
||||
});
|
||||
|
||||
})
|
||||
</script>
|
||||
45
templates/modals/objects/edit_reaction_modal.html
Normal file
45
templates/modals/objects/edit_reaction_modal.html
Normal file
@ -0,0 +1,45 @@
|
||||
{% load static %}
|
||||
<!-- Edit Reaction -->
|
||||
<div id="edit_reaction_modal" class="modal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h3 class="modal-title">Update Reaction</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- <p>Edit a Reaction.</p>-->
|
||||
<form id="edit-reaction-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||
{% csrf_token %}
|
||||
<p>
|
||||
<label for="reaction-name">Name</label>
|
||||
<input id="reaction-name" class="form-control" name="reaction-name" value="{{ reaction.name }}">
|
||||
</p>
|
||||
<p>
|
||||
<label for="reaction-description">Description</label>
|
||||
<input id="reaction-description" type="text" class="form-control"
|
||||
value="{{ reaction.description }}" name="reaction-description">
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="edit-reaction-modal-submit">Update</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
$('#edit-reaction-modal-submit').click(function(e){
|
||||
e.preventDefault();
|
||||
$('#edit-reaction-modal-form').submit();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
0
templates/modals/objects/edit_rule_modal.html
Normal file
0
templates/modals/objects/edit_rule_modal.html
Normal file
61
templates/modals/objects/edit_user_modal.html
Normal file
61
templates/modals/objects/edit_user_modal.html
Normal file
@ -0,0 +1,61 @@
|
||||
{% load static %}
|
||||
<!-- Edit User -->
|
||||
<div id="edit_user_modal" class="modal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Update User Defaults</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Edit User Defaults.</p>
|
||||
<form id="edit-user-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||
{% csrf_token %}
|
||||
<p>
|
||||
<label for="default-package">Default Package</label>
|
||||
<select id="default-package" name="default-package" class="form-control" data-width='100%'>
|
||||
<option disabled>Select a Package</option>
|
||||
{% for p in meta.writeable_packages %}
|
||||
<option value="{{ p.url }}" {% if p.id == meta.user.default_package.id %}selected{% endif %}>{{ p.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<label for="default-group">Default Group</label>
|
||||
<select id="default-group" name="default-group" class="form-control" data-width='100%'>
|
||||
<option disabled>Select a Group</option>
|
||||
{% for g in meta.available_groups %}
|
||||
<option value="{{ g.url }}" {% if g.id == meta.user.default_group.id %}selected{% endif %}>{{ g.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<label for="default-prediction-setting">Default Prediction Setting</label>
|
||||
<select id="default-prediction-setting" name="default-prediction-setting" class="form-control" data-width='100%'>
|
||||
<option disabled>Select a Setting</option>
|
||||
{% for s in meta.available_settings %}
|
||||
<option value="{{ s.url }}" {% if s.id == meta.user.default_setting.id %}selected{% endif %}>{{ s.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="edit-user-modal-submit">Update</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
$('#edit-user-modal-submit').click(function(e){
|
||||
e.preventDefault();
|
||||
$('#edit-user-modal-form').submit();
|
||||
});
|
||||
|
||||
})
|
||||
</script>
|
||||
92
templates/modals/objects/manage_api_token_modal.html
Normal file
92
templates/modals/objects/manage_api_token_modal.html
Normal file
@ -0,0 +1,92 @@
|
||||
<div class="modal fade"
|
||||
tabindex="-1"
|
||||
id="manage_api_token_modal"
|
||||
role="dialog"
|
||||
aria-labelledby="manage_api_token_modal"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button"
|
||||
class="close"
|
||||
data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
<span class="sr-only">Close</span>
|
||||
</button>
|
||||
<h3 class="modal-title">Manage API Token</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Requesting a Token will invalidate all potential existing tokens. The new token will only be shown once, so ensure to store it in secure place</p>
|
||||
<form id="request_api_token_form"
|
||||
accept-charset="UTF-8"
|
||||
action=""
|
||||
data-remote="true"
|
||||
method="post">
|
||||
{% csrf_token %}
|
||||
<p>
|
||||
<label for="token-name">Name</label>
|
||||
<input type="text" id="token-name" class="form-control" name="name" placeholder="Generic Token for {{ meta.user.username }}"/>
|
||||
<label for="valid-for">Valid for (in days)</label>
|
||||
<input type="number" id="valid-for" class="form-control" name="valid-for" value="90"/>
|
||||
<input type="hidden" name="hidden" value="request-api-token">
|
||||
</p>
|
||||
</form>
|
||||
<div id="new-token">
|
||||
<pre id="new-token-pre"></pre>
|
||||
</div>
|
||||
<div id="existing-tokens">
|
||||
{% for t in tokens %}
|
||||
<form id="delete-token-{{ forloop.counter0 }}" accept-charset="UTF-8" action="{{ meta.user.url }}" data-remote="true" method="post">
|
||||
{% csrf_token %}
|
||||
<div class="input-group">
|
||||
<input type="hidden" name="hidden" value="delete">
|
||||
<input type="hidden" name="token-id" value="{{ t.pk }}">
|
||||
<input type="text" class="form-control" value="{{ t.name }}" disabled>
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" class="btn btn-danger">Delete</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a id="manage_api_token_form_submit"
|
||||
class="btn btn-primary"
|
||||
href="#">Submit</a>
|
||||
<button type="button"
|
||||
class="btn btn-default"
|
||||
data-dismiss="modal">Cancel
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
$('#new-token').hide()
|
||||
|
||||
$('#manage_api_token_form_submit').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const formData = $('#request_api_token_form').serialize();
|
||||
console.log(formData)
|
||||
$.post('', formData, function(response) {
|
||||
$('#new-token-pre').text(response.raw_token);
|
||||
$('#new-token').show();
|
||||
});
|
||||
});
|
||||
|
||||
// Select all elements that start with 'delete-token-'
|
||||
$("[id^='delete-token-']").on("submit", function(e) {
|
||||
e.preventDefault();
|
||||
const formData = $(this).serialize();
|
||||
const form = $(this);
|
||||
$.post(this.action, formData, function(response) {
|
||||
console.log(this);
|
||||
form.remove();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user