Skip to content

Commit

Permalink
Upgrade to OC 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek committed Sep 9, 2024
1 parent 4b91812 commit f563585
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 28 deletions.
15 changes: 9 additions & 6 deletions NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
<configuration>
<packageSources>
<clear />
<add key="OrchardCorePreview" value="https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json" />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<!--
<add key="OrchardCorePreview" value="https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json" />
<add key="NuGet2" value="https://api.nuget.org/v3/index.json" />
-->
</packageSources>

<packageSourceMapping>
<!-- key value for <packageSource> should match key values from <packageSources> element -->
<!-- To point OrchardCore to previews, update the packageSource key to OrchardCorePreview. -->
<!-- key value for <packageSource> should match key values from <packageSources> element -->
<!-- To point OrchardCore to previews, update the packageSource key to OrchardCorePreview. -->
<!--
<packageSourceMapping>
<packageSource key="NuGet2">
<package pattern="OrchardCore.Translations.*" />
Expand All @@ -30,6 +33,6 @@
<package pattern="*" />
</packageSource>
</packageSourceMapping>

</packageSourceMapping>
-->
</configuration>
2 changes: 1 addition & 1 deletion src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
<OrchardCoreVersion>2.0.0-preview-18325</OrchardCoreVersion>
<OrchardCoreVersion>2.0.0</OrchardCoreVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
23 changes: 12 additions & 11 deletions src/Modules/CrestApps.OrchardCore.Users/AvatarAdminMenu.cs
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
using CrestApps.OrchardCore.Users.Drivers;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Localization;
using OrchardCore.Navigation;

namespace CrestApps.OrchardCore.Users;

public class AvatarAdminMenu : INavigationProvider
public sealed class AvatarAdminMenu : AdminNavigationProvider
{
protected readonly IStringLocalizer S;
private static readonly RouteValueDictionary _routeValues = new()
{
{ "area", "OrchardCore.Settings" },
{ "groupId", UserAvatarOptionsDisplayDriver.GroupId },
};

internal readonly IStringLocalizer S;

public AvatarAdminMenu(IStringLocalizer<UserDisplayNameAdminMenu> stringLocalizer)
{
S = stringLocalizer;
}

public Task BuildNavigationAsync(string name, NavigationBuilder builder)
protected override ValueTask BuildAsync(NavigationBuilder builder)
{
if (!NavigationHelper.IsAdminMenu(name))
{
return Task.CompletedTask;
}

builder
.Add(S["Configuration"], configuration => configuration
.Add(S["Settings"], settings => settings
.Add(S["User Avatars"], S["User Avatars"].PrefixPosition(), userAvatars => userAvatars
.AddClass("user-avatars")
.Id("userAvatars")
.Action("Index", "Admin", new { area = "OrchardCore.Settings", groupId = UserAvatarOptionsDisplayDriver.GroupId })
.Action("Index", "Admin", _routeValues)
.Permission(UserPermissions.ManageAvatarSettings)
.LocalNav()
)
)
);


return Task.CompletedTask;
return ValueTask.CompletedTask;
}
}
22 changes: 12 additions & 10 deletions src/Modules/CrestApps.OrchardCore.Users/UserDisplayNameAdminMenu.cs
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
using CrestApps.OrchardCore.Users.Drivers;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Localization;
using OrchardCore.Navigation;

namespace CrestApps.OrchardCore.Users;

public sealed class UserDisplayNameAdminMenu : INavigationProvider
public sealed class UserDisplayNameAdminMenu : AdminNavigationProvider
{
private static readonly RouteValueDictionary _routeValues = new()
{
{ "area", "OrchardCore.Settings" },
{ "groupId", DisplayNameSettingsDisplayDriver.GroupId },
};


internal readonly IStringLocalizer S;

public UserDisplayNameAdminMenu(IStringLocalizer<UserDisplayNameAdminMenu> stringLocalizer)
{
S = stringLocalizer;
}

public Task BuildNavigationAsync(string name, NavigationBuilder builder)
protected override ValueTask BuildAsync(NavigationBuilder builder)
{
if (!NavigationHelper.IsAdminMenu(name))
{
return Task.CompletedTask;
}

builder
.Add(S["Configuration"], configuration => configuration
.Add(S["Settings"], settings => settings
.Add(S["User Display Name"], S["User Display Name"].PrefixPosition(), userDisplayName => userDisplayName
.AddClass("user-display-name")
.Id("userDisplayName")
.Action("Index", "Admin", new { area = "OrchardCore.Settings", groupId = DisplayNameSettingsDisplayDriver.GroupId })
.Action("Index", "Admin", _routeValues)
.Permission(UserPermissions.ManageDisplaySettings)
.LocalNav()
)
)
);


return Task.CompletedTask;
return ValueTask.CompletedTask;
}
}

0 comments on commit f563585

Please sign in to comment.