-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add name management functionality for Characters and Pets #5
Closed
Closed
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
{% extends "bootstrap/base.html" %} | ||
{% block title %}Name Approval{% endblock %} | ||
|
||
{% block navbar %} | ||
<nav class="navbar navbar-default"> | ||
<div class="container-fluid"> | ||
<div class="navbar-header"> | ||
<a class="navbar-brand" href="{{ url_for('dashboard') }}">Dashboard</a> | ||
</div> | ||
<ul class="nav navbar-nav"> | ||
</ul> | ||
<ul class="nav navbar-nav" style="float: right"> | ||
<li class="active"><a href="#">Welcome {{ current_user.username }}!</a></li> | ||
<li><a href="{{ url_for('logout') }}">Logout</a></li> | ||
</ul> | ||
</div> | ||
</nav> | ||
{% endblock navbar %}} | ||
|
||
{% block content %} | ||
{# LOGO #} | ||
<div class="container" style="margin-top: 50px"> | ||
|
||
{# Display logo #} | ||
<div style="margin-bottom: 50px"> | ||
<img | ||
src="{{ url_for('static', filename=resources.LOGO) }}" | ||
class="center-block img-responsive mx-auto d-block" | ||
alt="Logo" | ||
width="100" | ||
height="100" | ||
> | ||
</div> | ||
|
||
</div> | ||
|
||
{# Key creation #} | ||
<div class="container"> | ||
<div class="text-center"> | ||
<h3>Name Approval</h3> | ||
</div> | ||
|
||
<div class="col-lg-3"> | ||
</div> | ||
<div class="col-lg-6"> | ||
|
||
{# If the error value is set, display the error in red text #} | ||
{% if error %} | ||
<div class="alert alert-danger"> | ||
{{ error }} | ||
</div> | ||
{% endif %} | ||
|
||
{# If the message value is set, display the message in green text #} | ||
{% if message %} | ||
<div class="alert alert-success"> | ||
{{ message }} | ||
</div> | ||
{% endif %} | ||
|
||
{# If the keys value is set, create a list for each key in keys #} | ||
{% if names %} | ||
<table class="table table-striped"> | ||
<tr> | ||
<th>Character ID</th> | ||
<th>Account ID</th> | ||
<th>Current Name</th> | ||
<th>Custom Name</th> | ||
<th>Approve?</th> | ||
<th>Reject?</th> | ||
</tr> | ||
{% for name in names %} | ||
<tr> | ||
<td>{{ name.id }}</td> | ||
<td>{{ name.account_id }}</td> | ||
<td>{{ name.name }}</td> | ||
<td>{{ name.pending_name }}</td> | ||
<td><button class="btn btn-primary approvalButton" data-id="{{ name.id }}" data-pending_name="{{ name.pending_name }}">Approve</button></td> | ||
<td><button class="btn btn-warning rejectButton" data-id="{{ name.id }}" data-pending_name="{{ name.pending_name }}">Reject</button></td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
{% endif %} | ||
</div> | ||
<div class="col-lg-3"> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} | ||
|
||
{% block scripts %} | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> | ||
<script> | ||
|
||
const approvalButtons = document.querySelectorAll('.approvalButton'); | ||
|
||
for (const button of approvalButtons) { | ||
button.addEventListener('click', (event) => { | ||
$("body").load("{{ url_for('approve_names') }}", { | ||
char_id: parseInt(event.target.dataset.id), | ||
pending_name: event.target.dataset.pending_name, | ||
approved: 1, | ||
}); | ||
}); | ||
} | ||
|
||
const rejectButtons = document.querySelectorAll('.rejectButton'); | ||
|
||
for (const button of rejectButtons) { | ||
button.addEventListener('click', (event) => { | ||
$("body").load("{{ url_for('approve_names') }}", { | ||
char_id: parseInt(event.target.dataset.id), | ||
pending_name: event.target.dataset.pending_name, | ||
approved: 0, | ||
}); | ||
}); | ||
} | ||
|
||
</script> | ||
|
||
{% endblock %} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about including some default text like "No pending approvals" when there are neither pending character name nor pet name approvals?
This would make it a little bit more obvious why the page is empty.
Though I am not a member of this project, so feel free to just ignore that suggestion.