mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Adding a default recipe and making the recipe choice optional in setup.
--HG-- branch : recipe
This commit is contained in:
@@ -20,6 +20,7 @@ namespace Orchard.Specs.Hosting {
|
||||
private IEnumerable<string> _knownModules;
|
||||
private IEnumerable<string> _knownThemes;
|
||||
private IEnumerable<string> _knownBinAssemblies;
|
||||
private IEnumerable<string> _knownRecipes;
|
||||
|
||||
public WebHost(Path orchardTemp) {
|
||||
_orchardTemp = orchardTemp;
|
||||
@@ -97,6 +98,9 @@ namespace Orchard.Specs.Hosting {
|
||||
path => IsSpecFlowTestAssembly(path) && !_tempSite.Combine("bin").Combine(path.FileName).Exists,
|
||||
_tempSite.Combine("bin"));
|
||||
|
||||
Log("Copy Orchard recipes");
|
||||
_orchardWebPath.Combine("Modules").Combine("Orchard.Setup").Combine("Recipes").DeepCopy("*.xml", _tempSite.Combine("Modules").Combine("Orchard.Setup").Combine("Recipes"));
|
||||
|
||||
StartAspNetHost(virtualDirectory);
|
||||
|
||||
Log("ASP.NET host initialization completed in {0} sec", stopwatch.Elapsed.TotalSeconds);
|
||||
|
@@ -48,7 +48,6 @@ Scenario: Calling setup on a brand new install
|
||||
| SiteName | My Site |
|
||||
| AdminPassword | 6655321 |
|
||||
| ConfirmPassword | 6655321 |
|
||||
| Recipe | Minimal |
|
||||
And I hit "Finish Setup"
|
||||
And I go to "/"
|
||||
Then I should see "My Site"
|
||||
|
11
src/Orchard.Specs/Setup.feature.cs
generated
11
src/Orchard.Specs/Setup.feature.cs
generated
@@ -203,18 +203,15 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table5.AddRow(new string[] {
|
||||
"ConfirmPassword",
|
||||
"6655321"});
|
||||
table5.AddRow(new string[] {
|
||||
"Recipe",
|
||||
"Minimal"});
|
||||
#line 46
|
||||
testRunner.When("I fill in", ((string)(null)), table5);
|
||||
#line 52
|
||||
#line 51
|
||||
testRunner.And("I hit \"Finish Setup\"");
|
||||
#line 53
|
||||
#line 52
|
||||
testRunner.And("I go to \"/\"");
|
||||
#line 54
|
||||
#line 53
|
||||
testRunner.Then("I should see \"My Site\"");
|
||||
#line 55
|
||||
#line 54
|
||||
testRunner.And("I should see \"Welcome, <strong><a href=\"/Users/Account/ChangePassword\">admin</a><" +
|
||||
"/strong>!\"");
|
||||
#line hidden
|
||||
|
@@ -19,6 +19,7 @@ namespace Orchard.Setup.Controllers {
|
||||
private readonly IViewsBackgroundCompilation _viewsBackgroundCompilation;
|
||||
private readonly INotifier _notifier;
|
||||
private readonly ISetupService _setupService;
|
||||
private const string DefaultRecipe = "Default";
|
||||
|
||||
public SetupController(
|
||||
INotifier notifier,
|
||||
@@ -41,13 +42,13 @@ namespace Orchard.Setup.Controllers {
|
||||
|
||||
public ActionResult Index() {
|
||||
var initialSettings = _setupService.Prime();
|
||||
var recipes = (List<Recipe>)_setupService.Recipes();
|
||||
var recipes = _setupService.Recipes().Where(r => r.Name != DefaultRecipe);
|
||||
|
||||
// On the first time installation of Orchard, the user gets to the setup screen, which
|
||||
// will take a while to finish (user inputting data and the setup process itself).
|
||||
// We use this opportunity to start a background task to "pre-compile" all the known
|
||||
// views in the app folder, so that the application is more reponsive when the user
|
||||
// hits the homepage and admin screens for the first time.
|
||||
// hits the homepage and admin screens for the first time.))
|
||||
if (StringComparer.OrdinalIgnoreCase.Equals(initialSettings.Name, ShellSettings.DefaultName)) {
|
||||
_viewsBackgroundCompilation.Start();
|
||||
}
|
||||
@@ -77,17 +78,14 @@ namespace Orchard.Setup.Controllers {
|
||||
ModelState.AddModelError("DatabaseTablePrefix", T("The table prefix must begin with a letter").Text);
|
||||
}
|
||||
}
|
||||
if (String.IsNullOrEmpty(model.Recipe)) {
|
||||
ModelState.AddModelError("Recipe", T("You must choose a recipe. Recipes come from the Recipes folder of your Setup module.").Text);
|
||||
if (model.Recipe == null) {
|
||||
model.Recipe = DefaultRecipe;
|
||||
}
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
var recipes = (List<Recipe>)_setupService.Recipes();
|
||||
var recipes = _setupService.Recipes().Where(r => r.Name != DefaultRecipe);
|
||||
model.Recipes = recipes;
|
||||
if (!String.IsNullOrEmpty(model.Recipe)) {
|
||||
foreach (var recipe in recipes.Where(recipe => recipe.Name == model.Recipe)) {
|
||||
model.RecipeDescription = recipe.Description;
|
||||
}
|
||||
foreach (var recipe in recipes.Where(recipe => recipe.Name == model.Recipe)) {
|
||||
model.RecipeDescription = recipe.Description;
|
||||
}
|
||||
model.DatabaseIsPreconfigured = !string.IsNullOrEmpty(_setupService.Prime().DataProvider);
|
||||
|
||||
|
@@ -77,6 +77,7 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Content\synchronizing.gif" />
|
||||
<Content Include="Recipes\blog.recipe.xml" />
|
||||
<Content Include="Recipes\default.recipe.xml" />
|
||||
<Content Include="Recipes\customcontentsite.recipe.xml" />
|
||||
<Content Include="Recipes\minimal.recipe.xml" />
|
||||
<Content Include="Scripts\setup.js" />
|
||||
|
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0"?>
|
||||
<Orchard>
|
||||
<Recipe>
|
||||
<Name>Default</Name>
|
||||
<Description>A recipe providing a default Orchard installation profile.</Description>
|
||||
<Author>The Orchard Team</Author>
|
||||
<WebSite>http://orchardproject.net</WebSite>
|
||||
<Tags></Tags>
|
||||
<Version>1.0</Version>
|
||||
</Recipe>
|
||||
|
||||
<Feature enable="Orchard.Blogs,Orchard.Comments,Orchard.Tags,
|
||||
Orchard.Lists,TinyMce,Orchard.Media,Orchard.PublishLater,
|
||||
Orchard.jQuery,Orchard.Widgets,Orchard.ContentTypes,
|
||||
Orchard.Scripting,Orchard.Scripting.Lightweight,
|
||||
PackagingServices,Orchard.Packaging,Gallery,
|
||||
TheThemeMachine" />
|
||||
|
||||
<Metadata>
|
||||
<Types>
|
||||
<Page ContentTypeSettings.Draftable="True" TypeIndexing.Included="true">
|
||||
<TagsPart />
|
||||
<LocalizationPart />
|
||||
</Page>
|
||||
<BlogPost ContentTypeSettings.Draftable="True" TypeIndexing.Included="true">
|
||||
<CommentsPart />
|
||||
<TagsPart />
|
||||
<LocalizationPart />
|
||||
</BlogPost>
|
||||
</Types>
|
||||
<Parts>
|
||||
<BodyPart BodyPartSettings.FlavorDefault="html" />
|
||||
</Parts>
|
||||
</Metadata>
|
||||
|
||||
<Settings />
|
||||
|
||||
<Command>
|
||||
layer create /Name:"Default" /LayerRule:"true"
|
||||
layer create /Name:"Authenticated" /LayerRule:"authenticated"
|
||||
layer create /Name:"Anonymous" /LayerRule:"not authenticated"
|
||||
layer create /Name:"Disabled" /LayerRule:"false"
|
||||
layer create /Name:"TheHomepage" /LayerRule:"url '~/'"
|
||||
page create /Slug:"welcome-to-orchard" /Title:"Welcome to Orchard!" /Path:"welcome-to-orchard" /Homepage:true /Publish:true /UseWelcomeText:true
|
||||
widget create /Type:"HtmlWidget" /Title:"First Leader Aside" /Zone:"TripelFirst" /Position:"5" /Layer:"TheHomepage" /UseLoremIpsumText:true
|
||||
widget create /Type:"HtmlWidget" /Title:"Second Leader Aside" /Zone:"TripelSecond" /Position:"5" /Layer:"TheHomepage" /UseLoremIpsumText:true
|
||||
widget create /Type:"HtmlWidget" /Title:"Third Leader Aside" /Zone:"TripelThird" /Position:"5" /Layer:"TheHomepage" /UseLoremIpsumText:true
|
||||
menuitem create /MenuPosition:"1" /MenuText:"Home" /Url:"" /OnMainMenu:true
|
||||
</Command>
|
||||
|
||||
<Migration features="*" />
|
||||
</Orchard>
|
@@ -52,7 +52,7 @@ if (!Model.DatabaseIsPreconfigured) {
|
||||
</fieldset>
|
||||
}
|
||||
<fieldset>
|
||||
<legend>@T("Choose an Orchard Recipe")</legend>
|
||||
<legend>@T("Choose an Orchard Recipe (Optional)")</legend>
|
||||
<div>@T("Orchard Recipes allow you to setup your site with additional pre-configured options, features and settings out of the box")</div>
|
||||
<div>
|
||||
<select id="@Html.FieldIdFor(m => m.Recipe)" name="@Html.FieldNameFor(m => m.Recipe)" class="recipe">
|
||||
|
Reference in New Issue
Block a user