improve calendar performance
This commit is contained in:
parent
6ec00af32a
commit
02f90ced15
6 changed files with 30 additions and 7 deletions
|
@ -330,7 +330,7 @@ def discover(request):
|
||||||
]
|
]
|
||||||
episodes = PodcastEpisode.objects.filter(program_id__in=podcast_ids).order_by(
|
episodes = PodcastEpisode.objects.filter(program_id__in=podcast_ids).order_by(
|
||||||
"-pub_date"
|
"-pub_date"
|
||||||
)[:10]
|
)[:5]
|
||||||
gallery_list.insert(
|
gallery_list.insert(
|
||||||
0,
|
0,
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
var current_date = new Date();
|
var current_date = new Date();
|
||||||
var start_date = new Date();
|
var start_date = new Date();
|
||||||
start_date.setMonth(end_date.getMonth() - 12);
|
start_date.setMonth(end_date.getMonth() - 12);
|
||||||
|
end_year = end_date.getFullYear()
|
||||||
|
|
||||||
var start_weekday = settings.start_monday === true?1:0;
|
var start_weekday = settings.start_monday === true?1:0;
|
||||||
for (var i = 0; i < 7; i++) {
|
for (var i = 0; i < 7; i++) {
|
||||||
|
@ -148,7 +149,7 @@
|
||||||
// Add labels for Months
|
// Add labels for Months
|
||||||
for (var i = 0; i < month_position.length; i++) {
|
for (var i = 0; i < month_position.length; i++) {
|
||||||
var item = month_position[i];
|
var item = month_position[i];
|
||||||
var month_name = settings.month_names[item.month_index];
|
var month_name = item.month_index ? settings.month_names[item.month_index] : end_year;
|
||||||
loop_html += '<text x="' + item.x + '" y="-5" class="month">' + month_name + '</text>';
|
loop_html += '<text x="' + item.x + '" y="-5" class="month">' + month_name + '</text>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +168,7 @@
|
||||||
// Fixed size with width= 721 and height = 110
|
// Fixed size with width= 721 and height = 110
|
||||||
var wire_html =
|
var wire_html =
|
||||||
'<svg width="721" height="110">' +
|
'<svg width="721" height="110">' +
|
||||||
'<g transform="translate(25, 20)">' +
|
'<g transform="translate(0, 20)">' +
|
||||||
loop_html +
|
loop_html +
|
||||||
'</g>' + '"Your browser does not support inline SVG."' +
|
'</g>' + '"Your browser does not support inline SVG."' +
|
||||||
'</svg>';
|
'</svg>';
|
||||||
|
@ -231,7 +232,7 @@
|
||||||
day_names: ['M', 'W', 'F', 'S'],
|
day_names: ['M', 'W', 'F', 'S'],
|
||||||
start_monday: true,
|
start_monday: true,
|
||||||
always_show_tooltip: false,
|
always_show_tooltip: false,
|
||||||
stylize_today: true,
|
stylize_today: false,
|
||||||
final_date: new Date().toISOString().slice(0, 10),
|
final_date: new Date().toISOString().slice(0, 10),
|
||||||
tooltip_style: 'default', // or 'custom'
|
tooltip_style: 'default', // or 'custom'
|
||||||
data: []
|
data: []
|
||||||
|
|
|
@ -560,13 +560,13 @@ $mark-review-padding-wider: 6px 0
|
||||||
|
|
||||||
|
|
||||||
.calendar_view
|
.calendar_view
|
||||||
left: -20px
|
|
||||||
position: relative
|
position: relative
|
||||||
|
|
||||||
// Medium devices (tablets, 768px and up)
|
// Medium devices (tablets, 768px and up)
|
||||||
@media (max-width: $medium-devices)
|
@media (max-width: $medium-devices)
|
||||||
.calendar_view
|
.calendar_view
|
||||||
overflow-x: scroll
|
overflow-x: scroll
|
||||||
|
|
||||||
// Large devices (desktops, 992px and up)
|
// Large devices (desktops, 992px and up)
|
||||||
@media (max-width: $large-devices)
|
@media (max-width: $large-devices)
|
||||||
.main-section-wrapper
|
.main-section-wrapper
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 3.2.18 on 2023-04-21 22:23
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("journal", "0009_comment_focus_item"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddIndex(
|
||||||
|
model_name="shelfmember",
|
||||||
|
index=models.Index(
|
||||||
|
fields=["parent_id", "visibility", "created_time"],
|
||||||
|
name="journal_she_parent__9da946_idx",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
|
@ -547,6 +547,9 @@ class ShelfMember(ListMember):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = [["owner", "item"]]
|
unique_together = [["owner", "item"]]
|
||||||
|
indexes = [
|
||||||
|
models.Index(fields=["parent_id", "visibility", "created_time"]),
|
||||||
|
]
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def mark(self):
|
def mark(self):
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
<div class="main-section-wrapper sortable">
|
<div class="main-section-wrapper sortable">
|
||||||
|
|
||||||
{% if request.user.is_staff %}
|
{% if request.user.is_authenticated %}
|
||||||
<div class="entity-sort" id="calendar_grid">
|
<div class="entity-sort" id="calendar_grid">
|
||||||
<h5 class="entity-sort__label">书影音日历</h5>
|
<h5 class="entity-sort__label">书影音日历</h5>
|
||||||
<div class="calendar_view" hx-get="{% url 'journal:user_calendar_data' user.mastodon_username %}" hx-trigger="load" hx-swap="innerHTML">
|
<div class="calendar_view" hx-get="{% url 'journal:user_calendar_data' user.mastodon_username %}" hx-trigger="load" hx-swap="innerHTML">
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
data: $(evt.detail.elt).text(),
|
data: $(evt.detail.elt).text(),
|
||||||
start_monday: false,
|
start_monday: false,
|
||||||
always_show_tooltip: false,
|
always_show_tooltip: false,
|
||||||
month_names: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
|
month_names: ['2023', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
|
||||||
day_names: ['', '', ''],
|
day_names: ['', '', ''],
|
||||||
colors: {
|
colors: {
|
||||||
'default': '#eeeeee', // Default color
|
'default': '#eeeeee', // Default color
|
||||||
|
|
Loading…
Add table
Reference in a new issue