fix multitenancy ui glitch

This commit is contained in:
Matthew Harris 2015-10-09 10:45:17 +01:00
parent 1e87eee2e4
commit e853550bda
3 changed files with 68 additions and 62 deletions

View File

@ -14,5 +14,7 @@
$allCheckboxes.prop("checked", false); $allCheckboxes.prop("checked", false);
} }
}); });
$('input[name=DataProvider]:checked').click();
}); });
})(jQuery); })(jQuery);

View File

@ -4,18 +4,19 @@
Layout.Title = T("Add New Tenant").ToString(); Layout.Title = T("Add New Tenant").ToString();
Script.Require("jQuery").AtFoot(); Script.Require("jQuery").AtFoot();
Script.Include(Url.Content("~/Themes/TheAdmin/Scripts/admin.js")).AtFoot(); Script.Require("ShapesBase").AtFoot();
Script.Include(Url.Content("~/Themes/TheAdmin/Scripts/admin.js")).AtFoot();
Script.Include("multi-tenancy.admin.js").AtFoot(); Script.Include("multi-tenancy.admin.js").AtFoot();
} }
@using (Html.BeginFormAntiForgeryPost()) { @using (Html.BeginFormAntiForgeryPost()) {
@Html.ValidationSummary() @Html.ValidationSummary()
<fieldset> <fieldset>
<div> <div>
<label for="@Html.FieldIdFor(m => m.Name)">@T("Name")</label> <label for="@Html.FieldIdFor(m => m.Name)">@T("Name")</label>
@Html.TextBoxFor(m => m.Name, new { @class = "text" }) @Html.TextBoxFor(m => m.Name, new { @class = "text" })
<span class="hint">@T("The name of the tenant as it will be displayed in the admin.")</span> <span class="hint">@T("The name of the tenant as it will be displayed in the admin.")</span>
</div> </div>
<div> <div>
<label for="@Html.FieldIdFor(m => m.RequestUrlHost)">@T("Host")</label> <label for="@Html.FieldIdFor(m => m.RequestUrlHost)">@T("Host")</label>
@Html.TextBoxFor(m => m.RequestUrlHost, new { @class = "text medium" }) @Html.TextBoxFor(m => m.RequestUrlHost, new { @class = "text medium" })
@ -30,7 +31,7 @@
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend>@T("Database Setup")</legend> <legend>@T("Database Setup")</legend>
<div> <div>
@Html.RadioButtonFor(svm => svm.DataProvider, "", new { id = "tenantDatabaseOption" }) @Html.RadioButtonFor(svm => svm.DataProvider, "", new { id = "tenantDatabaseOption" })
<label for="tenantDatabaseOption" class="forcheckbox">@T("Allow the tenant to set up the database")</label> <label for="tenantDatabaseOption" class="forcheckbox">@T("Allow the tenant to set up the database")</label>
</div> </div>
@ -48,18 +49,18 @@
<span class="hint">@T("Example:") @T("Data Source=sqlServerName;Initial Catalog=dbName;Persist Security Info=True;User ID=userName;Password=password")</span> <span class="hint">@T("Example:") @T("Data Source=sqlServerName;Initial Catalog=dbName;Persist Security Info=True;User ID=userName;Password=password")</span>
</span> </span>
<span data-controllerid="sqlDatabaseOption"> <span data-controllerid="sqlDatabaseOption">
<label for="DatabaseTablePrefix">@T("Database Table Prefix")</label> <label for="DatabaseTablePrefix">@T("Database table prefix")</label>
@Html.EditorFor(svm => svm.DatabaseTablePrefix) @Html.EditorFor(svm => svm.DatabaseTablePrefix)
</span> </span>
</div> </div>
</div> </div>
</fieldset> </fieldset>
<fieldset class="available-extensions"> <fieldset class="available-extensions">
<label for="@Html.FieldIdFor(m => m.Themes)">@T("Available Themes")</label> <label for="@Html.FieldIdFor(m => m.Themes)">@T("Available Themes")</label>
<div> <div>
<span class="hint">@T("Select the Themes which should be available for this tenant. If none is selected, they will all be available.")</span> <span class="hint">@T("Select the Themes which should be available for this tenant. If none is selected, they will all be available.")</span>
<ol> <ol>
<li> <li>
<input type="checkbox" class="select-all" id="select-all-themes" /> <input type="checkbox" class="select-all" id="select-all-themes" />
@ -79,11 +80,11 @@
} }
</ol> </ol>
</div> </div>
</fieldset> </fieldset>
<fieldset class="available-extensions"> <fieldset class="available-extensions">
<label for="@Html.FieldIdFor(m => m.Modules)">@T("Available Modules")</label> <label for="@Html.FieldIdFor(m => m.Modules)">@T("Available Modules")</label>
<div> <div>
<span class="hint">@T("Select the Modules which should be available for this tenant. If none is selected, they will all be available.")</span> <span class="hint">@T("Select the Modules which should be available for this tenant. If none is selected, they will all be available.")</span>
@ -94,21 +95,21 @@
</li> </li>
@for (var i = 0; i < Model.Modules.Count; i++) { @for (var i = 0; i < Model.Modules.Count; i++) {
<li> <li>
@{ @{
var theme = Model.Modules[i]; var theme = Model.Modules[i];
@Html.CheckBox(Html.FieldNameFor(m => m.Modules[i].Checked), Model.Modules[i].Checked, new { id = Html.FieldIdFor(x => x.Modules[i]) }) @Html.CheckBox(Html.FieldNameFor(m => m.Modules[i].Checked), Model.Modules[i].Checked, new { id = Html.FieldIdFor(x => x.Modules[i]) })
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.Modules[i])">@Model.Modules[i].ModuleName</label> <label class="forcheckbox" for="@Html.FieldIdFor(m => m.Modules[i])">@Model.Modules[i].ModuleName</label>
@Html.HiddenFor(m => m.Modules[i].ModuleId) @Html.HiddenFor(m => m.Modules[i].ModuleId)
@Html.HiddenFor(m => m.Modules[i].ModuleName) @Html.HiddenFor(m => m.Modules[i].ModuleName)
} }
</li> </li>
} }
</ol> </ol>
</div> </div>
</fieldset> </fieldset>
<fieldset> <fieldset>
<button class="primaryAction" type="submit">@T("Save")</button> <button class="primaryAction" type="submit">@T("Save")</button>
</fieldset> </fieldset>
} }

View File

@ -5,11 +5,12 @@
Layout.Title = T("Edit Tenant").ToString(); Layout.Title = T("Edit Tenant").ToString();
Script.Require("jQuery").AtFoot(); Script.Require("jQuery").AtFoot();
Script.Include(Url.Content("~/Themes/TheAdmin/Scripts/admin.js")).AtFoot(); Script.Require("ShapesBase").AtFoot();
Script.Include(Url.Content("~/Themes/TheAdmin/Scripts/admin.js")).AtFoot();
Script.Include("multi-tenancy.admin.js").AtFoot(); Script.Include("multi-tenancy.admin.js").AtFoot();
} }
@using (Html.BeginFormAntiForgeryPost()) { @using (Html.BeginFormAntiForgeryPost()) {
@Html.ValidationSummary() @Html.ValidationSummary()
<fieldset> <fieldset>
<div> <div>
@ -24,19 +25,19 @@
<label for="@Html.FieldIdFor(m => m.RequestUrlPrefix)">@T("URL prefix")</label> <label for="@Html.FieldIdFor(m => m.RequestUrlPrefix)">@T("URL prefix")</label>
@Html.TextBoxFor(m => m.RequestUrlPrefix, new { @class = "text medium" }) @Html.TextBoxFor(m => m.RequestUrlPrefix, new { @class = "text medium" })
<span class="hint">@T("(Optional) Example: If prefix is \"site1\", the tenant URL prefix is \"http://orchardproject.net/site1\"")</span> <span class="hint">@T("(Optional) Example: If prefix is \"site1\", the tenant URL prefix is \"http://orchardproject.net/site1\"")</span>
</div> </div>
</fieldset> </fieldset>
<fieldset> <fieldset>
<legend>@T("Database Setup")</legend> <legend>@T("Database Setup")</legend>
@if (Model.State != TenantState.Uninitialized) { @if (Model.State != TenantState.Uninitialized) {
<div class="warning message">@T("Warning: If you don't know what you're doing you *will* (likely) send this tenant into a downward spiral of irrecoverable disrepair. Have a nice day.")</div> <div class="warning message">@T("Warning: If you don't know what you're doing you *will* (likely) send this tenant into a downward spiral of irrecoverable disrepair. Have a nice day.")</div>
} }
else { else {
<div> <div>
@Html.RadioButtonFor(svm => svm.DataProvider, "", new { id = "tenantDatabaseOption" }) @Html.RadioButtonFor(svm => svm.DataProvider, "", new { id = "tenantDatabaseOption" })
<label for="tenantDatabaseOption" class="forcheckbox">@T("Allow the tenant to set up the database")</label> <label for="tenantDatabaseOption" class="forcheckbox">@T("Allow the tenant to set up the database")</label>
</div> </div>
} }
<div> <div>
@Html.RadioButtonFor(svm => svm.DataProvider, "SqlCe", new { id = "builtinDatabaseOption" }) @Html.RadioButtonFor(svm => svm.DataProvider, "SqlCe", new { id = "builtinDatabaseOption" })
<label for="builtinDatabaseOption" class="forcheckbox">@T("Use built-in data storage (SQL Server Compact)")</label> <label for="builtinDatabaseOption" class="forcheckbox">@T("Use built-in data storage (SQL Server Compact)")</label>
@ -44,23 +45,25 @@
<div> <div>
@Html.RadioButtonFor(svm => svm.DataProvider, "SqlServer", new { id = "sqlDatabaseOption" }) @Html.RadioButtonFor(svm => svm.DataProvider, "SqlServer", new { id = "sqlDatabaseOption" })
<label for="sqlDatabaseOption" class="forcheckbox">@T("Use an existing SQL Server (or SQL Express) database")</label> <label for="sqlDatabaseOption" class="forcheckbox">@T("Use an existing SQL Server (or SQL Express) database")</label>
<span data-controllerid="sqlDatabaseOption"> <div class="options">
<label for="DatabaseConnectionString">@T("Connection string")</label> <span data-controllerid="sqlDatabaseOption">
@Html.TextBoxFor(svm => svm.DatabaseConnectionString, new { @class = "text large" }) <label for="DatabaseConnectionString">@T("Connection string")</label>
<span class="hint">@T("Example:")<br />@T("Data Source=sqlServerName;Initial Catalog=dbName;Persist Security Info=True;User ID=userName;Password=password")</span> @Html.TextBoxFor(svm => svm.DatabaseConnectionString)
</span> <span class="hint">@T("Example:") @T("Data Source=sqlServerName;Initial Catalog=dbName;Persist Security Info=True;User ID=userName;Password=password")</span>
<span data-controllerid="sqlDatabaseOption"> </span>
<label for="DatabaseTablePrefix">@T("Database Table Prefix")</label> <span data-controllerid="sqlDatabaseOption">
@Html.EditorFor(svm => svm.DatabaseTablePrefix) <label for="DatabaseTablePrefix">@T("Database table prefix")</label>
</span> @Html.EditorFor(svm => svm.DatabaseTablePrefix)
</span>
</div>
</div> </div>
</fieldset> </fieldset>
<fieldset class="available-extensions"> <fieldset class="available-extensions">
<label for="@Html.FieldIdFor(m => m.Themes)">@T("Available Themes")</label> <label for="@Html.FieldIdFor(m => m.Themes)">@T("Available Themes")</label>
<div> <div>
<span class="hint">@T("Select the Themes which should be available for this tenant. If none is selected, they will all be available.")</span> <span class="hint">@T("Select the Themes which should be available for this tenant. If none is selected, they will all be available.")</span>
<ol> <ol>
<li> <li>
<input type="checkbox" class="select-all" id="select-all-themes" /> <input type="checkbox" class="select-all" id="select-all-themes" />
@ -80,11 +83,11 @@
} }
</ol> </ol>
</div> </div>
</fieldset> </fieldset>
<fieldset class="available-extensions"> <fieldset class="available-extensions">
<label for="@Html.FieldIdFor(m => m.Modules)">@T("Available Modules")</label> <label for="@Html.FieldIdFor(m => m.Modules)">@T("Available Modules")</label>
<div> <div>
<span class="hint">@T("Select the Modules which should be available for this tenant. If none is selected, they will all be available.")</span> <span class="hint">@T("Select the Modules which should be available for this tenant. If none is selected, they will all be available.")</span>
@ -95,20 +98,20 @@
</li> </li>
@for (var i = 0; i < Model.Modules.Count; i++) { @for (var i = 0; i < Model.Modules.Count; i++) {
<li> <li>
@{ @{
var theme = Model.Modules[i]; var theme = Model.Modules[i];
@Html.CheckBox(Html.FieldNameFor(m => m.Modules[i].Checked), Model.Modules[i].Checked, new { id = Html.FieldIdFor(x => x.Modules[i]) }) @Html.CheckBox(Html.FieldNameFor(m => m.Modules[i].Checked), Model.Modules[i].Checked, new { id = Html.FieldIdFor(x => x.Modules[i]) })
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.Modules[i])">@Model.Modules[i].ModuleName</label> <label class="forcheckbox" for="@Html.FieldIdFor(m => m.Modules[i])">@Model.Modules[i].ModuleName</label>
@Html.HiddenFor(m => m.Modules[i].ModuleId) @Html.HiddenFor(m => m.Modules[i].ModuleId)
@Html.HiddenFor(m => m.Modules[i].ModuleName) @Html.HiddenFor(m => m.Modules[i].ModuleName)
} }
</li> </li>
} }
</ol> </ol>
</div> </div>
</fieldset> </fieldset>
<fieldset> <fieldset>
<button class="primaryAction" type="submit">@T("Save")</button> <button class="primaryAction" type="submit">@T("Save")</button>
</fieldset> </fieldset>