mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Added Html.ThemePath to simplify referencing a file in the current theme.
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4045315
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
} else {
|
} else {
|
||||||
%><h3><%=Html.Encode(Model.CurrentTheme.DisplayName) %></h3>
|
%><h3><%=Html.Encode(Model.CurrentTheme.DisplayName) %></h3>
|
||||||
<p>
|
<p>
|
||||||
<%=Html.Image(ResolveUrl(Html.Resolve<IExtensionManager>().GetThemeLocation(Model.CurrentTheme) + "/Theme.gif"), Html.Encode(Model.CurrentTheme.DisplayName), null)%><br />
|
<%=Html.Image(Html.ThemePath("/Theme.gif"), Html.Encode(Model.CurrentTheme.DisplayName), null)%><br />
|
||||||
<%=_Encoded("By") %> <%=Html.Encode(Model.CurrentTheme.Author) %><br />
|
<%=_Encoded("By") %> <%=Html.Encode(Model.CurrentTheme.Author) %><br />
|
||||||
<%=Html.Encode(Model.CurrentTheme.Version) %><br />
|
<%=Html.Encode(Model.CurrentTheme.Version) %><br />
|
||||||
<%=Html.Encode(Model.CurrentTheme.Description) %><br />
|
<%=Html.Encode(Model.CurrentTheme.Description) %><br />
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
%> <li>
|
%> <li>
|
||||||
<h3><%=Html.Encode(theme.DisplayName) %></h3>
|
<h3><%=Html.Encode(theme.DisplayName) %></h3>
|
||||||
<p>
|
<p>
|
||||||
<%=Html.Image(ResolveUrl(Html.Resolve<IExtensionManager>().GetThemeLocation(theme) + "/Theme.gif"), Html.Encode(theme.DisplayName), null)%><br />
|
<%=Html.Image(Html.ThemePath(theme, "/Theme.gif"), Html.Encode(theme.DisplayName), null)%><br />
|
||||||
<%=_Encoded("By") %> <%=Html.Encode(theme.Author) %><br />
|
<%=_Encoded("By") %> <%=Html.Encode(theme.Author) %><br />
|
||||||
<%=Html.Encode(theme.Version) %><br />
|
<%=Html.Encode(theme.Version) %><br />
|
||||||
<%=Html.Encode(theme.Description) %><br />
|
<%=Html.Encode(theme.Description) %><br />
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@
|
|||||||
<li class="destruct">
|
<li class="destruct">
|
||||||
<% using (Html.BeginFormAntiForgeryPost(Url.BlogPostDelete(Model.Item.Blog.Slug, Model.Item.Slug))) { %>
|
<% using (Html.BeginFormAntiForgeryPost(Url.BlogPostDelete(Model.Item.Blog.Slug, Model.Item.Slug))) { %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<input type="image" src="<%=ResolveUrl(Html.Resolve<IExtensionManager>().GetThemeLocation(Html.Resolve<IThemeService>().GetRequestTheme(ViewContext.RequestContext)) + "/styles/images/remove.png") %>" alt="<%=_Encoded("Remove Post") %>" title="<%=_Encoded("Remove Post") %>" class="ibutton image remove" />
|
<input type="image" src="<%=Html.ThemePath("/styles/images/remove.png") %>" alt="<%=_Encoded("Remove Post") %>" title="<%=_Encoded("Remove Post") %>" class="ibutton image remove" />
|
||||||
</fieldset><%
|
</fieldset><%
|
||||||
} %>
|
} %>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.Mvc.Html;
|
using System.Web.Mvc.Html;
|
||||||
|
using System.Web.UI;
|
||||||
|
using Orchard.Extensions;
|
||||||
|
using Orchard.Themes;
|
||||||
using Orchard.Validation;
|
using Orchard.Validation;
|
||||||
|
|
||||||
namespace Orchard.Mvc.Html {
|
namespace Orchard.Mvc.Html {
|
||||||
@@ -11,5 +14,17 @@ namespace Orchard.Mvc.Html {
|
|||||||
Argument.ThrowIfNull(helper, "helper");
|
Argument.ThrowIfNull(helper, "helper");
|
||||||
helper.RenderPartial(viewName);
|
helper.RenderPartial(viewName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string ThemePath(this HtmlHelper helper, string path) {
|
||||||
|
return helper.ThemePath(helper.Resolve<IThemeService>().GetRequestTheme(helper.ViewContext.RequestContext), path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ThemePath(this HtmlHelper helper, ITheme theme, string path) {
|
||||||
|
Control parent = helper.ViewDataContainer as Control;
|
||||||
|
|
||||||
|
Argument.ThrowIfNull(parent, "helper.ViewDataContainer");
|
||||||
|
|
||||||
|
return parent.ResolveUrl(helper.Resolve<IExtensionManager>().GetThemeLocation(theme) + path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user