Adding position to some displays/editors - adding a ul/li links-only form of tags display template

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4042803
This commit is contained in:
loudej
2009-12-01 06:25:32 +00:00
parent 2816c53342
commit 05444098a4
6 changed files with 24 additions and 12 deletions

View File

@@ -16,18 +16,18 @@ namespace Orchard.Core.Common.Providers {
OnGetDisplays<BodyAspect>((context, body) => {
var model = new BodyDisplayViewModel { BodyAspect = body };
context.Displays.Add(new ModelTemplate(model, TemplatePrefix) { TemplateName = TemplateName });
context.Displays.Add(new ModelTemplate(model, TemplatePrefix) { TemplateName = TemplateName, Position = "3" });
});
OnGetEditors<BodyAspect>((context, body) => {
var model = new BodyEditorViewModel { BodyAspect = body, TextEditorTemplate = DefaultTextEditorTemplate };
context.Editors.Add(new ModelTemplate(model, TemplatePrefix) { TemplateName = TemplateName });
context.Editors.Add(new ModelTemplate(model, TemplatePrefix) { TemplateName = TemplateName, Position = "3" });
});
OnUpdateEditors<BodyAspect>((context, body) => {
var model = new BodyEditorViewModel { BodyAspect = body, TextEditorTemplate = DefaultTextEditorTemplate };
context.Updater.TryUpdateModel(model, TemplatePrefix, null, null);
context.Editors.Add(new ModelTemplate(model, TemplatePrefix) { TemplateName = TemplateName });
context.Editors.Add(new ModelTemplate(model, TemplatePrefix) { TemplateName = TemplateName, Position = "3" });
});
}
}

View File

@@ -4,10 +4,10 @@ using Orchard.UI.Models;
namespace Orchard.DevTools.Models {
public class DebugLinkProvider : ContentProvider {
protected override void GetDisplays(GetDisplaysContext context) {
context.Displays.Add(new ModelTemplate(new ShowDebugLink { ContentItem = context.ContentItem }));
context.Displays.Add(new ModelTemplate(new ShowDebugLink { ContentItem = context.ContentItem }) { Position = "10" });
}
protected override void GetEditors(GetEditorsContext context) {
context.Editors.Add(new ModelTemplate(new ShowDebugLink { ContentItem = context.ContentItem }));
context.Editors.Add(new ModelTemplate(new ShowDebugLink { ContentItem = context.ContentItem }) { Position = "10" });
}
}
}

View File

@@ -86,6 +86,8 @@
<%=Html.Encode(editor.Prefix) %></span>
<%=Html.Encode(editor.Model.GetType().Name) %>
(<%=Html.Encode(editor.Model.GetType().Namespace) %>)
Prefix:<%=Html.Encode(editor.Prefix ?? "(null)")%>
Position:<%=Html.Encode(editor.Position??"(null)") %>
<div style="margin-left: 20px; border: solid 1px black;">
<%=Html.EditorFor(x=>editor.Model, editor.TemplateName, editor.Prefix) %>
</div>
@@ -101,6 +103,8 @@
<%=Html.Encode(display.Prefix)%></span>
<%=Html.Encode(display.Model.GetType().Name)%>
(<%=Html.Encode(display.Model.GetType().Namespace)%>)
Prefix:<%=Html.Encode(display.Prefix ?? "(null)")%>
Position:<%=Html.Encode(display.Position ?? "(null)")%>
<div style="margin-left: 20px; border: solid 1px black;">
<%=Html.DisplayFor(x => display.Model, display.TemplateName, display.Prefix)%>
</div>

View File

@@ -25,14 +25,13 @@ namespace Orchard.Tags.Models {
_tagsRepository = tagsRepository;
_tagsContentItemsRepository = tagsContentItemsRepository;
Filters.Add(new ActivatingFilter<HasTags>("sandboxpage"));
OnGetDisplays<HasTags>((context, part) => {
context.Displays.Add(new ModelTemplate(context.ContentItem.Get<HasTags>()) { Position = "2", TemplateName = "HasTagsList" });
context.Displays.Add(new ModelTemplate(context.ContentItem.Get<HasTags>()) { Position = "5" });
});
}
protected override void GetDisplays(GetDisplaysContext context) {
if (context.ContentItem.Has<HasTags>() == false) {
return;
}
context.Displays.Add(new ModelTemplate(context.ContentItem.Get<HasTags>()));
}
protected override void Loading(LoadContentContext context) {
if (context.ContentItem.Has<HasTags>() == false) {

View File

@@ -86,6 +86,7 @@
<Content Include="Views\Admin\Search.aspx" />
<Content Include="Views\Home\Index.aspx" />
<Content Include="Views\Home\Search.aspx" />
<Content Include="Views\Models\DisplayTemplates\HasTagsList.ascx" />
<Content Include="Views\Models\DisplayTemplates\HasTags.ascx" />
<Content Include="Views\Models\EditorTemplates\TagSettingsRecord.ascx" />
<Content Include="Web.config" />

View File

@@ -0,0 +1,8 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<HasTags>" %>
<%@ Import Namespace="Orchard.Mvc.Html" %>
<%@ Import Namespace="Orchard.Tags.Models" %>
<ul class="tags">
<%foreach (var tag in Model.CurrentTags) {%>
<li class="tag"><%=Html.ActionLink(tag.TagName, "Search", "Home", new{ area="Orchard.Tags", tagName=tag.TagName},new{}) %></li>
<%}%>
</ul>