Fixing UI glitches in placement editor

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-06-08 12:16:34 -07:00
parent 48b6e70987
commit 2b4495cf22
5 changed files with 28 additions and 31 deletions

View File

@@ -107,7 +107,6 @@
<Content Include="Views\EditorTemplates\Fields.cshtml" />
<Content Include="Views\EditorTemplates\TypePart.cshtml" />
<Content Include="Views\EditorTemplates\TypeParts.cshtml" />
<Content Include="Views\EditorTemplates\Settings.cshtml" />
<Content Include="Views\Web.config" />
</ItemGroup>
<ItemGroup>

View File

@@ -130,6 +130,7 @@ fieldset.action {
#placement li .shape-editor {
padding: 10px;
background: white;
}
#save-message {
@@ -137,12 +138,14 @@ fieldset.action {
margin-bottom: 10px;
}
.overlay{
background:red repeat top left;
position:fixed;
top:0px;
bottom:0px;
left:0px;
right:0px;
z-index:100;
#placement fieldset
{
float: inherit; /* prevent bad layout if float is defined to left in specific parts, e.g. datetimepicker */
height: auto;
}
.placement-placeholder {
background: #FDF5BC;
border: 1px solid #FDF5BC;
height: 100px;
}

View File

@@ -5,12 +5,13 @@
Layout.Title = T("Edit Content Type - {0}", Model.DisplayName).ToString();
}
<div class="manage">
@Html.ActionLink(T("Edit Placement").Text, "EditPlacement", new { area = "Orchard.ContentTypes", id = Model.Name }, new { @class = "button" })
</div>
@using (Html.BeginFormAntiForgeryPost()) {
// todo: come up with real itemtype definitions and locations for said definitions
<div itemscope="itemscope" itemid="@Model.Name" itemtype="http://orchardproject.net/data/ContentType">
<div class="manage add-to-type">
@Html.ActionLink(T("Edit Placement").Text, "EditPlacement", new { area = "Orchard.ContentTypes", id = Model.Name }, new { @class = "button" })
</div>
@Html.ValidationSummary()
<fieldset>
<label for="DisplayName">@T("Display Name")</label>
@@ -34,8 +35,6 @@
@Html.ActionLink(T("Add Parts").Text, "AddPartsTo", new { area = "Orchard.ContentTypes", id = Model.Name }, new { @class = "button" })
</div>
@Html.EditorFor(m => m.Parts, "TypeParts", "")
<h2>@T("Placement")</h2>
@Html.EditorFor(m => m.Settings, "Placement", "")
</div>
<fieldset class="action">
<button class="primaryAction" type="submit" name="submit.Save" value="Save">@T("Save")</button>

View File

@@ -18,6 +18,10 @@
var placement = Model.AllPlacements[i].PlacementSettings;
if(placement.Zone != "Content") {
continue;
}
<li data-shape-type="@placement.ShapeType" data-shape-differentiator="@placement.Differentiator" data-shape-zone="Content" data-shape-position="@placement.Position">
<div class="shape-type"><h3>@placement.ShapeType @placement.Differentiator</h3></div>
<div class="shape-editor">@Display(Model.AllPlacements[i].Shape)</div>
@@ -45,6 +49,7 @@
var startPos;
$('#placement').sortable({
placeholder: "placement-placeholder",
start: function (event, ui) {
var self = $(ui.item);
startPos = self.prevAll().size();
@@ -56,6 +61,11 @@
var begin = Math.min(startPos, stopPos);
var end = Math.max(startPos, stopPos);
// do nothing if it was put in place
if (begin == end) {
return;
}
// get siblings ( .siblings() doesn't include itself)
var siblings = self.parent().children();
for (var i = begin; i < end; i++) {
@@ -81,9 +91,12 @@
}
$('#save-message').show();
}
});
$('.shape-editor *').attr('disabled', 'disabled');
$("#placement").disableSelection();
})(jQuery);

View File

@@ -1,17 +0,0 @@
@model SettingsDictionary
@using Orchard.ContentManagement.MetaData.Models;
@if (Model.Any()) {
<fieldset>
@{
var si = 0;
foreach (var setting in Model) {
var s = setting;
var htmlFieldName = string.Format("Settings[{0}]", si++);
// doesn't gen a similarly sanitized id as the other inputs...*/
<label for="@ViewData.TemplateInfo.GetFullHtmlFieldId(htmlFieldName + ".Value")">@s.Key</label>
Html.Hidden(htmlFieldName + ".Key", s.Key);
Html.TextBox(htmlFieldName + ".Value", s.Value);
}
}
</fieldset>
}