-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # src/Orchard.Specs/Hosting/Orchard.Web/Web.config # src/Orchard.Web/Core/Orchard.Core.csproj
- Loading branch information
Showing
11 changed files
with
150 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,13 +17,13 @@ jobs: | |
shell: pwsh | ||
runs-on: windows-latest | ||
steps: | ||
- name: Clone repository | ||
- name: Clone Repository | ||
uses: actions/[email protected] | ||
|
||
- name: Restore NuGet packages | ||
- name: Restore NuGet Packages | ||
run: nuget restore src/Orchard.sln | ||
|
||
- name: Add msbuild to PATH | ||
- name: Add MSBuild to PATH | ||
uses: microsoft/setup-msbuild@v2 | ||
|
||
- name: Compile | ||
|
@@ -32,14 +32,19 @@ jobs: | |
- name: Test | ||
run: msbuild Orchard.proj /m /v:minimal /t:Test | ||
|
||
- name: Run Orchard setup | ||
- name: Test Setup with SpecFlow | ||
run: | | ||
$nunitConsole = (Get-ChildItem -Path 'src/packages' -Recurse -Filter 'nunit-console.exe' | Select-Object -Last 1).FullName | ||
& $nunitConsole 'build/Compile/Orchard.Specs.dll' /xml='build/Orchard.Specs.xml' /run=Orchard.Specs.SetupFeature.RootAndSetupFolderShowsSetupScreenAndFormValuesAreValidated | ||
- name: Run Orchard Setup with Orchard.exe | ||
run: | | ||
$commandFile = 'src/Orchard.Web/bin/setup-commands.txt' | ||
New-Item -Path $commandFile -ItemType File -Force | ||
Set-Content -Path $commandFile -Value 'setup /SiteName:Orchard /AdminUsername:admin /AdminPassword:Password1! /DatabaseProvider:SqlCe /Recipe:Default' | ||
& 'src/Orchard.Web/bin/Orchard.exe' @$commandFile | ||
- name: Run code generation | ||
- name: Run Code Generation | ||
run: | | ||
$commandFile = 'src/Orchard.Web/bin/codegen-commands.txt' | ||
New-Item -Path $commandFile -ItemType File -Force | ||
|
@@ -51,25 +56,25 @@ jobs: | |
'@ | ||
& 'src/Orchard.Web/bin/Orchard.exe' @$commandFile | ||
- name: Compile with generated projects | ||
- name: Compile Again with Generated Projects | ||
run: msbuild Orchard.proj /m /v:minimal /t:Compile /p:TreatWarningsAsErrors=true -WarnAsError /NoWarn:CS2008 | ||
|
||
compile-node: | ||
name: Compile client-side assets | ||
name: Compile Client-side Assets | ||
defaults: | ||
run: | ||
shell: pwsh | ||
runs-on: windows-latest | ||
steps: | ||
- name: Clone repository | ||
- name: Clone Repository | ||
uses: actions/[email protected] | ||
|
||
- name: Setup NodeJS | ||
uses: actions/[email protected] | ||
with: | ||
node-version: '7' | ||
|
||
- name: Setup NPM packages | ||
- name: Setup NPM Packages | ||
working-directory: ./src | ||
run: | | ||
npm install --loglevel warn | ||
|
@@ -78,7 +83,7 @@ jobs: | |
$gulpVersion = (Get-Content Package.json -Raw | ConvertFrom-Json).devDependencies.gulp | ||
Start-Process npm -NoNewWindow -Wait -ArgumentList "install gulp@$gulpVersion -g --loglevel warn" | ||
- name: Rebuild client-side assets | ||
- name: Rebuild Client-side Assets | ||
working-directory: ./src | ||
run: | | ||
gulp rebuild | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
using System.Linq; | ||
using Orchard.ContentManagement; | ||
using Orchard.Core.Containers.Models; | ||
using Orchard.Core.Containers.Services; | ||
using Orchard.Localization; | ||
using Orchard.Security; | ||
using Orchard.UI.Navigation; | ||
using Orchard.Utility.Extensions; | ||
|
||
namespace Orchard.Core.Containers { | ||
public class AdminMenu : INavigationProvider { | ||
private readonly IContainerService _containerService; | ||
private readonly IContentManager _contentManager; | ||
private readonly IAuthorizationService _authorizationService; | ||
private readonly IWorkContextAccessor _workContextAccessor; | ||
|
||
public AdminMenu( | ||
IContainerService containerService, | ||
IContentManager contentManager, | ||
IAuthorizationService authorizationService, | ||
IWorkContextAccessor workContextAccessor) { | ||
_containerService = containerService; | ||
_contentManager = contentManager; | ||
_authorizationService = authorizationService; | ||
_workContextAccessor = workContextAccessor; | ||
} | ||
|
||
public Localizer T { get; set; } | ||
public string MenuName { get { return "admin"; } } | ||
|
||
public void GetNavigation(NavigationBuilder builder) { | ||
builder.AddImageSet("container"); | ||
|
||
var containers = _containerService | ||
.GetContainersQuery(VersionOptions.Latest) | ||
.Where<ContainerPartRecord>(x => x.ShowOnAdminMenu) | ||
.List() | ||
.Where(content => _authorizationService.TryCheckAccess( | ||
Contents.Permissions.EditContent, | ||
_workContextAccessor.GetContext().CurrentUser, | ||
content)) | ||
.ToList(); | ||
|
||
foreach (var container in containers) { | ||
var closureContainer = container; | ||
|
||
if (!string.IsNullOrWhiteSpace(container.AdminMenuImageSet)) { | ||
builder.AddImageSet(container.AdminMenuImageSet.Trim()); | ||
} | ||
|
||
builder.Add(T(container.AdminMenuText), container.AdminMenuPosition, item => { | ||
var containedItems = _containerService.GetContentItems(closureContainer.Id, VersionOptions.Latest).ToList(); | ||
var actualContainer = closureContainer; | ||
var position = 0; | ||
|
||
// If the list has just a single item that happens to be a container itself, | ||
// we will treat that one as the actual container to provide a nice & quick way to manage that list. | ||
if (containedItems.Count == 1) { | ||
var containedItem = containedItems.First().As<ContainerPart>(); | ||
|
||
if (containedItem != null) { | ||
actualContainer = containedItem; | ||
foreach (var itemContentType in containedItem.ItemContentTypes) { | ||
var closureItemContentType = itemContentType; | ||
item.Add(T("New {0}", itemContentType.DisplayName), string.Format("1.{0}", position++), subItem => subItem | ||
.Action("Create", "Admin", new { | ||
id = closureItemContentType.Name, | ||
containerid = containedItem.Id, | ||
area = "Contents" | ||
})); | ||
} | ||
} | ||
} | ||
|
||
item.Action(_contentManager.GetItemMetadata(actualContainer).AdminRouteValues) | ||
.AddClass("section-container") | ||
.AddClass(closureContainer.AdminMenuText.HtmlClassify()) | ||
.LinkToFirstChild(false); | ||
|
||
foreach (var itemContentType in closureContainer.ItemContentTypes) { | ||
var closureItemContentType = itemContentType; | ||
item.Add(T("New {0}", itemContentType.DisplayName), string.Format("1.{0}", position++), subItem => subItem | ||
.Action("Create", "Admin", new { | ||
id = closureItemContentType.Name, | ||
containerid = container.Id, | ||
area = "Contents" | ||
})); | ||
} | ||
}); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<system.webServer> | ||
<staticContent> | ||
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" /> | ||
</staticContent> | ||
<handlers accessPolicy="Script,Read"> | ||
<!-- For any request to a file exists on disk, return it via native http module. AccessPolicy="Script" above is to allow for a managed 404 page. --> | ||
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" /> | ||
</handlers> | ||
</system.webServer> | ||
</configuration> |
File renamed without changes
7 changes: 7 additions & 0 deletions
7
src/Orchard.Web/Core/Containers/Styles/menu.container-admin.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.menu-admin > .section-container > h3 > a { | ||
background-image: url(images/menu.container.png) !important; | ||
} | ||
|
||
.menu-admin > .section-container > h3 > a:hover { | ||
background-position: 0 -30px !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,15 @@ | ||
using System; | ||
using System.Linq; | ||
using Orchard.ContentManagement; | ||
using Orchard.Core.Containers.Models; | ||
using Orchard.Core.Containers.Services; | ||
using Orchard.Localization; | ||
using Orchard.Security; | ||
using Orchard.Localization; | ||
using Orchard.UI.Navigation; | ||
using Orchard.Utility.Extensions; | ||
|
||
namespace Orchard.Lists { | ||
public class AdminMenu : INavigationProvider { | ||
private readonly IContainerService _containerService; | ||
private readonly IContentManager _contentManager; | ||
private readonly IAuthorizationService _authorizationService; | ||
private readonly IWorkContextAccessor _workContextAccessor; | ||
|
||
public AdminMenu( | ||
IContainerService containerService, | ||
IContentManager contentManager, | ||
IAuthorizationService authorizationService, | ||
IWorkContextAccessor workContextAccessor | ||
) { | ||
_containerService = containerService; | ||
_contentManager = contentManager; | ||
_authorizationService = authorizationService; | ||
_workContextAccessor = workContextAccessor; | ||
} | ||
|
||
public Localizer T { get; set; } | ||
public string MenuName { get { return "admin"; } } | ||
|
||
public void GetNavigation(NavigationBuilder builder) { | ||
builder.AddImageSet("list"); | ||
|
||
CreateListManagementMenuItem(builder); | ||
CreateListMenuItems(builder); | ||
} | ||
|
||
private void CreateListManagementMenuItem(NavigationBuilder builder) { | ||
builder.Add(T("Lists"), "11", item => item | ||
.Action("Index", "Admin", new {area = "Orchard.Lists"}).Permission(Permissions.ManageLists) | ||
); | ||
} | ||
|
||
private void CreateListMenuItems(NavigationBuilder builder) { | ||
var containers = _containerService | ||
.GetContainersQuery(VersionOptions.Latest) | ||
.Where<ContainerPartRecord>(x => x.ShowOnAdminMenu) | ||
.List() | ||
.Where(x => _authorizationService.TryCheckAccess(Orchard.Core.Contents.Permissions.EditContent, _workContextAccessor.GetContext().CurrentUser, x)) | ||
.ToList(); | ||
|
||
foreach (var container in containers) { | ||
var closureContainer = container; | ||
|
||
if (!String.IsNullOrWhiteSpace(container.AdminMenuImageSet)) { | ||
builder.AddImageSet(container.AdminMenuImageSet.Trim()); | ||
} | ||
|
||
builder.Add(T(container.AdminMenuText), container.AdminMenuPosition, item => { | ||
var containedItems = _containerService.GetContentItems(closureContainer.Id, VersionOptions.Latest).ToList(); | ||
var actualContainer = closureContainer; | ||
var position = 0; | ||
|
||
// If the list has just a single item that happens to be a container itself, | ||
// we will treat that one as the actual container to provide a nice & quick way to manage that list. | ||
if (containedItems.Count == 1) { | ||
var containedItem = containedItems.First().As<ContainerPart>(); | ||
|
||
if (containedItem != null) { | ||
actualContainer = containedItem; | ||
foreach (var itemContentType in containedItem.ItemContentTypes) { | ||
var closureItemContentType = itemContentType; | ||
item.Add(T("New {0}", itemContentType.DisplayName), String.Format("1.{0}", position++), subItem => subItem | ||
.Action("Create", "Admin", new { id = closureItemContentType.Name, containerid = containedItem.Id, area = "Contents" })); | ||
} | ||
} | ||
} | ||
|
||
var containerMetadata = _contentManager.GetItemMetadata(actualContainer); | ||
item.Action(containerMetadata.AdminRouteValues); | ||
|
||
item.Action(containerMetadata.AdminRouteValues); | ||
item.AddClass("nav-list"); | ||
item.AddClass(closureContainer.AdminMenuText.HtmlClassify()); | ||
item.LinkToFirstChild(false); | ||
|
||
foreach (var itemContentType in closureContainer.ItemContentTypes) { | ||
var closureItemContentType = itemContentType; | ||
item.Add(T("New {0}", itemContentType.DisplayName), String.Format("1.{0}", position++), subItem => subItem | ||
.Action("Create", "Admin", new { id = closureItemContentType.Name, containerid = container.Id, area = "Contents" })); | ||
} | ||
}); | ||
} | ||
} | ||
public void GetNavigation(NavigationBuilder builder) => | ||
builder | ||
.AddImageSet("lists") | ||
.Add(T("Lists"), "11", item => item | ||
.Action("Index", "Admin", new { area = "Orchard.Lists" }).Permission(Permissions.ManageLists)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
22 changes: 0 additions & 22 deletions
22
src/Orchard.Web/Modules/Orchard.Lists/Styles/menu.list-admin.css
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
src/Orchard.Web/Modules/Orchard.Lists/Styles/menu.lists-admin.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.navicon-lists { | ||
background-image: url(images/menu.lists.png) !important; | ||
} | ||
|
||
.navicon-lists:hover { | ||
background-position: 0 -30px !important; | ||
} |