mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-21 03:14:10 +08:00
Removing customcontentsite recipe.
Making Default the default option on the recipe dropdown. Few related changes. --HG-- branch : dev
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Recipes.Models;
|
||||
using Orchard.Setup.Services;
|
||||
using Orchard.Setup.ViewModels;
|
||||
using Orchard.Localization;
|
||||
@@ -40,7 +42,11 @@ namespace Orchard.Setup.Controllers {
|
||||
|
||||
public ActionResult Index() {
|
||||
var initialSettings = _setupService.Prime();
|
||||
var recipes = _setupService.Recipes().Where(r => r.Name != DefaultRecipe);
|
||||
var recipes = OrderRecipes(_setupService.Recipes());
|
||||
string recipeDescription = null;
|
||||
if (recipes.Count > 0) {
|
||||
recipeDescription = recipes[0].Description;
|
||||
}
|
||||
|
||||
// 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).
|
||||
@@ -56,12 +62,15 @@ namespace Orchard.Setup.Controllers {
|
||||
return IndexViewResult(new SetupViewModel {
|
||||
AdminUsername = "admin",
|
||||
DatabaseIsPreconfigured = !string.IsNullOrEmpty(initialSettings.DataProvider),
|
||||
Recipes = recipes
|
||||
Recipes = recipes,
|
||||
RecipeDescription = recipeDescription
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Index")]
|
||||
public ActionResult IndexPOST(SetupViewModel model) {
|
||||
var recipes = OrderRecipes(_setupService.Recipes());
|
||||
|
||||
//TODO: Couldn't get a custom ValidationAttribute to validate two properties
|
||||
if (!model.DatabaseOptions && string.IsNullOrEmpty(model.DatabaseConnectionString))
|
||||
ModelState.AddModelError("DatabaseConnectionString", T("A SQL connection string is required").Text);
|
||||
@@ -77,10 +86,14 @@ namespace Orchard.Setup.Controllers {
|
||||
}
|
||||
}
|
||||
if (model.Recipe == null) {
|
||||
model.Recipe = DefaultRecipe;
|
||||
if (!(recipes.Select(r => r.Name).Contains(DefaultRecipe))) {
|
||||
ModelState.AddModelError("Recipe", T("No recipes were found in the Setup module").Text);
|
||||
}
|
||||
else {
|
||||
model.Recipe = DefaultRecipe;
|
||||
}
|
||||
}
|
||||
if (!ModelState.IsValid) {
|
||||
var recipes = _setupService.Recipes().Where(r => r.Name != DefaultRecipe);
|
||||
model.Recipes = recipes;
|
||||
foreach (var recipe in recipes.Where(recipe => recipe.Name == model.Recipe)) {
|
||||
model.RecipeDescription = recipe.Description;
|
||||
@@ -117,5 +130,19 @@ namespace Orchard.Setup.Controllers {
|
||||
return IndexViewResult(model);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Recipe> OrderRecipes(IEnumerable<Recipe> recipes) {
|
||||
var recipeList = new List<Recipe>();
|
||||
var tempList = new List<Recipe>();
|
||||
foreach (var recipe in recipes) {
|
||||
if (recipe.Name == DefaultRecipe) {
|
||||
recipeList.Add(recipe);
|
||||
}
|
||||
else {
|
||||
tempList.Add(recipe);
|
||||
}
|
||||
}
|
||||
return recipeList.Concat(tempList).ToList();
|
||||
}
|
||||
}
|
||||
}
|
@@ -78,7 +78,6 @@
|
||||
<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" />
|
||||
<Content Include="Views\Setup\Index.cshtml" />
|
||||
|
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<Orchard>
|
||||
<Recipe>
|
||||
<Name>Custom Content Site</Name>
|
||||
<Description>A recipe providing an installation profile with the functionality needed to create content-based custom sites.</Description>
|
||||
<Author>The Orchard Team</Author>
|
||||
<WebSite>http://orchardproject.net</WebSite>
|
||||
<Tags></Tags>
|
||||
<Version>1.0</Version>
|
||||
</Recipe>
|
||||
|
||||
<Feature enable="Orchard.ContentTypes,Orchard.Lists,Orchard.PublishLater,
|
||||
Orchard.jQuery,TinyMce,Orchard.Media,Orchard.MediaPicker,
|
||||
PackagingServices,Orchard.Packaging,Gallery,TheThemeMachine" />
|
||||
|
||||
<Metadata>
|
||||
<Types>
|
||||
<Page ContentTypeSettings.Draftable="True" TypeIndexing.Included="true" />
|
||||
</Types>
|
||||
<Parts>
|
||||
<BodyPart BodyPartSettings.FlavorDefault="html" />
|
||||
<!-- Dynamic parts -->
|
||||
</Parts>
|
||||
</Metadata>
|
||||
|
||||
<Settings>
|
||||
</Settings>
|
||||
|
||||
<Command>
|
||||
page create /Slug:"welcome-to-orchard" /Title:"Welcome to Orchard!" /Path:"welcome-to-orchard" /Homepage:true /Publish:true /UseWelcomeText:true
|
||||
menuitem create /MenuPosition:"1" /MenuText:"Home" /Url:"" /OnMainMenu:true
|
||||
</Command>
|
||||
|
||||
<Migration features="*" />
|
||||
</Orchard>
|
@@ -2,7 +2,7 @@
|
||||
<Orchard>
|
||||
<Recipe>
|
||||
<Name>Default</Name>
|
||||
<Description>A recipe providing a default Orchard installation profile.</Description>
|
||||
<Description>The default recipe for an Orchard site that includes pages, blogs, custom content types, comments, tags, widgets and basic navigation.</Description>
|
||||
<Author>The Orchard Team</Author>
|
||||
<WebSite>http://orchardproject.net</WebSite>
|
||||
<Tags></Tags>
|
||||
|
@@ -52,12 +52,10 @@ if (!Model.DatabaseIsPreconfigured) {
|
||||
</fieldset>
|
||||
}
|
||||
<fieldset>
|
||||
<legend>@T("Choose an Orchard Recipe (Optional)")</legend>
|
||||
<legend>@T("Choose an Orchard Recipe")</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">
|
||||
@Html.SelectOption("", false, T("Choose").ToString(), new { recipedescription = "" })
|
||||
@Html.SelectOption("", false, T("-------------------").ToString(), new { recipedescription = "" })
|
||||
@foreach(var recipe in Model.Recipes) {
|
||||
@Html.SelectOption(Model.Recipe, recipe.Name, recipe.Name, new { recipedescription = recipe.Description })
|
||||
}
|
||||
|
Reference in New Issue
Block a user