mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
Added initial view and view model for setup
--HG-- branch : dev
This commit is contained in:
parent
1b014f577e
commit
ec8df71e50
@ -112,8 +112,10 @@
|
||||
<Compile Include="Settings\Controllers\SiteSettingsDriver.cs" />
|
||||
<Compile Include="Settings\Permissions.cs" />
|
||||
<Compile Include="Setup\Controllers\SetupController.cs" />
|
||||
<Compile Include="Setup\Routes.cs" />
|
||||
<Compile Include="Setup\Services\ISetupService.cs" />
|
||||
<Compile Include="Setup\Services\SetupService.cs" />
|
||||
<Compile Include="Setup\ViewModels\SetupViewModel.cs" />
|
||||
<Compile Include="Themes\Preview\IPreviewTheme.cs" />
|
||||
<Compile Include="Themes\Preview\PreviewThemeFilter.cs" />
|
||||
<Compile Include="Themes\Services\AdminThemeSelector.cs" />
|
||||
@ -205,6 +207,7 @@
|
||||
<Content Include="Themes\Views\Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Setup\Views\Setup\Index.ascx" />
|
||||
<Content Include="Setup\Views\Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Core.Setup.Services;
|
||||
using Orchard.Core.Setup.ViewModels;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Logging;
|
||||
|
||||
@ -19,7 +20,7 @@ namespace Orchard.Core.Setup.Controllers {
|
||||
private Localizer T { get; set; }
|
||||
|
||||
public ActionResult Index() {
|
||||
return View();
|
||||
return View(new SetupViewModel());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
33
src/Orchard.Web/Core/Setup/Routes.cs
Normal file
33
src/Orchard.Web/Core/Setup/Routes.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Orchard.Mvc.Routes;
|
||||
|
||||
namespace Orchard.Core.Setup {
|
||||
public class Routes : IRouteProvider
|
||||
{
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var routeDescriptor in GetRoutes())
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return new[] {
|
||||
new RouteDescriptor {
|
||||
Route = new Route(
|
||||
"Setup",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Setup"},
|
||||
{"controller", "Setup"},
|
||||
{"action", "Index"}
|
||||
},
|
||||
new RouteValueDictionary(),
|
||||
new RouteValueDictionary {
|
||||
{"area", "Setup"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
10
src/Orchard.Web/Core/Setup/ViewModels/SetupViewModel.cs
Normal file
10
src/Orchard.Web/Core/Setup/ViewModels/SetupViewModel.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.Core.Setup.ViewModels {
|
||||
public class SetupViewModel : BaseViewModel {
|
||||
public string SiteName { get; set; }
|
||||
public string AdminUsername { get; set; }
|
||||
public string AdminPassword { get; set; }
|
||||
public string DatabaseConnectionString { get; set; }
|
||||
}
|
||||
}
|
38
src/Orchard.Web/Core/Setup/Views/Setup/Index.ascx
Normal file
38
src/Orchard.Web/Core/Setup/Views/Setup/Index.ascx
Normal file
@ -0,0 +1,38 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<SetupViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Setup.ViewModels"%>
|
||||
<h1><%=Html.TitleForPage("Orchard " + _Encoded("Setup"))%></h1><%
|
||||
using (Html.BeginFormAntiForgeryPost()) { %>
|
||||
<%=Html.ValidationSummary() %>
|
||||
<fieldset>
|
||||
<%=Html.LabelFor(svm => svm.SiteName) %>
|
||||
<%=Html.EditorFor(svm => svm.SiteName) %>
|
||||
<%=Html.ValidationMessage("SiteName", "*") %>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<%=Html.LabelFor(svm => svm.AdminUsername) %>
|
||||
<%=Html.EditorFor(svm => svm.AdminUsername)%>
|
||||
<%=Html.ValidationMessage("AdminUsername", "*")%>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<%=Html.LabelFor(svm => svm.AdminPassword) %>
|
||||
<%=Html.EditorFor(svm => svm.AdminPassword) %>
|
||||
<%=Html.ValidationMessage("AdminPassword", "*") %>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<%=Html.ValidationMessage("DatabaseOptions", "Unable to setup data storage") %>
|
||||
<div>
|
||||
<input type="radio" name="databaseOption" id="builtin" value="true" checked="checked" />
|
||||
<label for="builtin"><%=_Encoded("Use built-in data storage (SQL Lite)") %></label>
|
||||
</div>
|
||||
<div>
|
||||
<input type="radio" name="databaseOption" id="sql" value="false" />
|
||||
<label for="sql"><%=_Encoded("Use an existing SQL Server (or SQL Express) database") %></label>
|
||||
<!-- Should add some javascript to hide the connection string field if that option isn't selected -->
|
||||
<label for="connection"><%=_Encoded("Connection string") %></label>
|
||||
<%=Html.EditorFor(svm => svm.DatabaseConnectionString)%>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<input class="button" type="submit" value="<%=_Encoded("Finish Setup") %>" />
|
||||
</fieldset><%
|
||||
} %>
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
Loading…
Reference in New Issue
Block a user