Merge branch 'main' into bookwyrm-groups
This commit is contained in:
commit
73a8f89bee
27 changed files with 390 additions and 251 deletions
|
@ -9,26 +9,26 @@
|
|||
|
||||
{% block panel %}
|
||||
|
||||
<div class="columns block has-text-centered">
|
||||
<div class="column is-3">
|
||||
<div class="columns block has-text-centered is-mobile is-multiline">
|
||||
<div class="column is-3-desktop is-6-mobile">
|
||||
<div class="notification">
|
||||
<h3>{% trans "Total users" %}</h3>
|
||||
<p class="title is-5">{{ users|intcomma }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-3">
|
||||
<div class="column is-3-desktop is-6-mobile">
|
||||
<div class="notification">
|
||||
<h3>{% trans "Active this month" %}</h3>
|
||||
<p class="title is-5">{{ active_users|intcomma }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-3">
|
||||
<div class="column is-3-desktop is-6-mobile">
|
||||
<div class="notification">
|
||||
<h3>{% trans "Statuses" %}</h3>
|
||||
<p class="title is-5">{{ statuses|intcomma }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-3">
|
||||
<div class="column is-3-desktop is-6-mobile">
|
||||
<div class="notification">
|
||||
<h3>{% trans "Works" %}</h3>
|
||||
<p class="title is-5">{{ works|intcomma }}</p>
|
||||
|
@ -64,7 +64,7 @@
|
|||
<div class="block content">
|
||||
<h2>{% trans "Instance Activity" %}</h2>
|
||||
|
||||
<form method="get" action="{% url 'settings-dashboard' %}" class="notification has-background-white-bis">
|
||||
<form method="get" action="{% url 'settings-dashboard' %}" class="notification has-background-white-bis scroll-x">
|
||||
<div class="is-flex is-align-items-flex-end">
|
||||
<div class="ml-1 mr-1">
|
||||
<label class="label" for="id_start">
|
||||
|
@ -95,19 +95,31 @@
|
|||
</div>
|
||||
</form>
|
||||
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<h3>{% trans "User signup activity" %}</h3>
|
||||
<div class="columns is-multiline">
|
||||
<div class="column is-half">
|
||||
<h3>{% trans "Total users" %}</h3>
|
||||
<div class="box">
|
||||
<canvas id="user_stats"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="column is-half">
|
||||
<h3>{% trans "User signup activity" %}</h3>
|
||||
<div class="box">
|
||||
<canvas id="register_stats"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-half">
|
||||
<h3>{% trans "Status activity" %}</h3>
|
||||
<div class="box">
|
||||
<canvas id="status_stats"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-half">
|
||||
<h3>{% trans "Works created" %}</h3>
|
||||
<div class="box">
|
||||
<canvas id="works_stats"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -115,6 +127,8 @@
|
|||
|
||||
{% block scripts %}
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.5.1/dist/chart.min.js"></script>
|
||||
{% include 'settings/dashboard/dashboard_user_chart.html' %}
|
||||
{% include 'settings/dashboard/dashboard_status_chart.html' %}
|
||||
{% include 'settings/dashboard/user_chart.html' %}
|
||||
{% include 'settings/dashboard/status_chart.html' %}
|
||||
{% include 'settings/dashboard/registration_chart.html' %}
|
||||
{% include 'settings/dashboard/works_chart.html' %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
{% load i18n %}
|
||||
<script>
|
||||
const status_labels = [{% for label in status_stats.labels %}"{{ label }}",{% endfor %}];
|
||||
const status_data = {
|
||||
labels: status_labels,
|
||||
datasets: [{
|
||||
label: '{% trans "Statuses posted" %}',
|
||||
backgroundColor: 'rgb(255, 99, 132)',
|
||||
borderColor: 'rgb(255, 99, 132)',
|
||||
data: {{ status_stats.total }},
|
||||
}]
|
||||
};
|
||||
// === include 'setup' then 'config' above ===
|
||||
|
||||
const status_config = {
|
||||
type: 'bar',
|
||||
data: status_data,
|
||||
options: {}
|
||||
};
|
||||
|
||||
var statusStats = new Chart(
|
||||
document.getElementById('status_stats'),
|
||||
status_config
|
||||
);
|
||||
</script>
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
{% load i18n %}
|
||||
<script>
|
||||
const labels = [{% for label in user_stats.labels %}"{{ label }}",{% endfor %}];
|
||||
const data = {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: '{% trans "Total" %}',
|
||||
backgroundColor: 'rgb(255, 99, 132)',
|
||||
borderColor: 'rgb(255, 99, 132)',
|
||||
data: {{ user_stats.total }},
|
||||
}, {
|
||||
label: '{% trans "Active this month" %}',
|
||||
backgroundColor: 'rgb(75, 192, 192)',
|
||||
borderColor: 'rgb(75, 192, 192)',
|
||||
data: {{ user_stats.active }},
|
||||
}]
|
||||
};
|
||||
|
||||
const config = {
|
||||
type: 'line',
|
||||
data: data,
|
||||
options: {}
|
||||
};
|
||||
|
||||
var userStats = new Chart(
|
||||
document.getElementById('user_stats'),
|
||||
config
|
||||
);
|
||||
</script>
|
|
@ -0,0 +1,19 @@
|
|||
{% load i18n %}
|
||||
<script>
|
||||
var registerStats = new Chart(
|
||||
document.getElementById('register_stats'),
|
||||
{
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: [{% for label in register_stats.labels %}"{{ label }}",{% endfor %}],
|
||||
datasets: [{
|
||||
label: '{% trans "Registrations" %}',
|
||||
backgroundColor: 'hsl(171, 100%, 41%)',
|
||||
borderColor: 'hsl(171, 100%, 41%)',
|
||||
data: {{ register_stats.total }},
|
||||
}]
|
||||
},
|
||||
options: {}
|
||||
}
|
||||
);
|
||||
</script>
|
21
bookwyrm/templates/settings/dashboard/status_chart.html
Normal file
21
bookwyrm/templates/settings/dashboard/status_chart.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
{% load i18n %}
|
||||
<script>
|
||||
|
||||
var statusStats = new Chart(
|
||||
document.getElementById('status_stats'),
|
||||
{
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: [{% for label in status_stats.labels %}"{{ label }}",{% endfor %}],
|
||||
datasets: [{
|
||||
label: '{% trans "Statuses posted" %}',
|
||||
backgroundColor: 'hsl(141, 71%, 48%)',
|
||||
borderColor: 'hsl(141, 71%, 48%)',
|
||||
data: {{ status_stats.total }},
|
||||
}]
|
||||
},
|
||||
options: {}
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
25
bookwyrm/templates/settings/dashboard/user_chart.html
Normal file
25
bookwyrm/templates/settings/dashboard/user_chart.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
{% load i18n %}
|
||||
<script>
|
||||
|
||||
var userStats = new Chart(
|
||||
document.getElementById('user_stats'),
|
||||
{
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: [{% for label in user_stats.labels %}"{{ label }}",{% endfor %}],
|
||||
datasets: [{
|
||||
label: '{% trans "Total" %}',
|
||||
backgroundColor: 'hsl(217, 71%, 53%)',
|
||||
borderColor: 'hsl(217, 71%, 53%)',
|
||||
data: {{ user_stats.total }},
|
||||
}, {
|
||||
label: '{% trans "Active this month" %}',
|
||||
backgroundColor: 'hsl(171, 100%, 41%)',
|
||||
borderColor: 'hsl(171, 100%, 41%)',
|
||||
data: {{ user_stats.active }},
|
||||
}]
|
||||
},
|
||||
options: {}
|
||||
}
|
||||
);
|
||||
</script>
|
21
bookwyrm/templates/settings/dashboard/works_chart.html
Normal file
21
bookwyrm/templates/settings/dashboard/works_chart.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
{% load i18n %}
|
||||
<script>
|
||||
|
||||
var worksStats = new Chart(
|
||||
document.getElementById('works_stats'),
|
||||
{
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: [{% for label in works_stats.labels %}"{{ label }}",{% endfor %}],
|
||||
datasets: [{
|
||||
label: '{% trans "Works" %}',
|
||||
backgroundColor: 'hsl(204, 86%, 53%)',
|
||||
borderColor: 'hsl(204, 86%, 53%)',
|
||||
data: {{ works_stats.total }},
|
||||
}]
|
||||
},
|
||||
options: {}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{% load i18n %}{% load humanize %}{% load utilities %}
|
||||
|
||||
{% blocktrans trimmed with title=book|book_title path=book.remote_id display_rating=rating|floatformat:"0" count counter=rating|add:0 %}
|
||||
{% blocktrans trimmed with title=book|book_title path=book.remote_id display_rating=rating|floatformat:"-1" count counter=rating|add:0 %}
|
||||
rated <em><a href="{{ path }}">{{ title }}</a></em>: {{ display_rating }} star
|
||||
{% plural %}
|
||||
rated <em><a href="{{ path }}">{{ title }}</a></em>: {{ display_rating }} stars
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% load i18n %}
|
||||
{% if rating %}
|
||||
|
||||
{% blocktrans with book_title=book.title|safe display_rating=rating|floatformat:"0" review_title=name|safe count counter=rating %}Review of "{{ book_title }}" ({{ display_rating }} star): {{ review_title }}{% plural %}Review of "{{ book_title }}" ({{ display_rating }} stars): {{ review_title }}{% endblocktrans %}
|
||||
{% blocktrans with book_title=book.title|safe display_rating=rating|floatformat:"-1" review_title=name|safe count counter=rating %}Review of "{{ book_title }}" ({{ display_rating }} star): {{ review_title }}{% plural %}Review of "{{ book_title }}" ({{ display_rating }} stars): {{ review_title }}{% endblocktrans %}
|
||||
|
||||
{% else %}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue