mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 03:25:23 +08:00
Getting the comments display UI to render
Only verified to display on a blog post. A little more work is still needed on the comments driver/templates (make more dynamic and a little cleanup). --HG-- branch : dev
This commit is contained in:
@@ -51,7 +51,7 @@ namespace Orchard.Blogs.Controllers {
|
|||||||
if (postPart == null)
|
if (postPart == null)
|
||||||
return new NotFoundResult();
|
return new NotFoundResult();
|
||||||
|
|
||||||
var model = _services.ContentManager.BuildDisplay(postPart, "BlogPost");
|
var model = _services.ContentManager.BuildDisplay(postPart, "Detail.BlogPost");
|
||||||
|
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
@@ -132,7 +132,7 @@
|
|||||||
</Content>
|
</Content>
|
||||||
<Content Include="Views\Items\Content.Admin.Blog.cshtml" />
|
<Content Include="Views\Items\Content.Admin.Blog.cshtml" />
|
||||||
<Content Include="Views\Items\Content.Blog.cshtml" />
|
<Content Include="Views\Items\Content.Blog.cshtml" />
|
||||||
<Content Include="Views\Items\Content.BlogPost.cshtml" />
|
<Content Include="Views\Items\Content.Detail.BlogPost.cshtml" />
|
||||||
<Content Include="Views\Items\Content.Edit.Blog.cshtml">
|
<Content Include="Views\Items\Content.Edit.Blog.cshtml">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Content>
|
</Content>
|
||||||
@@ -167,19 +167,19 @@
|
|||||||
<Content Include="Views\Parts\Tags.ShowTags.Summary.BlogPost.cshtml" />
|
<Content Include="Views\Parts\Tags.ShowTags.Summary.BlogPost.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Views\Parts\PublishLater.Metadata.BlogPost.cshtml" />
|
<Content Include="Views\Parts\PublishLater.Metadata.Detail.BlogPost.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Views\Parts\Common.Metadata.BlogPost.cshtml" />
|
<Content Include="Views\Parts\Common.Metadata.Detail.BlogPost.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Views\Parts\Localization.ContentTranslations.BlogPost.cshtml" />
|
<Content Include="Views\Parts\Localization.ContentTranslations.Detail.BlogPost.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Views\Parts\Common.Body.BlogPost.cshtml" />
|
<Content Include="Views\Parts\Common.Body.Detail.BlogPost.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Views\Parts\Tags.ShowTags.BlogPost.cshtml" />
|
<Content Include="Views\Parts\Tags.ShowTags.Detail.BlogPost.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||||
|
@@ -1,12 +1,11 @@
|
|||||||
@model Orchard.Comments.Models.CommentsPart
|
@using Orchard.Comments.Models;
|
||||||
@using Orchard.Comments.Models;
|
|
||||||
@using Orchard.Comments;
|
@using Orchard.Comments;
|
||||||
@using Orchard.Security;
|
@using Orchard.Security;
|
||||||
@using Orchard.Utility.Extensions;
|
@using Orchard.Utility.Extensions;
|
||||||
|
|
||||||
@if (Model.Comments.Count > 0) {
|
@if (Model.ContentPart.Comments.Count > 0) {
|
||||||
<h2 id="comments">@T.Plural("1 Comment", "{0} Comments", Model.Comments.Count)</h2>
|
<h2 id="comments">@T.Plural("1 Comment", "{0} Comments", (int)Model.ContentPart.Comments.Count)</h2>
|
||||||
@Html.RenderPartial("ListOfComments", Model.Comments);
|
Html.RenderPartial("ListOfComments", (IEnumerable<Orchard.Comments.Models.CommentPart>)Model.ContentPart.Comments);
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (Model.CommentsActive == false) {
|
@if (Model.CommentsActive == false) {
|
||||||
@@ -21,7 +20,7 @@ else if(!Request.IsAuthenticated && !AuthorizedFor(Permissions.AddComment)) {
|
|||||||
using (Html.BeginForm("Create", "Comment", new { area = "Orchard.Comments" }, FormMethod.Post, new { @class = "comment" })) {
|
using (Html.BeginForm("Create", "Comment", new { area = "Orchard.Comments" }, FormMethod.Post, new { @class = "comment" })) {
|
||||||
@Html.ValidationSummary()
|
@Html.ValidationSummary()
|
||||||
<h2 id="addacomment">@T("Add a Comment")</h2>
|
<h2 id="addacomment">@T("Add a Comment")</h2>
|
||||||
@if (!Request.IsAuthenticated) {
|
if (!Request.IsAuthenticated) {
|
||||||
<fieldset class="who">
|
<fieldset class="who">
|
||||||
<div>
|
<div>
|
||||||
<label for="Name">@T("Name")</label>
|
<label for="Name">@T("Name")</label>
|
||||||
@@ -37,18 +36,17 @@ using (Html.BeginForm("Create", "Comment", new { area = "Orchard.Comments" }, Fo
|
|||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
} else {
|
} else {
|
||||||
var currentUser = Html.Resolve<IAuthenticationService>().GetAuthenticatedUser();
|
@Html.Hidden("Name", WorkContext.CurrentUser.UserName ?? "")
|
||||||
@Html.Hidden("Name", currentUser.UserName ?? "")
|
@Html.Hidden("Email", WorkContext.CurrentUser.Email ?? "")
|
||||||
@Html.Hidden("Email", currentUser.Email ?? "")
|
|
||||||
}
|
}
|
||||||
<fieldset class="what">
|
<fieldset class="what">
|
||||||
<div>
|
<div>
|
||||||
<label for="CommentText">@if (Request.IsAuthenticated) { T("Hi, {0}!", Html.Encode(Page.User.Identity.Name))<br /> } @T("Comment")</label>
|
<label for="CommentText">@if (Request.IsAuthenticated) { @T("Hi, {0}!", Html.Encode(WorkContext.CurrentUser.UserName))<br /> } @T("Comment")</label>
|
||||||
<textarea id="CommentText" rows="10" cols="30" name="CommentText"></textarea>
|
<textarea id="CommentText" rows="10" cols="30" name="CommentText"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<input type="submit" class="button" value="@T("Submit Comment")" />
|
<input type="submit" class="button" value="@T("Submit Comment")" />
|
||||||
@Html.Hidden("CommentedOn", Model.ContentItem.Id)
|
@Html.Hidden("CommentedOn", (int)Model.ContentPart.ContentItem.Id)
|
||||||
@Html.Hidden("ReturnUrl", Context.Request.ToUrlString())
|
@Html.Hidden("ReturnUrl", Context.Request.ToUrlString())
|
||||||
@Html.AntiForgeryTokenOrchard()
|
@Html.AntiForgeryTokenOrchard()
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user