* Implement Titan Tokens clientside

* Titan Tokens can be modified in the admin panel
This commit is contained in:
Jeremy "EndenDragon" Zhang
2017-08-13 18:10:03 -07:00
committed by GitHub
parent d363b66799
commit 8bc95f7b0e
16 changed files with 618 additions and 10 deletions

View File

@ -20,6 +20,13 @@
<a class="waves-effect waves-light btn" href="{{ url_for('admin.guilds') }}">Manage</a>
</div>
</div>
<div class="col s12">
<div class="card-panel indigo lighten-5 z-depth-3 hoverable black-text">
<h4>Titan Tokens</h4>
<p class="flow-text">View transactions and modify Titan Tokens per user.</p>
<a class="waves-effect waves-light btn" href="{{ url_for('admin.manage_titan_tokens') }}">Manage</a>
</div>
</div>
<div class="col s12">
<div class="card-panel indigo lighten-5 z-depth-3 hoverable black-text">
<h4>Run a Database Cleanup</h4>

View File

@ -0,0 +1,105 @@
{% extends 'site_layout.html.j2' %}
{% set title="Editing User Titan Tokens" %}
{% block content %}
<h1>Administrating Titan Tokens</h1>
<div class="row">
<div class="col s12">
<div class="card-panel indigo lighten-5 z-depth-3 hoverable black-text">
<p class="flow-text">New Entry</p>
<table class="bordered striped">
<thead>
<tr>
<th>User ID</th>
<th>Starting Balance</th>
<th>Submit</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="input-field inline">
<input id="new_user_id" placeholder="User ID">
</div>
</td>
<td>
<div class="input-field inline">
<input id="new_user_token" placeholder="Starting Balance" type="number">
</div>
</td>
<td>
<a class="waves-effect waves-light btn" id="new_submit">Submit</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col s12">
<div class="card-panel indigo lighten-5 z-depth-3 hoverable black-text">
<p class="flow-text">View Transactions and Modify User Tokens</p>
<ul class="collapsible" data-collapsible="accordion">
{% for don in donators %}
<li>
<div class="collapsible-header">{{ don.user_id }}</div>
<div class="collapsible-body">
<table class="bordered striped">
<thead>
<tr>
<th>Modify Amount</th>
<th>Submit</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="input-field inline">
<input placeholder="Modify Amount" type="number" id="input_{{ don.user_id }}">
</div>
<p>(Place a subtract sign in the front to remove tokens. Otherwise, it will add the amount)</p>
</td>
<td>
<a class="waves-effect waves-light btn" onclick="submit_modify_user('{{ don.user_id }}')">Submit</a>
</td>
</tr>
</tbody>
</table>
<h4>Balance: <strong>{{ don.tokens }}</strong> Tokens</h4>
<table class="striped">
<thead>
<tr>
<th>Trans #</th>
<th>Timestamp</th>
<th>Action</th>
<th>Change</th>
<th>Starting Bal</th>
<th>Ending Bal</th>
</tr>
</thead>
<tbody>
{% for trans in don.transactions %}
<tr>
<td>{{ trans.id }}</td>
<td>{{ trans.timestamp }}</td>
<td>{{ trans.action }}.</td>
<td>{{ trans.net_tokens }}</td>
<td>{{ trans.start_tokens }}</td>
<td>{{ trans.end_tokens }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
{% endblock %}
{% block script %}
<script type="text/javascript" src="{{ url_for('static', filename='js/admin_token_transactions.js') }}"></script>
{% endblock %}

View File

@ -2,7 +2,6 @@
{% set title="Dashboard" %}
{% block content %}
{% include 'patreon_banner.html.j2' %}
<h1>User Dashboard</h1>
<p class="flow-text">Select a server to configure Titan Embeds.</p>
<p>*List missing some servers? It's because you must have either <strong>Manage Server</strong>, <strong>Kick Members</strong>, or <strong>Ban Members</strong> permissions to modify embed settings.</p>
@ -61,4 +60,17 @@
{% endfor %}
</div>
{% endif %}
{% endblock %}
<hr>
<div class="row">
<div class="col s12">
<div class="card-panel indigo lighten-5 z-depth-3 hoverable black-text">
<h4>Donations!</h4>
<p class="flow-text">Would you like to support the Titan Embeds project?</p>
<p>You currently have <strong>{{ tokens }}</strong> Titan Tokens.</p>
<a class="waves-effect waves-light btn" href="{{ url_for('user.donate_get') }}">Donate!!</a>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,51 @@
{% extends 'site_layout.html.j2' %}
{% set title="Donate" %}
{% block content %}
<h1>Donate and Support Titan Embeds</h1>
<p class="flow-text">Contributing to the Titan project has never been so easy! Donate to support our project development and hosting.</p>
<div class="row">
<div class="col s12">
<div class="card-panel indigo lighten-5 z-depth-3 hoverable black-text">
<h4>The Name-Your-Price Tool</h4>
<p class="flow-text">Currently if you donate, we cannot give much back in return, yet. However, we do have some donatator features up our sleeves and will be implemented.</p>
<p class="flow-text">For now, you will receive <strong>Titan Tokens&trade;</strong> (to be spent on donator features) and a <strong>supporter role</strong> on our support server.</p>
<p class="range-field">
<input type="range" id="token-slider" min="1" max="100" value="5" />
</p>
<p class="flow-text">$<span id="money-display">5</span> for <strong><span id="token-display">500</span> tokens</strong>!</p>
<a class="waves-effect waves-light btn" id="donate-btn">Donate</a>
</div>
</div>
</div>
{% endblock %}
{% block script %}
<script type="text/javascript" src="{{ url_for('static', filename='js/donate.js') }}"></script>
{% endblock %}
{% block additional_head_elements %}
<style>
input[type=range]::-webkit-slider-thumb {
background-color: #303f9f;
}
input[type=range]::-moz-range-thumb {
background-color: #303f9f;
}
input[type=range]::-ms-thumb {
background-color: #303f9f;
}
/***** These are to edit the thumb and the text inside the thumb *****/
input[type=range] + .thumb {
background-color: #dedede;
}
input[type=range] + .thumb.active .value {
font-size: 12pt;
color: #303f9f;
}
input[type=range] + .thumb.active .value::before {
content: "$";
}
</style>
{% endblock %}

View File

@ -0,0 +1,18 @@
{% extends 'site_layout.html.j2' %}
{% set title="Thanks for Donating" %}
{% block content %}
<h1>Thank you for Donating and Supporting the Titan Embeds project!</h1>
<div class="row">
<div class="col s12">
<div class="card-panel indigo lighten-5 z-depth-3 hoverable black-text">
<h4>You're officially one step closer to becoming a True Titan!</h4>
<p class="flow-text">You now have <strong>{{ tokens }}</strong> tokens!</p>
<p>Please visit our support server and contact a True Titan (Administrators Role) to claim your Supporter role, if you haven't done so already. Mention the transaction ID of <strong>{{ transaction }}</strong>.</p>
<a class="waves-effect waves-light btn" href="https://discord.io/Titan" target="_blank">Support Server</a>
<p><em>Have a nice day!</em></p>
</div>
</div>
</div>
{% endblock %}

View File

@ -2,7 +2,6 @@
{% set title="Index" %}
{% block content %}
{% include 'patreon_banner.html.j2' %}
<h1 class="center-align">Embed Discord like a<br><strong>true Titan</strong></h1>
<p class="flow-text center-align">Add <strong>Titan</strong> to your discord server to create your own personalized chat embed!</p>
<a class="waves-effect waves-light btn btn-large center_content" href="{{ url_for('user.dashboard') }}">Start here!</a>

View File

@ -1,3 +0,0 @@
<div class="collection">
<a href="https://www.patreon.com/TitanEmbeds" class="collection-item"><i class="material-icons">monetization_on</i> We have decided to open a Patreon page to help fund the Titan. If you are interested and would like to help, please check it out!</a>
</div>