Skip to content

Commit

Permalink
Scrollbars improved and fix with web extensions.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Jul 25, 2019
1 parent a7b2dbb commit d4ca752
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
14 changes: 7 additions & 7 deletions src/Squidex.Web/ETagExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@ public static class ETagExtensions
{
private static readonly int GuidLength = Guid.Empty.ToString().Length;

public static string ToEtag<T>(this IReadOnlyList<T> items, IEntityWithVersion app = null) where T : IEntity, IEntityWithVersion
public static string ToEtag<T>(this IReadOnlyList<T> 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<T>(this IResultList<T> items, IEntityWithVersion app = null) where T : IEntity, IEntityWithVersion
public static string ToEtag<T>(this IResultList<T> 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<T>(IReadOnlyList<T> items, long total, IEntityWithVersion app) where T : IEntity, IEntityWithVersion
private static string Unhashed<T>(IReadOnlyList<T> items, long total, params IEntityWithVersion[] dependencies) where T : IEntity, IEntityWithVersion
{
var sb = new StringBuilder((items.Count * (GuidLength + 8)) + 10);

Expand All @@ -51,10 +51,10 @@ private static string Unhashed<T>(IReadOnlyList<T> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ public async Task<IActionResult> GetAllContents(string app, [FromQuery] string i
[ApiCosts(1)]
public async Task<IActionResult> 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);
});

Expand All @@ -176,7 +176,7 @@ public async Task<IActionResult> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<NewsEntity, FeatureDto> client;

Expand Down
4 changes: 3 additions & 1 deletion src/Squidex/app/theme/_common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions src/Squidex/app/theme/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
& {
scrollbar-face-color: $foreground-color;
scrollbar-track-color: $background-color;
scrollbar-color: $foreground-color $background-color;
scrollbar-width: thin;
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/Squidex/app/theme/_panels.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

//
Expand Down Expand Up @@ -254,6 +254,10 @@
border: 0;
}

.panel-content {
@include scrollbars(8px, darken($color-dark2-foreground, 10%), transparent);
}

.panel-close {
& {
color: $color-dark2-foreground;
Expand Down

0 comments on commit d4ca752

Please sign in to comment.