mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 03:25:23 +08:00
Commenting a catch-all route... Refining the item links...
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4041614
This commit is contained in:
@@ -27,22 +27,22 @@ namespace Orchard.Blogs {
|
|||||||
},
|
},
|
||||||
new MvcRouteHandler())
|
new MvcRouteHandler())
|
||||||
},
|
},
|
||||||
new RouteDescriptor {
|
//new RouteDescriptor {
|
||||||
Route = new Route(
|
// Route = new Route(
|
||||||
"{blogSlug}",
|
// "{blogSlug}",
|
||||||
new RouteValueDictionary {
|
// new RouteValueDictionary {
|
||||||
{"area", "Orchard.Blogs"},
|
// {"area", "Orchard.Blogs"},
|
||||||
{"controller", "Blog"},
|
// {"controller", "Blog"},
|
||||||
{"action", "Item"}
|
// {"action", "Item"}
|
||||||
},
|
// },
|
||||||
new RouteValueDictionary()/* {
|
// new RouteValueDictionary()/* {
|
||||||
{"blogSlug", new IsBlogConstraint()}
|
// {"blogSlug", new IsBlogConstraint()}
|
||||||
}*/,
|
// }*/,
|
||||||
new RouteValueDictionary {
|
// new RouteValueDictionary {
|
||||||
{"area", "Orchard.Blogs"}
|
// {"area", "Orchard.Blogs"}
|
||||||
},
|
// },
|
||||||
new MvcRouteHandler())
|
// new MvcRouteHandler())
|
||||||
}
|
// }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
<%=Model.Item.Id %></p>
|
<%=Model.Item.Id %></p>
|
||||||
<p>
|
<p>
|
||||||
ContentType:
|
ContentType:
|
||||||
<%=Model.Item.ContentType%></p>
|
<%=Model.Item.ContentType%> <%=Html.ItemDisplayLink(Model.Item) %> <%=Html.ItemEditLink("edit", Model.Item) %></p>
|
||||||
<h3>
|
<h3>
|
||||||
Content Item Parts</h3>
|
Content Item Parts</h3>
|
||||||
<ul>
|
<ul>
|
||||||
|
@@ -9,6 +9,7 @@ namespace Orchard.Models {
|
|||||||
_parts = new List<IContentItemPart>();
|
_parts = new List<IContentItemPart>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private readonly IList<IContentItemPart> _parts;
|
private readonly IList<IContentItemPart> _parts;
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
@@ -6,27 +6,45 @@ using Orchard.Models;
|
|||||||
namespace Orchard.Mvc.Html {
|
namespace Orchard.Mvc.Html {
|
||||||
public static class ContentItemExtensions {
|
public static class ContentItemExtensions {
|
||||||
public static MvcHtmlString ItemDisplayLink(this HtmlHelper html, string linkText, IContentItemPart item) {
|
public static MvcHtmlString ItemDisplayLink(this HtmlHelper html, string linkText, IContentItemPart item) {
|
||||||
var display = item.As<IContentItemDisplay>();
|
return ItemDisplayLink(html, linkText, item.ContentItem);
|
||||||
var values = display.DisplayRouteValues();
|
|
||||||
return html.ActionLink(linkText, Convert.ToString(values["action"]), values);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MvcHtmlString ItemDisplayLink(this HtmlHelper html, IContentItemPart item) {
|
public static MvcHtmlString ItemDisplayLink(this HtmlHelper html, IContentItemPart item) {
|
||||||
var display = item.As<IContentItemDisplay>();
|
return ItemDisplayLink(html, item.ContentItem);
|
||||||
var values = display.DisplayRouteValues();
|
|
||||||
return html.ActionLink(display.DisplayText, Convert.ToString(values["action"]), values);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MvcHtmlString ItemEditLink(this HtmlHelper html, string linkText, IContentItemPart item) {
|
public static MvcHtmlString ItemEditLink(this HtmlHelper html, string linkText, IContentItemPart item) {
|
||||||
var display = item.As<IContentItemDisplay>();
|
return ItemEditLink(html, linkText, item.ContentItem);
|
||||||
var values = display.DisplayRouteValues();
|
|
||||||
return html.ActionLink(linkText, Convert.ToString(values["action"]), values);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MvcHtmlString ItemEditLink(this HtmlHelper html, IContentItemPart item) {
|
public static MvcHtmlString ItemEditLink(this HtmlHelper html, IContentItemPart item) {
|
||||||
|
return ItemEditLink(html, item.ContentItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MvcHtmlString ItemDisplayLink(this HtmlHelper html, string linkText, ContentItem item) {
|
||||||
var display = item.As<IContentItemDisplay>();
|
var display = item.As<IContentItemDisplay>();
|
||||||
|
if (display == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
var values = display.DisplayRouteValues();
|
var values = display.DisplayRouteValues();
|
||||||
return html.ActionLink(display.DisplayText, Convert.ToString(values["action"]), values);
|
return html.ActionLink(linkText ?? display.DisplayText, Convert.ToString(values["action"]), values);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MvcHtmlString ItemDisplayLink(this HtmlHelper html, ContentItem item) {
|
||||||
|
return ItemDisplayLink(html, null, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MvcHtmlString ItemEditLink(this HtmlHelper html, string linkText, ContentItem item) {
|
||||||
|
var display = item.As<IContentItemDisplay>();
|
||||||
|
if (display == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var values = display.EditRouteValues();
|
||||||
|
return html.ActionLink(linkText ?? display.DisplayText, Convert.ToString(values["action"]), values);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MvcHtmlString ItemEditLink(this HtmlHelper html, ContentItem item) {
|
||||||
|
return ItemEditLink(html, null, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user