mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-21 11:17:28 +08:00
Setup UI for recipes
Choose a recipe is shown if there are recipes in the setup module Added jquery to the setup view Recipe description gets shown for selected option via jquery --HG-- branch : recipe
This commit is contained in:
@@ -35,7 +35,7 @@ namespace Orchard.Setup.Controllers {
|
||||
|
||||
public ActionResult Index() {
|
||||
var initialSettings = _setupService.Prime();
|
||||
|
||||
|
||||
// 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
|
||||
@@ -46,7 +46,11 @@ namespace Orchard.Setup.Controllers {
|
||||
}
|
||||
|
||||
//
|
||||
return IndexViewResult(new SetupViewModel { AdminUsername = "admin", DatabaseIsPreconfigured = !string.IsNullOrEmpty(initialSettings.DataProvider)});
|
||||
|
||||
return IndexViewResult(new SetupViewModel {
|
||||
AdminUsername = "admin",
|
||||
DatabaseIsPreconfigured = !string.IsNullOrEmpty(initialSettings.DataProvider),
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Index")]
|
||||
@@ -68,6 +72,8 @@ namespace Orchard.Setup.Controllers {
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
model.DatabaseIsPreconfigured = !string.IsNullOrEmpty(_setupService.Prime().DataProvider);
|
||||
// set HasRecipes flag
|
||||
// set recipedescription
|
||||
return IndexViewResult(model);
|
||||
}
|
||||
|
||||
|
@@ -12,3 +12,12 @@
|
||||
document.forms[0].attachEvent("onsubmit", show);
|
||||
}
|
||||
})();
|
||||
|
||||
(function ($) {
|
||||
$("select.recipe").change(function () { // class="recipe" on the select element
|
||||
var description = $(this).find(":selected").attr("recipedescription"); // reads the html attribute of the selected option
|
||||
$("#recipedescription").text(description); // make the contents of <div id="recipe-description"></div> be the escaped description string
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
|
||||
|
@@ -23,7 +23,6 @@ using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Indexing;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Localization.Services;
|
||||
using Orchard.Recipes.Services;
|
||||
using Orchard.Reports.Services;
|
||||
using Orchard.Security;
|
||||
using Orchard.Settings;
|
||||
@@ -205,9 +204,6 @@ namespace Orchard.Setup.Services {
|
||||
}
|
||||
|
||||
private void CreateTenantData(SetupContext context, IWorkContextScope environment) {
|
||||
var recipeManager = environment.Resolve<IRecipeManager>();
|
||||
var setupRecipes = recipeManager.DiscoverRecipes("Orchard.Setup");
|
||||
|
||||
// create superuser
|
||||
var membershipService = environment.Resolve<IMembershipService>();
|
||||
var user =
|
||||
|
@@ -1,3 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Recipes.Models;
|
||||
using Orchard.Setup.Annotations;
|
||||
|
||||
namespace Orchard.Setup.ViewModels {
|
||||
@@ -19,5 +21,9 @@ namespace Orchard.Setup.ViewModels {
|
||||
public string DatabaseConnectionString { get; set; }
|
||||
public string DatabaseTablePrefix { get; set; }
|
||||
public bool DatabaseIsPreconfigured { get; set; }
|
||||
|
||||
public bool HasRecipes { get; set; }
|
||||
public IEnumerable<Recipe> Recipes { get; set; }
|
||||
public string Recipe { get; set; }
|
||||
}
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
@model Orchard.Setup.ViewModels.SetupViewModel
|
||||
@{
|
||||
Script.Require("jquery").AtFoot();
|
||||
Script.Include("setup.js").AtFoot();
|
||||
}
|
||||
<h1>@Html.TitleForPage(T("Get Started").ToString())</h1>
|
||||
@@ -50,6 +51,22 @@ if (!Model.DatabaseIsPreconfigured) {
|
||||
</div>
|
||||
</fieldset>
|
||||
}
|
||||
if (Model.HasRecipes) {
|
||||
<fieldset>
|
||||
<legend>@T("Use an Orchard Recipe during setup (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">
|
||||
@Html.SelectOption("", false, "Choose")
|
||||
@Html.SelectOption("", false, "-------------------")
|
||||
@foreach(var recipe in Model.Recipes) {
|
||||
@Html.SelectOption(Model.Recipe, recipe.Name, recipe.Name, new { recipedescription = recipe.Description })
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div id="recipedescription"></div>
|
||||
</fieldset>
|
||||
}
|
||||
<div id="throbber">
|
||||
<div class="curtain"></div>
|
||||
<div class="curtain-content">
|
||||
|
Reference in New Issue
Block a user