Adding something for the theme zone preview image.

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2011-03-23 12:00:45 -07:00
parent f98505d75f
commit 86c6e4052f
9 changed files with 23 additions and 5 deletions
@@ -8,6 +8,7 @@ using Orchard.DisplayManagement;
using Orchard.Localization; using Orchard.Localization;
using Orchard.Logging; using Orchard.Logging;
using Orchard.Mvc.Extensions; using Orchard.Mvc.Extensions;
using Orchard.Themes.Services;
using Orchard.UI.Admin; using Orchard.UI.Admin;
using Orchard.UI.Notify; using Orchard.UI.Notify;
using Orchard.Utility.Extensions; using Orchard.Utility.Extensions;
@@ -22,14 +23,17 @@ namespace Orchard.Widgets.Controllers {
private const string NotAuthorizedManageWidgetsLabel = "Not authorized to manage widgets"; private const string NotAuthorizedManageWidgetsLabel = "Not authorized to manage widgets";
private readonly IWidgetsService _widgetsService; private readonly IWidgetsService _widgetsService;
private readonly ISiteThemeService _siteThemeService;
public AdminController( public AdminController(
IOrchardServices services, IOrchardServices services,
IWidgetsService widgetsService, IWidgetsService widgetsService,
IShapeFactory shapeFactory) { IShapeFactory shapeFactory,
ISiteThemeService siteThemeService) {
Services = services; Services = services;
_widgetsService = widgetsService; _widgetsService = widgetsService;
_siteThemeService = siteThemeService;
T = NullLocalizer.Instance; T = NullLocalizer.Instance;
Logger = NullLogger.Instance; Logger = NullLogger.Instance;
@@ -59,6 +63,7 @@ namespace Orchard.Widgets.Controllers {
} }
dynamic viewModel = Shape.ViewModel() dynamic viewModel = Shape.ViewModel()
.CurrentTheme(_siteThemeService.GetSiteTheme())
.CurrentLayer(currentLayer) .CurrentLayer(currentLayer)
.Layers(layers) .Layers(layers)
.Widgets(_widgetsService.GetWidgets()) .Widgets(_widgetsService.GetWidgets())
@@ -7,4 +7,4 @@ OrchardVersion: 1.0.20
Description: An implementation of widgets for Orchard. Description: An implementation of widgets for Orchard.
FeatureDescription: An implementation of widgets. FeatureDescription: An implementation of widgets.
Category: Widget Category: Widget
Dependencies: Orchard.Scripting Dependencies: Orchard.Scripting, Themes
@@ -106,6 +106,10 @@
<Project>{99002B65-86F7-415E-BF4A-381AA8AB9CCC}</Project> <Project>{99002B65-86F7-415E-BF4A-381AA8AB9CCC}</Project>
<Name>Orchard.Scripting</Name> <Name>Orchard.Scripting</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Orchard.Themes\Orchard.Themes.csproj">
<Project>{CDE24A24-01D3-403C-84B9-37722E18DFB7}</Project>
<Name>Orchard.Themes</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Views\Admin\AddLayer.cshtml" /> <Content Include="Views\Admin\AddLayer.cshtml" />
@@ -169,3 +169,8 @@ margin:-32px 10px -2px 0;
display:none; display:none;
} }
/* end: switchable tweaks */ /* end: switchable tweaks */
/* ...and the current state of the theme zone preview */
#widgets-theme-zone-preview img {
width:100%;
}
@@ -10,7 +10,7 @@
<div id="layout-widgets-assistance"> <div id="layout-widgets-assistance">
<div id="widgets-assistance"> <div id="widgets-assistance">
<div class="widgets-container"> <div class="widgets-container">
@Display.WidgetSimplePreview() @Display.WidgetSimplePreview(CurrentTheme: Model.CurrentTheme)
@Display.WidgetLayerVisibility(Layers: Model.Layers, CurrentLayer: Model.CurrentLayer) @Display.WidgetLayerVisibility(Layers: Model.Layers, CurrentLayer: Model.CurrentLayer)
</div> </div>
</div> </div>
@@ -1 +1,2 @@
<p>[[theme preview image]]</p> @using Orchard.Environment.Extensions.Models
<p id="widgets-theme-zone-preview">@Html.Image(Href(Html.ThemePath((ExtensionDescriptor) Model.CurrentTheme, "/ThemeZonePreview.png")), T("{0} zone preview", (string)Model.CurrentTheme.Name).Text, null)</p>
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+1
View File
@@ -70,6 +70,7 @@
</Content> </Content>
<Content Include="TheAdmin\Views\Pager.cshtml" /> <Content Include="TheAdmin\Views\Pager.cshtml" />
<Content Include="TheAdmin\Views\OrchardVersion.cshtml" /> <Content Include="TheAdmin\Views\OrchardVersion.cshtml" />
<Content Include="TheThemeMachine\ThemeZonePreview.png" />
<Content Include="Web.config"> <Content Include="Web.config">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Content> </Content>
+2
View File
@@ -32,6 +32,7 @@
<httpHandlers> <httpHandlers>
<!-- iis6 - for any request in this location, return via managed static file handler --> <!-- iis6 - for any request in this location, return via managed static file handler -->
<add path="*/Theme.png" verb="*" type="System.Web.StaticFileHandler" /> <add path="*/Theme.png" verb="*" type="System.Web.StaticFileHandler" />
<add path="*/ThemeZonePreview.png" verb="*" type="System.Web.StaticFileHandler" />
</httpHandlers> </httpHandlers>
<!-- <!--
Enabling request validation in view pages would cause validation to occur Enabling request validation in view pages would cause validation to occur
@@ -67,6 +68,7 @@
accessPolicy 'Script' is to allow for a managed 404 page. accessPolicy 'Script' is to allow for a managed 404 page.
--> -->
<add name="ThemePreviewImage" path="*/Theme.png" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" /> <add name="ThemePreviewImage" path="*/Theme.png" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
<add name="ThemeZonePreviewImage" path="*/ThemeZonePreview.png" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
</handlers> </handlers>
</system.webServer> </system.webServer>
<runtime> <runtime>