feat: Add total vote counts to governance views
- Add functionality to calculate total yes, no, and abstain votes across all proposals. This provides a summary of community voting patterns on the governance page. - Improve the user experience by displaying total vote counts prominently on the "My Votes" page. This gives users a quick overview of the overall voting results. - Enhance the "Create Proposal" page with informative guidelines and a helpful alert to guide users through the proposal creation process. This improves clarity and ensures proposals are well- structured.
This commit is contained in:
@@ -23,6 +23,57 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Info Alert -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="alert alert-info alert-dismissible fade show">
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
<h5><i class="bi bi-info-circle"></i> About Votes</h5>
|
||||
<p>Voting is a fundamental right of all token holders in our governance system. Each vote carries weight
|
||||
proportional to your token holdings, ensuring fair representation. The voting statistics below show the
|
||||
community's collective decision-making across all proposals.</p>
|
||||
<div class="mt-2">
|
||||
<a href="/governance/voting-guide" class="btn btn-sm btn-outline-primary"><i
|
||||
class="bi bi-check2-square"></i> Voting Guide</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Voting Stats -->
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-4 mb-3">
|
||||
<div class="card text-white bg-success h-100">
|
||||
<div class="card-body text-center">
|
||||
<h5 class="card-title">Yes Votes</h5>
|
||||
<p class="display-4">
|
||||
{{ total_yes_votes }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 mb-3">
|
||||
<div class="card text-white bg-danger h-100">
|
||||
<div class="card-body text-center">
|
||||
<h5 class="card-title">No Votes</h5>
|
||||
<p class="display-4">
|
||||
{{ total_no_votes }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 mb-3">
|
||||
<div class="card text-white bg-secondary h-100">
|
||||
<div class="card-body text-center">
|
||||
<h5 class="card-title">Abstain Votes</h5>
|
||||
<p class="display-4">
|
||||
{{ total_abstain_votes }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- My Votes List -->
|
||||
<div class="row mb-4">
|
||||
<div class="col-12">
|
||||
@@ -82,57 +133,5 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Voting Stats -->
|
||||
{% if votes | length > 0 %}
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-4 mb-3">
|
||||
<div class="card text-white bg-success h-100">
|
||||
<div class="card-body text-center">
|
||||
<h5 class="card-title">Yes Votes</h5>
|
||||
<p class="display-4">
|
||||
{% set yes_count = 0 %}
|
||||
{% for item in votes %}{% set vote = item.0 %}{% set proposal = item.1 %}
|
||||
{% if vote.vote_type == 'Yes' %}
|
||||
{% set yes_count = yes_count + 1 %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ yes_count }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 mb-3">
|
||||
<div class="card text-white bg-danger h-100">
|
||||
<div class="card-body text-center">
|
||||
<h5 class="card-title">No Votes</h5>
|
||||
<p class="display-4">
|
||||
{% set no_count = 0 %}
|
||||
{% for item in votes %}{% set vote = item.0 %}{% set proposal = item.1 %}
|
||||
{% if vote.vote_type == 'No' %}
|
||||
{% set no_count = no_count + 1 %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ no_count }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 mb-3">
|
||||
<div class="card text-white bg-secondary h-100">
|
||||
<div class="card-body text-center">
|
||||
<h5 class="card-title">Abstain Votes</h5>
|
||||
<p class="display-4">
|
||||
{% set abstain_count = 0 %}
|
||||
{% for item in votes %}{% set vote = item.0 %}{% set proposal = item.1 %}
|
||||
{% if vote.vote_type == 'Abstain' %}
|
||||
{% set abstain_count = abstain_count + 1 %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ abstain_count }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
Reference in New Issue
Block a user