mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Small fix because "" satisfies the ?? operator
--HG-- branch : dev
This commit is contained in:
@@ -20,7 +20,7 @@ namespace Orchard.Mvc.Html {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
return html.ActionLink(
|
return html.ActionLink(
|
||||||
linkText ?? metadata.DisplayText ?? "view",
|
NonNullOrEmpty(linkText, metadata.DisplayText, "view"),
|
||||||
Convert.ToString(metadata.DisplayRouteValues["action"]),
|
Convert.ToString(metadata.DisplayRouteValues["action"]),
|
||||||
metadata.DisplayRouteValues);
|
metadata.DisplayRouteValues);
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ namespace Orchard.Mvc.Html {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static MvcHtmlString ItemEditLinkWithReturnUrl(this HtmlHelper html, string linkText, IContent content) {
|
public static MvcHtmlString ItemEditLinkWithReturnUrl(this HtmlHelper html, string linkText, IContent content) {
|
||||||
return html.ItemEditLink(linkText, content, new {ReturnUrl = html.ViewContext.HttpContext.Request.RawUrl});
|
return html.ItemEditLink(linkText, content, new { ReturnUrl = html.ViewContext.HttpContext.Request.RawUrl });
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MvcHtmlString ItemEditLink(this HtmlHelper html, string linkText, IContent content) {
|
public static MvcHtmlString ItemEditLink(this HtmlHelper html, string linkText, IContent content) {
|
||||||
@@ -43,11 +43,19 @@ namespace Orchard.Mvc.Html {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
return html.ActionLink(
|
return html.ActionLink(
|
||||||
linkText ?? metadata.DisplayText ?? "edit",
|
NonNullOrEmpty(linkText, metadata.DisplayText, "edit"),
|
||||||
Convert.ToString(metadata.EditorRouteValues["action"]),
|
Convert.ToString(metadata.EditorRouteValues["action"]),
|
||||||
metadata.EditorRouteValues.Merge(additionalRouteValues));
|
metadata.EditorRouteValues.Merge(additionalRouteValues));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string NonNullOrEmpty(params string[] values) {
|
||||||
|
foreach (var value in values) {
|
||||||
|
if (!string.IsNullOrEmpty(value))
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static MvcHtmlString ItemEditLink(this HtmlHelper html, IContent content) {
|
public static MvcHtmlString ItemEditLink(this HtmlHelper html, IContent content) {
|
||||||
return ItemEditLink(html, null, content);
|
return ItemEditLink(html, null, content);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user