mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
- Blogs: Add comment/tag editors.
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4042872
This commit is contained in:
@@ -10,4 +10,10 @@
|
|||||||
<%=Html.EditorForModel() %>
|
<%=Html.EditorForModel() %>
|
||||||
<fieldset><input class="button" type="submit" value="Save" /></fieldset>
|
<fieldset><input class="button" type="submit" value="Save" /></fieldset>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
<%foreach (var editor in Model.Editors) { %>
|
||||||
|
<%-- TODO: why is Body in editors? --%>
|
||||||
|
<% if (!String.Equals(editor.Prefix, "Body")) { %>
|
||||||
|
<%=Html.EditorFor(m=>editor.Model, editor.TemplateName, editor.Prefix) %>
|
||||||
|
<% } %>
|
||||||
|
<%} %>
|
||||||
<% Html.Include("Foot"); %>
|
<% Html.Include("Foot"); %>
|
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Orchard.Data;
|
using Orchard.Data;
|
||||||
using Orchard.Models;
|
using Orchard.Models;
|
||||||
using Orchard.Models.Driver;
|
using Orchard.Models.Driver;
|
||||||
@@ -33,6 +32,20 @@ namespace Orchard.Comments.Models {
|
|||||||
context.Displays.Add(new ModelTemplate(context.ContentItem.Get<HasComments>()));
|
context.Displays.Add(new ModelTemplate(context.ContentItem.Get<HasComments>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void GetEditors(GetEditorsContext context) {
|
||||||
|
if (context.ContentItem.Has<HasComments>() == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
context.Editors.Add(new ModelTemplate(context.ContentItem.Get<HasComments>()));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateEditors(UpdateContentContext context) {
|
||||||
|
if (context.ContentItem.Has<HasComments>() == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
context.Editors.Add(new ModelTemplate(context.ContentItem.Get<HasComments>()));
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Loading(LoadContentContext context) {
|
protected override void Loading(LoadContentContext context) {
|
||||||
if (context.ContentItem.Has<HasComments>() == false) {
|
if (context.ContentItem.Has<HasComments>() == false) {
|
||||||
return;
|
return;
|
||||||
|
@@ -87,6 +87,7 @@
|
|||||||
<Content Include="Views\Admin\Create.aspx" />
|
<Content Include="Views\Admin\Create.aspx" />
|
||||||
<Content Include="Views\Models\DisplayTemplates\HasComments.ascx" />
|
<Content Include="Views\Models\DisplayTemplates\HasComments.ascx" />
|
||||||
<Content Include="Views\Models\EditorTemplates\CommentSettingsRecord.ascx" />
|
<Content Include="Views\Models\EditorTemplates\CommentSettingsRecord.ascx" />
|
||||||
|
<Content Include="Views\Models\EditorTemplates\HasComments.ascx" />
|
||||||
<Content Include="Web.config" />
|
<Content Include="Web.config" />
|
||||||
<Content Include="Views\Web.config" />
|
<Content Include="Views\Web.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@@ -0,0 +1,49 @@
|
|||||||
|
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<HasComments>" %>
|
||||||
|
<%@ Import Namespace="Orchard.Comments.Models"%>
|
||||||
|
<h3><%= Model.Comments.Count() %> Comments</h3>
|
||||||
|
<ol>
|
||||||
|
<% foreach (var comment in Model.Comments) {%>
|
||||||
|
<li>
|
||||||
|
<%= comment.CommentText %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Posted by <%= comment.UserName %> on <%= comment.CommentDate %>
|
||||||
|
</li>
|
||||||
|
<hr />
|
||||||
|
<% } %>
|
||||||
|
</ol>
|
||||||
|
<% if (Model.Closed) { %>
|
||||||
|
<p>Comments have been disabled for this content.</p>
|
||||||
|
<% } else { %>
|
||||||
|
<% Html.BeginForm("Create", "Admin", new { area = "Orchard.Comments" }); %>
|
||||||
|
<%= Html.ValidationSummary() %>
|
||||||
|
<div class="yui-g">
|
||||||
|
<h2 class="separator">Add a Comment</h2>
|
||||||
|
<h3>Information</h3>
|
||||||
|
<ol>
|
||||||
|
<li>
|
||||||
|
<%= Html.Hidden("CommentedOn", Model.ContentItem.Id) %>
|
||||||
|
<%= Html.Hidden("ReturnUrl", Context.Request.Url) %>
|
||||||
|
<label for="Name">Name:</label>
|
||||||
|
<input id="Text1" class="inputText inputTextLarge" name="Name" type="text" />
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label for="Email">Email:</label>
|
||||||
|
<input id="Email" class="inputText inputTextLarge" name="Email" type="text" />
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label for="SiteName">SiteName:</label>
|
||||||
|
<input id="SiteName" class="inputText inputTextLarge" name="SiteName" type="text" />
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label for="CommentText">Leave a comment</label>
|
||||||
|
<textarea id="CommentText" rows="10" cols="30" name="CommentText">
|
||||||
|
</textarea>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<input type="submit" class="button" value="Submit Comment" />
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
<% Html.EndForm(); %>
|
||||||
|
<% } %>
|
@@ -32,6 +32,19 @@ namespace Orchard.Tags.Models {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void GetEditors(GetEditorsContext context) {
|
||||||
|
if (context.ContentItem.Has<HasTags>() == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
context.Editors.Add(new ModelTemplate(context.ContentItem.Get<HasTags>()));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateEditors(UpdateContentContext context) {
|
||||||
|
if (context.ContentItem.Has<HasTags>() == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
context.Editors.Add(new ModelTemplate(context.ContentItem.Get<HasTags>()));
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Loading(LoadContentContext context) {
|
protected override void Loading(LoadContentContext context) {
|
||||||
if (context.ContentItem.Has<HasTags>() == false) {
|
if (context.ContentItem.Has<HasTags>() == false) {
|
||||||
|
@@ -88,6 +88,7 @@
|
|||||||
<Content Include="Views\Home\Search.aspx" />
|
<Content Include="Views\Home\Search.aspx" />
|
||||||
<Content Include="Views\Models\DisplayTemplates\HasTagsList.ascx" />
|
<Content Include="Views\Models\DisplayTemplates\HasTagsList.ascx" />
|
||||||
<Content Include="Views\Models\DisplayTemplates\HasTags.ascx" />
|
<Content Include="Views\Models\DisplayTemplates\HasTags.ascx" />
|
||||||
|
<Content Include="Views\Models\EditorTemplates\HasTags.ascx" />
|
||||||
<Content Include="Views\Models\EditorTemplates\TagSettingsRecord.ascx" />
|
<Content Include="Views\Models\EditorTemplates\TagSettingsRecord.ascx" />
|
||||||
<Content Include="Web.config" />
|
<Content Include="Web.config" />
|
||||||
<Content Include="Views\Web.config" />
|
<Content Include="Views\Web.config" />
|
||||||
|
@@ -0,0 +1,35 @@
|
|||||||
|
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<HasTags>" %>
|
||||||
|
<%@ Import Namespace="Orchard.Mvc.Html"%>
|
||||||
|
<%@ Import Namespace="Orchard.Tags.Models"%>
|
||||||
|
<h3>Tags</h3>
|
||||||
|
<% Html.BeginForm("Edit", "Home", new { area = "Orchard.Tags" }); %>
|
||||||
|
<%= Html.ValidationSummary() %>
|
||||||
|
<div class="yui-g">
|
||||||
|
<h2 class="separator">Edit Tags</h2>
|
||||||
|
<%= Html.Hidden("TaggedContentId", Model.ContentItem.Id) %>
|
||||||
|
<%= Html.Hidden("ReturnUrl", Context.Request.Url) %>
|
||||||
|
<h3>Choose from existing tags</h3>
|
||||||
|
<ol>
|
||||||
|
<% foreach (var tag in Model.AllTags) { %>
|
||||||
|
<li>
|
||||||
|
<label for"<%= tag.TagName %>"><%= tag.TagName %>:</label>
|
||||||
|
<% if (Model.CurrentTags.Contains(tag)) {%>
|
||||||
|
<input type="checkbox" value="true" checked="checked" name="Checkbox.<%=tag.Id%>"/>
|
||||||
|
<% } else {%>
|
||||||
|
<input type="checkbox" value="true" name="Checkbox.<%=tag.Id%>"/>
|
||||||
|
<% } %>
|
||||||
|
</li>
|
||||||
|
<% } %>
|
||||||
|
<li>
|
||||||
|
<input type="submit" class="button" name="submit.Save" value="Save" />
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
<h3>Or add a new tag</h3>
|
||||||
|
<ol>
|
||||||
|
<li>
|
||||||
|
<input id="NewTagName" class="inputText inputTextLarge" name="NewTagName" type="text" value="" />
|
||||||
|
<input type="submit" class="button" name="submit.Add" value="Add" />
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
<% Html.EndForm(); %>
|
Reference in New Issue
Block a user