Applied Louis comments.

--HG--
branch : dev
This commit is contained in:
Andre Rodrigues
2010-10-11 15:51:44 -07:00
parent 71d3c9c32a
commit 36fb567212
10 changed files with 36 additions and 44 deletions

View File

@@ -8,11 +8,6 @@ using Orchard.Security;
namespace Orchard.Blogs.Models { namespace Orchard.Blogs.Models {
public class BlogPostPart : ContentPart { public class BlogPostPart : ContentPart {
[HiddenInput(DisplayValue = false)]
public int Id {
get { return ContentItem.Id; }
}
public string Title { public string Title {
get { return this.As<RoutePart>().Title; } get { return this.As<RoutePart>().Title; }
set { this.As<RoutePart>().Title = value; } set { this.As<RoutePart>().Title = value; }

View File

@@ -17,7 +17,6 @@ namespace Orchard.Roles.Models {
} }
class SimulatedUser : ContentPart, IUser { class SimulatedUser : ContentPart, IUser {
public int Id { get { return ContentItem.Id; } }
public string UserName { get { return null; } } public string UserName { get { return null; } }
public string Email { get { return null; } } public string Email { get { return null; } }
} }

View File

@@ -70,7 +70,7 @@ namespace Orchard.Widgets {
.WithPart("WidgetPart") .WithPart("WidgetPart")
.WithPart("BodyPart") .WithPart("BodyPart")
.WithPart("CommonPart") .WithPart("CommonPart")
.WithSetting("stereotype", "widget") .WithSetting("Stereotype", "Widget")
); );
CreateDefaultLayers(); CreateDefaultLayers();

View File

@@ -5,14 +5,6 @@ using Orchard.ContentManagement;
namespace Orchard.Widgets.Models { namespace Orchard.Widgets.Models {
public class LayerPart : ContentPart<LayerPartRecord> { public class LayerPart : ContentPart<LayerPartRecord> {
/// <summary>
/// The layer's identifier.
/// </summary>
[HiddenInput(DisplayValue = false)]
public int Id {
get { return ContentItem.Id; }
}
/// <summary> /// <summary>
/// The layer's name. /// The layer's name.
/// </summary> /// </summary>

View File

@@ -7,14 +7,6 @@ using Orchard.ContentManagement.Aspects;
namespace Orchard.Widgets.Models { namespace Orchard.Widgets.Models {
public class WidgetPart : ContentPart<WidgetPartRecord> { public class WidgetPart : ContentPart<WidgetPartRecord> {
/// <summary>
/// The widget's identifier.
/// </summary>
[HiddenInput(DisplayValue = false)]
public int Id {
get { return ContentItem.Id; }
}
/// <summary> /// <summary>
/// The widget's title. /// The widget's title.
/// </summary> /// </summary>

View File

@@ -23,7 +23,7 @@ namespace Orchard.Widgets.Services {
public IEnumerable<string> GetWidgetTypes() { public IEnumerable<string> GetWidgetTypes() {
return _contentManager.GetContentTypeDefinitions() return _contentManager.GetContentTypeDefinitions()
.Where(contentTypeDefinition => contentTypeDefinition.Settings.ContainsKey("stereotype") && contentTypeDefinition.Settings["stereotype"] == "widget") .Where(contentTypeDefinition => contentTypeDefinition.Settings.ContainsKey("Stereotype") && contentTypeDefinition.Settings["Stereotype"] == "Widget")
.Select(contentTypeDefinition => contentTypeDefinition.Name); .Select(contentTypeDefinition => contentTypeDefinition.Name);
} }

View File

@@ -3,23 +3,23 @@
font-weight:bold; font-weight:bold;
} }
.availableWidgets { .widgets-availableWidgets {
float: left; float: left;
width: 35%; width: 35%;
} }
.availableLayers { .widgets-availableLayers {
float: left; float: left;
margin: 0 0 0 2em; margin: 0 0 0 2em;
width: 45%; width: 45%;
} }
.layerZones { .widgets-layerZones {
float: left; float: left;
width: 75%; width: 75%;
} }
.layerZones .zone { .widgets-layerZones .widgets-zone {
font-weight:700; font-weight:700;
background:#f5f5f5; background:#f5f5f5;
border: 1px solid #f1f1f1; border: 1px solid #f1f1f1;
@@ -27,7 +27,7 @@
margin: 0 0 1em 0; margin: 0 0 1em 0;
} }
.layerZones .zoneWidget { .widgets-layerZones .widgets-zoneWidget {
margin: 0 0 1em 0; margin: 0 0 1em 0;
padding: 1em 2em 1em 3em; padding: 1em 2em 1em 3em;
background:#ffffff; background:#ffffff;
@@ -35,26 +35,26 @@
vertical-align: middle; vertical-align: middle;
} }
.layers { .widgets-layers {
margin: 1em 0 0 0; margin: 1em 0 0 0;
float: left; float: left;
} }
.layers ul { .widgets-layers ul {
background: #f5f5f5; background: #f5f5f5;
border: 1px solid #f1f1f1; border: 1px solid #f1f1f1;
} }
.layers .currentLayer { .widgets-layers .widgets-currentLayer {
background: #c3d9ff; background: #c3d9ff;
} }
.layers .editLayer img { .widgets-layers .widgets-editLayer img {
float: right; float: right;
margin: 0 0 0 1em; margin: 0 0 0 1em;
} }
.layerZones ul li ul { .widgets-layerZones ul li ul {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }

View File

@@ -10,9 +10,9 @@
<div class="manage">@Html.ActionLink(T("Add a layer").ToString(), "AddLayer", new { }, new { @class = "button primaryAction" })</div> <div class="manage">@Html.ActionLink(T("Add a layer").ToString(), "AddLayer", new { }, new { @class = "button primaryAction" })</div>
<div id="widgets" class="widgets"> <div id="widgets">
<div class="availableWidgets"> <div class="widgets-availableWidgets">
<h2>Available Widgets</h2> <h2>Available Widgets</h2>
<fieldset> <fieldset>
@@ -38,18 +38,18 @@
</fieldset> </fieldset>
</div> </div>
<div class="availableLayers"> <div class="widgets-availableLayers">
<h2>Widget Layers</h2> <h2>Widget Layers</h2>
<fieldset> <fieldset>
<div class="layerZonesWidgets"> <div>
<ul class="layerZones"> <ul class="widgets-layerZones">
@foreach (string zone in Model.Zones) { @foreach (string zone in Model.Zones) {
<li> <li>
<div class="zone">@zone</div> <div class="widgets-zone">@zone</div>
<ul> <ul>
@foreach (WidgetPart widget in Model.CurrentLayerWidgets.Where(widgetPart => widgetPart.Zone == zone).OrderBy(widgetPart => widgetPart.Position)) { @foreach (WidgetPart widget in Model.CurrentLayerWidgets.Where(widgetPart => widgetPart.Zone == zone).OrderBy(widgetPart => widgetPart.Position)) {
<li class="zoneWidget"> <li class="widgets-zoneWidget">
@if (widget.Position != "1") { @if (widget.Position != "1") {
<input type="image" name="submit.MoveUp.@widget.Id" src="@Url.Content("~/modules/orchard.widgets/Content/Admin/images/moveup.gif")" alt="Move up" value="@widget.Id" /> <input type="image" name="submit.MoveUp.@widget.Id" src="@Url.Content("~/modules/orchard.widgets/Content/Admin/images/moveup.gif")" alt="Move up" value="@widget.Id" />
} }
@@ -65,18 +65,18 @@
</ul> </ul>
</div> </div>
<div class="layers"> <div class="widgets-layers">
<ul> <ul>
@foreach (var layer in Model.Layers) { @foreach (var layer in Model.Layers) {
if (layer.Id == Model.CurrentLayer.Id) { if (layer.Id == Model.CurrentLayer.Id) {
<li class="currentLayer editLayer"> <li class="widgets-currentLayer widgets-editLayer">
@Html.ActionLink(@layer.Name, "Index", new { @layer.Id }) @Html.ActionLink(@layer.Name, "Index", new { @layer.Id })
<a href="@Url.Action("EditLayer", new { @layer.Id })"> <a href="@Url.Action("EditLayer", new { @layer.Id })">
<img width="15" height="15" src="@Url.Content("~/modules/orchard.widgets/Content/Admin/images/edit.gif")" /> <img width="15" height="15" src="@Url.Content("~/modules/orchard.widgets/Content/Admin/images/edit.gif")" />
</a> </a>
</li> </li>
} else { } else {
<li class="editLayer"> <li class="widgets-editLayer">
@Html.ActionLink(@layer.Name, "Index", new { @layer.Id }) @Html.ActionLink(@layer.Name, "Index", new { @layer.Id })
<a href="@Url.Action("EditLayer", new { @layer.Id })"> <a href="@Url.Action("EditLayer", new { @layer.Id })">
<img width="15" height="15" src="@Url.Content("~/modules/orchard.widgets/Content/Admin/images/edit.gif")" /> <img width="15" height="15" src="@Url.Content("~/modules/orchard.widgets/Content/Admin/images/edit.gif")" />

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Web.Mvc;
using Orchard.ContentManagement.MetaData.Models; using Orchard.ContentManagement.MetaData.Models;
using Orchard.ContentManagement.Utilities; using Orchard.ContentManagement.Utilities;
using Orchard.UI; using Orchard.UI;
@@ -23,6 +24,14 @@ namespace Orchard.ContentManagement {
} }
} }
/// <summary>
/// The ContentItem's identifier.
/// </summary>
[HiddenInput(DisplayValue = false)]
public int Id {
get { return ContentItem.Id; }
}
public ContentTypeDefinition TypeDefinition { get { return ContentItem.TypeDefinition; } } public ContentTypeDefinition TypeDefinition { get { return ContentItem.TypeDefinition; } }
public ContentTypePartDefinition TypePartDefinition { get; set; } public ContentTypePartDefinition TypePartDefinition { get; set; }
public ContentPartDefinition PartDefinition { get { return TypePartDefinition.PartDefinition; } } public ContentPartDefinition PartDefinition { get { return TypePartDefinition.PartDefinition; } }

View File

@@ -3,5 +3,10 @@
namespace Orchard.ContentManagement { namespace Orchard.ContentManagement {
public interface IContent { public interface IContent {
ContentItem ContentItem { get; } ContentItem ContentItem { get; }
/// <summary>
/// The ContentItem's identifier.
/// </summary>
int Id { get; }
} }
} }