This project is read-only.

Inside of BlogPost - Place Comment Count on same line as "more"

Topics: Writing themes
Jul 17, 2013 at 9:56 PM
This is my first time using any type of CMS, I'm generally a desktop programmer, and I specialize in Java, VB.Net, and a few other random languages. I have however never worked with in any form (ASP classic quite a bit though). In the past, I programmed all my sites by hand and used Classic ASP bundled with an access database to create my own simplistic CMS systems.

I'm moving back into Web development, and as such, I'm upgrading an old client's site to use Orchard instead of my old CMS system to make things easier. While converting the layout over, I've ran into a little bump that I can't seem to figure out.

While tinkering I've discovered that inside of a BlogPost, The timestamp, content, and "more" are combined together inside of the metadata, however, I cannot seem to figure out how to get the comments to appear on the same line. I've tried messing around with the the Developer Tool and combining different Alternates, modifying them, etc, but it always throws an error or leads to the Comment Count being within a different Div. Anyone have any input on this?
Jul 17, 2013 at 11:12 PM
It doesn't look like you'd need more than CSS to make that work. If you can't make it work with just CSS, you can try this technique, which may be a little more familiar to you and makes it easier to obtain exactly the markup you want, when there is more than one part involved:
Jul 25, 2013 at 7:29 PM
I've done it 2 different ways so far...the first is like Bertrand describes:

In Placement, I added a line for Comments_Count
<Place Parts_Comments_Count="Meta:after"/>
I then follow this up with a simple stylesheet entry:
.commentcount { margin-top: -40px !important }
which moved the Parts.Comments.Count shape up where it needed to be. I did overwrite the Parts.Comments.Count shape to add the commentcount class to it and change the html a bit.

The second method I tried was using jQuery in the Parts.Comments.Count shape to append it to the list of meta items:
@using Orchard.Comments.ViewModels;
    Orchard.ContentManagement.ContentItem contentItem = Model.ContentPart.ContentItem;
<script type="text/javascript">
    $('ul.meta-post').append('<li><i class="icon-comments"></i>&nbsp;<a href="@Url.ItemDisplayUrl(contentItem)">@T.Plural("1 Comment", "{0} Comments", (int)Model.CommentCount)</a></li>');
The jQuery method worked surprisingly well for that theme. Just another idea to throw your way.