mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-15 15:21:09 +08:00
Delegating theme installation to Orchard.Packaging.
--HG-- branch : dev
This commit is contained in:
parent
48ccf121f8
commit
a1543c964f
@ -143,6 +143,10 @@ namespace Orchard.Packaging.Controllers {
|
||||
return RedirectToAction(redirectTo == "Themes" ? "Themes" : "Modules");
|
||||
}
|
||||
|
||||
public ActionResult AddTheme(string returnUrl) {
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult AddModule(string returnUrl) {
|
||||
return View();
|
||||
}
|
||||
|
@ -120,7 +120,9 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Gallery\Themes.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Gallery\AddTheme.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@ -1,16 +1,13 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Data.Migration;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.Features;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Reports.Services;
|
||||
using Orchard.Security;
|
||||
using Orchard.Themes.Preview;
|
||||
using Orchard.Themes.Services;
|
||||
using Orchard.Themes.ViewModels;
|
||||
@ -19,35 +16,36 @@ using Orchard.UI.Notify;
|
||||
namespace Orchard.Themes.Controllers {
|
||||
[ValidateInput(false)]
|
||||
public class AdminController : Controller {
|
||||
private readonly IDataMigrationManager _dataMigrationManager;
|
||||
private readonly IFeatureManager _featureManager;
|
||||
private readonly ISiteThemeService _siteThemeService;
|
||||
private readonly IPreviewTheme _previewTheme;
|
||||
private readonly IExtensionManager _extensionManager;
|
||||
private readonly ShellDescriptor _shellDescriptor;
|
||||
private readonly IPreviewTheme _previewTheme;
|
||||
private readonly IThemeService _themeService;
|
||||
private readonly IDataMigrationManager _dataMigrationManager;
|
||||
private readonly IReportsCoordinator _reportsCoordinator;
|
||||
|
||||
public AdminController(
|
||||
IDataMigrationManager dataMigraitonManager,
|
||||
IReportsCoordinator reportsCoordinator,
|
||||
IOrchardServices services,
|
||||
IThemeManager themeManager,
|
||||
IDataMigrationManager dataMigraitonManager,
|
||||
IFeatureManager featureManager,
|
||||
ISiteThemeService siteThemeService,
|
||||
IPreviewTheme previewTheme,
|
||||
IAuthorizer authorizer,
|
||||
INotifier notifier,
|
||||
IExtensionManager extensionManager,
|
||||
ShellDescriptor shellDescriptor,
|
||||
IThemeService themeService) {
|
||||
IPreviewTheme previewTheme,
|
||||
IThemeService themeService,
|
||||
IReportsCoordinator reportsCoordinator) {
|
||||
Services = services;
|
||||
|
||||
_dataMigrationManager = dataMigraitonManager;
|
||||
_reportsCoordinator = reportsCoordinator;
|
||||
_siteThemeService = siteThemeService;
|
||||
_previewTheme = previewTheme;
|
||||
_extensionManager = extensionManager;
|
||||
_shellDescriptor = shellDescriptor;
|
||||
_featureManager = featureManager;
|
||||
_previewTheme = previewTheme;
|
||||
_themeService = themeService;
|
||||
_reportsCoordinator = reportsCoordinator;
|
||||
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
@ -68,8 +66,9 @@ namespace Orchard.Themes.Controllers {
|
||||
})
|
||||
.ToArray();
|
||||
|
||||
var model = new ThemesIndexViewModel { CurrentTheme = currentTheme, Themes = themes };
|
||||
return View(model);
|
||||
return View(new ThemesIndexViewModel {
|
||||
CurrentTheme = currentTheme, Themes = themes,
|
||||
InstallThemes = _featureManager.GetEnabledFeatures().FirstOrDefault(f => f.Id == "Gallery") != null });
|
||||
}
|
||||
catch (Exception exception) {
|
||||
Services.Notifier.Error(T("Listing themes failed: " + exception.Message));
|
||||
|
@ -71,7 +71,6 @@
|
||||
<Content Include="Content\orchard.ico" />
|
||||
<Content Include="Styles\orchard-themes-admin.css" />
|
||||
<Content Include="Views\Admin\Index.cshtml" />
|
||||
<Content Include="Views\Admin\Install.cshtml" />
|
||||
<Content Include="Views\ThemePreview.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -3,6 +3,7 @@ using Orchard.Environment.Extensions.Models;
|
||||
|
||||
namespace Orchard.Themes.ViewModels {
|
||||
public class ThemesIndexViewModel {
|
||||
public bool InstallThemes { get; set; }
|
||||
public ExtensionDescriptor CurrentTheme { get; set; }
|
||||
public IEnumerable<ThemeEntry> Themes { get; set; }
|
||||
}
|
||||
|
@ -18,7 +18,9 @@
|
||||
@Model.CurrentTheme.WebSite
|
||||
</p>
|
||||
|
||||
@Html.ActionLink(T("Install a new Theme").ToString(), "Install", null, new { @class = "button primaryAction" })
|
||||
if (Model.InstallThemes) {
|
||||
@Html.ActionLink(T("Install a new Theme").ToString(), "Install", null, new { @class = "button primaryAction" })
|
||||
}
|
||||
}
|
||||
|
||||
<h2>@T("Available Themes")</h2>
|
||||
|
Loading…
Reference in New Issue
Block a user