From d4ca75222b3f2653ddd18ff37630a8ca43fb95ae Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Thu, 25 Jul 2019 21:18:20 +0200 Subject: [PATCH] Scrollbars improved and fix with web extensions. --- src/Squidex.Web/ETagExtensions.cs | 14 +++++++------- .../Api/Controllers/Contents/ContentsController.cs | 6 +++--- .../Controllers/News/Service/FeaturesService.cs | 2 +- src/Squidex/app/theme/_common.scss | 4 +++- src/Squidex/app/theme/_mixins.scss | 2 ++ src/Squidex/app/theme/_panels.scss | 6 +++++- 6 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/Squidex.Web/ETagExtensions.cs b/src/Squidex.Web/ETagExtensions.cs index 034a9b958c..d83943222e 100644 --- a/src/Squidex.Web/ETagExtensions.cs +++ b/src/Squidex.Web/ETagExtensions.cs @@ -18,27 +18,27 @@ public static class ETagExtensions { private static readonly int GuidLength = Guid.Empty.ToString().Length; - public static string ToEtag(this IReadOnlyList items, IEntityWithVersion app = null) where T : IEntity, IEntityWithVersion + public static string ToEtag(this IReadOnlyList items, params IEntityWithVersion[] dependencies) where T : IEntity, IEntityWithVersion { using (Profiler.Trace("CalculateEtag")) { - var unhashed = Unhashed(items, 0, app); + var unhashed = Unhashed(items, 0, dependencies); return unhashed.Sha256Base64(); } } - public static string ToEtag(this IResultList items, IEntityWithVersion app = null) where T : IEntity, IEntityWithVersion + public static string ToEtag(this IResultList items, params IEntityWithVersion[] dependencies) where T : IEntity, IEntityWithVersion { using (Profiler.Trace("CalculateEtag")) { - var unhashed = Unhashed(items, items.Total, app); + var unhashed = Unhashed(items, items.Total, dependencies); return unhashed.Sha256Base64(); } } - private static string Unhashed(IReadOnlyList items, long total, IEntityWithVersion app) where T : IEntity, IEntityWithVersion + private static string Unhashed(IReadOnlyList items, long total, params IEntityWithVersion[] dependencies) where T : IEntity, IEntityWithVersion { var sb = new StringBuilder((items.Count * (GuidLength + 8)) + 10); @@ -51,10 +51,10 @@ private static string Unhashed(IReadOnlyList items, long total, IEntityWit sb.Append("_"); sb.Append(total); - if (app != null) + foreach (var dependency in dependencies) { sb.Append("_"); - sb.Append(app.Version); + sb.Append(dependency.Version); } return sb.ToString(); diff --git a/src/Squidex/Areas/Api/Controllers/Contents/ContentsController.cs b/src/Squidex/Areas/Api/Controllers/Contents/ContentsController.cs index 9d18ca9b92..3024549c2a 100644 --- a/src/Squidex/Areas/Api/Controllers/Contents/ContentsController.cs +++ b/src/Squidex/Areas/Api/Controllers/Contents/ContentsController.cs @@ -162,12 +162,12 @@ public async Task GetAllContents(string app, [FromQuery] string i [ApiCosts(1)] public async Task GetContents(string app, string name, [FromQuery] string ids = null) { + var schema = await contentQuery.GetSchemaOrThrowAsync(Context, name); + var contents = await contentQuery.QueryAsync(Context, name, Q.Empty.WithIds(ids).WithODataQuery(Request.QueryString.ToString())); var response = Deferred.AsyncResponse(async () => { - var schema = await contentQuery.GetSchemaOrThrowAsync(Context, name); - return await ContentsDto.FromContentsAsync(contents, Context, this, schema, contentWorkflow); }); @@ -176,7 +176,7 @@ public async Task GetContents(string app, string name, [FromQuery Response.Headers["Surrogate-Key"] = contents.ToSurrogateKeys(); } - Response.Headers[HeaderNames.ETag] = contents.ToEtag(App); + Response.Headers[HeaderNames.ETag] = contents.ToEtag(App, schema); return Ok(response); } diff --git a/src/Squidex/Areas/Api/Controllers/News/Service/FeaturesService.cs b/src/Squidex/Areas/Api/Controllers/News/Service/FeaturesService.cs index 9b1641946a..e8e7cfc59a 100644 --- a/src/Squidex/Areas/Api/Controllers/News/Service/FeaturesService.cs +++ b/src/Squidex/Areas/Api/Controllers/News/Service/FeaturesService.cs @@ -16,7 +16,7 @@ namespace Squidex.Areas.Api.Controllers.News.Service { public sealed class FeaturesService { - private const int FeatureVersion = 3; + private const int FeatureVersion = 4; private static readonly QueryContext Flatten = QueryContext.Default.Flatten(); private readonly SquidexClient client; diff --git a/src/Squidex/app/theme/_common.scss b/src/Squidex/app/theme/_common.scss index 65ea8d7973..e706e81c1f 100644 --- a/src/Squidex/app/theme/_common.scss +++ b/src/Squidex/app/theme/_common.scss @@ -15,7 +15,9 @@ body { } } -@include scrollbars(10px, $color-dark2-placeholder, transparent); +* { + @include scrollbars(8px, $color-border-dark, transparent); +} // Common style for user email. .user-email { diff --git a/src/Squidex/app/theme/_mixins.scss b/src/Squidex/app/theme/_mixins.scss index b1e2f092bd..0a1bc647f8 100644 --- a/src/Squidex/app/theme/_mixins.scss +++ b/src/Squidex/app/theme/_mixins.scss @@ -57,6 +57,8 @@ & { scrollbar-face-color: $foreground-color; scrollbar-track-color: $background-color; + scrollbar-color: $foreground-color $background-color; + scrollbar-width: thin; } } diff --git a/src/Squidex/app/theme/_panels.scss b/src/Squidex/app/theme/_panels.scss index 81c27d5871..2543901810 100644 --- a/src/Squidex/app/theme/_panels.scss +++ b/src/Squidex/app/theme/_panels.scss @@ -26,9 +26,9 @@ // .panel-container { @include fixed($size-navbar-height, 0, 0, $size-sidebar-width); + @include scrollbars(8px, $color-border-dark); overflow-x: auto; overflow-y: hidden; - @include scrollbars(10px, $color-dark2-placeholder); } // @@ -254,6 +254,10 @@ border: 0; } + .panel-content { + @include scrollbars(8px, darken($color-dark2-foreground, 10%), transparent); + } + .panel-close { & { color: $color-dark2-foreground;