mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Small fixes (#2224)
* Replaced normal dropdowns with select2 (which will eventually replace our custom typeaheads). Still needs styling. * More css * Styling. Fixed preloading typeahead with multiple options on load. * Styling to align with typeahead tag badges. * Done with filtering story. * Fixed a bug with switching between filters. * Fixed some extra } from localization * [skip ci] Translated using Weblate (Spanish) Currently translated at 71.3% (1058 of 1483 strings) Translation: Kavita/ui Translate-URL: https://hosted.weblate.org/projects/kavita/ui/es/ * [skip ci] Translated using Weblate (Dutch) Currently translated at 59.2% (879 of 1483 strings) Translation: Kavita/ui Translate-URL: https://hosted.weblate.org/projects/kavita/ui/nl/ * Translated using Weblate (Thai) Currently translated at 100.0% (160 of 160 strings) Translation: Kavita/backend Translate-URL: https://hosted.weblate.org/projects/kavita/backend/th/ * [skip ci] Translated using Weblate (Chinese (Simplified)) Currently translated at 99.9% (1482 of 1483 strings) Translation: Kavita/ui Translate-URL: https://hosted.weblate.org/projects/kavita/ui/zh_Hans/ * [skip ci] Translated using Weblate (Chinese (Simplified)) Currently translated at 99.9% (1482 of 1483 strings) Translation: Kavita/ui Translate-URL: https://hosted.weblate.org/projects/kavita/ui/zh_Hans/ * Translated using Weblate (Chinese (Simplified)) Currently translated at 96.8% (155 of 160 strings) Translation: Kavita/backend Translate-URL: https://hosted.weblate.org/projects/kavita/backend/zh_Hans/ * Translated using Weblate (Chinese (Simplified)) Currently translated at 96.8% (155 of 160 strings) Translation: Kavita/backend Translate-URL: https://hosted.weblate.org/projects/kavita/backend/zh_Hans/ * [skip ci] Translated using Weblate (Thai) Currently translated at 27.2% (404 of 1483 strings) Translation: Kavita/ui Translate-URL: https://hosted.weblate.org/projects/kavita/ui/th/ * Translated using Weblate (Portuguese) Currently translated at 100.0% (160 of 160 strings) Translation: Kavita/backend Translate-URL: https://hosted.weblate.org/projects/kavita/backend/pt/ * [skip ci] Translated using Weblate (Portuguese) Currently translated at 55.3% (821 of 1483 strings) Translation: Kavita/ui Translate-URL: https://hosted.weblate.org/projects/kavita/ui/pt/ * [skip ci] Translated using Weblate (Japanese) Currently translated at 2.0% (30 of 1483 strings) Translation: Kavita/ui Translate-URL: https://hosted.weblate.org/projects/kavita/ui/ja/ * [skip ci] Translated using Weblate (Portuguese (Brazil)) Currently translated at 82.1% (1218 of 1483 strings) Translation: Kavita/ui Translate-URL: https://hosted.weblate.org/projects/kavita/ui/pt_BR/ * [skip ci] Translated using Weblate (Chinese (Simplified)) Currently translated at 99.9% (1482 of 1483 strings) Translation: Kavita/ui Translate-URL: https://hosted.weblate.org/projects/kavita/ui/zh_Hans/ * [skip ci] Translated using Weblate (Turkish) Currently translated at 7.6% (113 of 1483 strings) Translation: Kavita/ui Translate-URL: https://hosted.weblate.org/projects/kavita/ui/tr/ * [skip ci] Translated using Weblate (Portuguese) Currently translated at 62.7% (930 of 1483 strings) Translation: Kavita/ui Translate-URL: https://hosted.weblate.org/projects/kavita/ui/pt/ * [skip ci] Translated using Weblate (Italian) Currently translated at 26.0% (387 of 1483 strings) Translation: Kavita/ui Translate-URL: https://hosted.weblate.org/projects/kavita/ui/it/ * [skip ci] Translated using Weblate (Portuguese) Currently translated at 68.3% (1013 of 1483 strings) Translation: Kavita/ui Translate-URL: https://hosted.weblate.org/projects/kavita/ui/pt/ * Added translation using Weblate (Czech) * [skip ci] Added translation using Weblate (Czech) * Some files got left off last release * Fixed on deck prefilter * Fixed a sizing issue on list item and brought the columns in on series detail as well. --------- Co-authored-by: gallegonovato <fran-carro@hotmail.es> Co-authored-by: Hans Kalisvaart <hans.kalisvaart@gmail.com> Co-authored-by: AlienHack <the4got10@windowslive.com> Co-authored-by: 书签 <shuqian.emu@gmail.com> Co-authored-by: 周書丞 <tmrsm_chan@hotmail.com> Co-authored-by: Duarte Silva <smallflake@protonmail.com> Co-authored-by: Andre Smith <andrepsmithjr@gmail.com> Co-authored-by: Havokdan <havokdan@yahoo.com.br> Co-authored-by: xe1st <dnzkckali@gmail.com> Co-authored-by: Tomas Battistini <tomas.battistini@gmail.com> Co-authored-by: Jiří Heger <jiri.heger@gmail.com>
This commit is contained in:
parent
e1e6d676bb
commit
fc13fcff29
@ -14,6 +14,7 @@ using API.DTOs.SeriesDetail;
|
||||
using API.Entities;
|
||||
using API.Extensions;
|
||||
using API.Extensions.QueryExtensions;
|
||||
using API.Extensions.QueryExtensions.Filtering;
|
||||
using AutoMapper;
|
||||
using AutoMapper.QueryableExtensions;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
@ -389,10 +390,11 @@ public class UserRepository : IUserRepository
|
||||
.ToListAsync();
|
||||
|
||||
var queryString = filterStatement.Value.ToNormalized();
|
||||
var filterSeriesQuery = query.Join(_context.Series, b => b.SeriesId, s => s.Id, (bookmark, series) => new
|
||||
var filterSeriesQuery = query.Join(_context.Series, b => b.SeriesId, s => s.Id,
|
||||
(bookmark, series) => new BookmarkSeriesPair()
|
||||
{
|
||||
bookmark,
|
||||
series
|
||||
bookmark = bookmark,
|
||||
series = series
|
||||
});
|
||||
|
||||
switch (filterStatement.Comparison)
|
||||
@ -441,14 +443,21 @@ public class UserRepository : IUserRepository
|
||||
break;
|
||||
}
|
||||
|
||||
query = filterSeriesQuery.Select(o => o.bookmark);
|
||||
|
||||
|
||||
return await query
|
||||
return await ApplyLimit(filterSeriesQuery
|
||||
.Sort(filter.SortOptions)
|
||||
.AsSplitQuery(), filter.LimitTo)
|
||||
.Select(o => o.bookmark)
|
||||
.ProjectTo<BookmarkDto>(_mapper.ConfigurationProvider)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
private static IQueryable<BookmarkSeriesPair> ApplyLimit(IQueryable<BookmarkSeriesPair> query, int limit)
|
||||
{
|
||||
return limit <= 0 ? query : query.Take(limit);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches the UserId by API Key. This does not include any extra information
|
||||
/// </summary>
|
||||
|
59
API/Extensions/QueryExtensions/Filtering/BookmarkSort.cs
Normal file
59
API/Extensions/QueryExtensions/Filtering/BookmarkSort.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System.Linq;
|
||||
using API.DTOs.Filtering;
|
||||
using API.Entities;
|
||||
|
||||
namespace API.Extensions.QueryExtensions.Filtering;
|
||||
|
||||
public class BookmarkSeriesPair
|
||||
{
|
||||
public AppUserBookmark bookmark { get; set; }
|
||||
public Series series { get; set; }
|
||||
}
|
||||
|
||||
public static class BookmarkSort
|
||||
{
|
||||
/// <summary>
|
||||
/// Applies the correct sort based on <see cref="SortOptions"/>
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <param name="sortOptions"></param>
|
||||
/// <returns></returns>
|
||||
public static IQueryable<BookmarkSeriesPair> Sort(this IQueryable<BookmarkSeriesPair> query, SortOptions? sortOptions)
|
||||
{
|
||||
// If no sort options, default to using SortName
|
||||
sortOptions ??= new SortOptions()
|
||||
{
|
||||
IsAscending = true,
|
||||
SortField = SortField.SortName
|
||||
};
|
||||
|
||||
if (sortOptions.IsAscending)
|
||||
{
|
||||
query = sortOptions.SortField switch
|
||||
{
|
||||
SortField.SortName => query.OrderBy(s => s.series.SortName.ToLower()),
|
||||
SortField.CreatedDate => query.OrderBy(s => s.series.Created),
|
||||
SortField.LastModifiedDate => query.OrderBy(s => s.series.LastModified),
|
||||
SortField.LastChapterAdded => query.OrderBy(s => s.series.LastChapterAdded),
|
||||
SortField.TimeToRead => query.OrderBy(s => s.series.AvgHoursToRead),
|
||||
SortField.ReleaseYear => query.OrderBy(s => s.series.Metadata.ReleaseYear),
|
||||
_ => query
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
query = sortOptions.SortField switch
|
||||
{
|
||||
SortField.SortName => query.OrderByDescending(s => s.series.SortName.ToLower()),
|
||||
SortField.CreatedDate => query.OrderByDescending(s => s.series.Created),
|
||||
SortField.LastModifiedDate => query.OrderByDescending(s => s.series.LastModified),
|
||||
SortField.LastChapterAdded => query.OrderByDescending(s => s.series.LastChapterAdded),
|
||||
SortField.TimeToRead => query.OrderByDescending(s => s.series.AvgHoursToRead),
|
||||
SortField.ReleaseYear => query.OrderByDescending(s => s.series.Metadata.ReleaseYear),
|
||||
_ => query
|
||||
};
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@
|
||||
<app-read-more [text]="summary" [blur]="pagesRead === 0 && blur" [maxLength]="250"></app-read-more>
|
||||
</div>
|
||||
</ng-container>
|
||||
<div class="ps-2 d-none d-md-inline-block">
|
||||
<div class="ps-2 d-none d-md-inline-block" style="width: 100%">
|
||||
<app-entity-info-cards [entity]="entity" [libraryId]="libraryId" [includeMetadata]="ShowExtended" [showExtendedProperties]="ShowExtended"></app-entity-info-cards>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -184,6 +184,7 @@ export class DashboardComponent implements OnInit {
|
||||
|
||||
const filter = this.filterUtilityService.createSeriesV2Filter();
|
||||
filter.statements.push({field: FilterField.ReadProgress, comparison: FilterComparison.GreaterThan, value: '0'});
|
||||
filter.statements.push({field: FilterField.ReadProgress, comparison: FilterComparison.LessThan, value: '100'});
|
||||
if (filter.sortOptions) {
|
||||
filter.sortOptions.sortField = SortField.LastChapterAdded;
|
||||
filter.sortOptions.isAscending = false;
|
||||
|
@ -1,8 +1,8 @@
|
||||
<div class="row g-0 mb-1" *ngIf="tags.length > 0">
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
<h5>{{heading}}</h5>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="col-md-9">
|
||||
<app-badge-expander [items]="tags">
|
||||
<ng-template #badgeExpanderItem let-item let-position="idx">
|
||||
<ng-container *ngIf="itemTemplate; else useTitle">
|
||||
|
Loading…
x
Reference in New Issue
Block a user