Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into task/system-text-json-…
Browse files Browse the repository at this point in the history
…migration
  • Loading branch information
sarahelsaig committed Jun 14, 2024
2 parents 0d18ccd + 2bd9952 commit 23a0f44
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 53 deletions.
13 changes: 0 additions & 13 deletions Lombiq.BaseTheme.Samples/License.md

This file was deleted.

3 changes: 1 addition & 2 deletions Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PackageTags>OrchardCore;Lombiq;AspNetCore;Sass;Theming</PackageTags>
<RepositoryUrl>https://github.com/Lombiq/Orchard-Base-Theme</RepositoryUrl>
<PackageProjectUrl>https://github.com/Lombiq/Orchard-Base-Theme/blob/dev/Lombiq.BaseTheme.Samples/Readme.md</PackageProjectUrl>
<PackageLicenseFile>License.md</PackageLicenseFile>
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
</PropertyGroup>

<ItemGroup>
Expand All @@ -43,7 +43,6 @@
</ItemGroup>

<ItemGroup>
<None Include="License.md" Pack="true" PackagePath="" />
<None Include="Readme.md" />
<None Include="NuGetIcon.png" Pack="true" PackagePath="" />
<None Remove="node_modules\**" />
Expand Down
4 changes: 3 additions & 1 deletion Lombiq.BaseTheme.Samples/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
Website = "https://github.com/Lombiq/Orchard-Base-Theme",
Description = "A sample theme that builds on Lombiq Base Theme.",
// This is a new property in DerivedTheme. By setting it to a static resource you can define a default icon for this
// theme. You can define other "link" resources too, using the Link property.
// theme. You can define other "link" resources too, using the LinkJson property. They should be valid Json strings.
// For example:
// LinksJson = "[{\"Href\": \"~/example/style.css\", \"Rel\": \"stylesheet\"}]"
Favicon = "~/Lombiq.BaseTheme.Samples/icons/favicon.ico"
)]

Expand Down
13 changes: 0 additions & 13 deletions Lombiq.BaseTheme.Tests.UI/License.md

This file was deleted.

3 changes: 1 addition & 2 deletions Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageTags>OrchardCore;Lombiq;AspNetCore;Sass;Shouldly;xUnit;UITesting;Testing</PackageTags>
<RepositoryUrl>https://github.com/Lombiq/Orchard-Base-Theme</RepositoryUrl>
<PackageProjectUrl>https://github.com/Lombiq/Orchard-Base-Theme/blob/dev/Lombiq.BaseTheme.Tests.UI/Readme.md</PackageProjectUrl>
<PackageLicenseFile>License.md</PackageLicenseFile>
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
</PropertyGroup>

<ItemGroup>
Expand All @@ -29,7 +29,6 @@
</ItemGroup>

<ItemGroup>
<None Include="License.md" Pack="true" PackagePath="" />
<None Include="Readme.md" />
<None Include="NuGetIcon.png" Pack="true" PackagePath="" />
</ItemGroup>
Expand Down
13 changes: 13 additions & 0 deletions Lombiq.BaseTheme/Assets/Styles/abstracts/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@
}
}

/// Apply it to <button> or <input type="button"> elements to eliminate the browser default styles.
@mixin reset-button {
all: initial;
font: inherit;
color: inherit;
}

@mixin padding-gutter($vertical-multiplier: $default-vertical-multiplier) {
@include media-breakpoint-only(xs) {
padding: calc(var(--gutter-x-small) * #{$vertical-multiplier}) var(--gutter-x-small);
Expand Down Expand Up @@ -323,3 +330,9 @@
@mixin gap-gutter($multiplier: 1) {
@include apply-gutter("gap", $multiplier);
}

@mixin font-awesome-icon-free($unicode) {
font-family: "Font Awesome 6 Free", serif;
font-weight: 900;
content: $unicode;
}
9 changes: 7 additions & 2 deletions Lombiq.BaseTheme/Attributes/DerivedThemeAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using Lombiq.BaseTheme.Constants;
using Lombiq.BaseTheme.Constants;
using OrchardCore.DisplayManagement.Manifest;
using OrchardCore.ResourceManagement;
using System;
using System.Collections.Generic;
using System.Text.Json;

namespace Lombiq.BaseTheme.Attributes;

Expand All @@ -12,9 +13,13 @@ namespace Lombiq.BaseTheme.Attributes;
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
public sealed class DerivedThemeAttribute : ThemeAttribute
{
public IEnumerable<LinkEntry> Links { get; set; }
public string LinksJson { get; set; }
public string Favicon { get; set; }

public IEnumerable<LinkEntry> Links => LinksJson == null
? []
: JsonSerializer.Deserialize<IEnumerable<LinkEntry>>(LinksJson);

public DerivedThemeAttribute() =>
BaseTheme = FeatureIds.BaseTheme;
}
2 changes: 2 additions & 0 deletions Lombiq.BaseTheme/Controllers/AdminController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public async Task<IActionResult> Index()
[ValidateAntiForgeryToken]
public async Task<IActionResult> Update([FromForm] BaseThemeSettingsViewModel viewModel)
{
if (!ModelState.IsValid) return BadRequest(ModelState);

var siteSettings = await _siteService.LoadSiteSettingsAsync();
siteSettings.Alter<BaseThemeSettings>(nameof(BaseThemeSettings), settings =>
{
Expand Down
13 changes: 0 additions & 13 deletions Lombiq.BaseTheme/License.md

This file was deleted.

3 changes: 1 addition & 2 deletions Lombiq.BaseTheme/Lombiq.BaseTheme.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PackageTags>OrchardCore;Lombiq;AspNetCore;Sass;Theming</PackageTags>
<RepositoryUrl>https://github.com/Lombiq/Orchard-Base-Theme</RepositoryUrl>
<PackageProjectUrl>https://github.com/Lombiq/Orchard-Base-Theme</PackageProjectUrl>
<PackageLicenseFile>License.md</PackageLicenseFile>
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
</PropertyGroup>

<PropertyGroup Condition="'$(NuGetBuild)' != 'true'">
Expand All @@ -32,7 +32,6 @@
</Target>

<ItemGroup>
<None Include="License.md" Pack="true" PackagePath="" />
<None Include="..\Readme.md" />
<None Include="NuGetIcon.png" Pack="true" PackagePath="" />
<None Remove="node_modules\**" />
Expand Down
4 changes: 2 additions & 2 deletions Lombiq.BaseTheme/Permissions/BaseThemeSettingsPermissions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Lombiq.HelpfulLibraries.OrchardCore.Users;
using Lombiq.HelpfulLibraries.OrchardCore.Users;
using OrchardCore.Security.Permissions;
using System.Collections.Generic;

Expand All @@ -9,5 +9,5 @@ public class BaseThemeSettingsPermissions : AdminPermissionBase
public static readonly Permission ManageBaseThemeSettings =
new(nameof(ManageBaseThemeSettings), "Manage Lombiq.BaseTheme Settings.");

protected override IEnumerable<Permission> AdminPermissions => new[] { ManageBaseThemeSettings };
protected override IEnumerable<Permission> AdminPermissions => [ManageBaseThemeSettings];
}
9 changes: 8 additions & 1 deletion Lombiq.BaseTheme/Services/IconResourceFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using OrchardCore.Themes.Services;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Lombiq.BaseTheme.Services;

Expand Down Expand Up @@ -47,7 +48,13 @@ public void AddResourceFilter(ResourceFilterBuilder builder) =>
AddIcon(resourceManager, icon);
}

theme.Links?.ForEach(resourceManager.RegisterLink);
var themeLinks = theme.Links;

if (themeLinks?.Any() == true)
{
themeLinks.ForEach(linkEntry => linkEntry.Href = _orchardHelper.ResourceUrl(linkEntry.Href));
themeLinks.ForEach(resourceManager.RegisterLink);
}
}

// If the site setting icon is set, that should take priority.
Expand Down
5 changes: 3 additions & 2 deletions Lombiq.BaseTheme/ViewModels/BaseThemeSettingsViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using OrchardCore.DisplayManagement;

namespace Lombiq.BaseTheme.ViewModels;

public class BaseThemeSettingsViewModel
{
public string Icon { get; set; }
public bool HideMenu { get; set; }

public required bool HideMenu { get; set; }

[BindNever]
public IShape Editor { get; set; }
Expand Down

0 comments on commit 23a0f44

Please sign in to comment.