How to add the post title to the Last Post column with NAML

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How to add the post title to the Last Post column with NAML

mark
This post was updated on .
This isn't a question (just a how-to sort of thing). Feel free to offer improvements. This changes the last post contents both for forums and for threads (so that it shows the subject and the date instead of just the date). I'm not sure how to make it do it just for the last posts within forums (as opposed to also the last reply in a topic). There may or may not be other issues with this.

Here's a way to do it on n8.nabble.com

Create a new macro called smart_post_link_last_post.

Put the following code in it:
<macro name="smart_post_link_last_post" requires="node" dot_parameter="href" parameters="text, title, class">
    <n.if.is_post>
        <then>
            <a href="[n.node_href.href/]" title="[n.title/]" class="[n.hide_null.class/] post-link[n.topic_node.id/]" node-id="[n.id/]"><n.node_text.text/> ~ <n.node_text.title/></a>
            <n.call_later value="[n.topic_node.id/]" param="markUnreadTopics"/>
        </then>
        <else.node_link text="[n.title/]"/>
    </n.if.is_post>
</macro>

Edit the macro called last_post_column and change the references to smart_post_link to smart_post_link_last_topic. The reason we don't just override smart_post_link is because it's used in other contexts.

To keep it from making the Topics column tiny when viewing forums with no sub-forums on a mobile device, go to the standard_table_columns macro and topics_table_columns (as well as others depending on which types of apps your forum uses), and change

<n.last_post_column white_space="nowrap">

to

<n.last_post_column white_space="wrap">

If you find two macros with that name, I believe you can change it to wrap in both.

If you just want the category pages to have the topic show up for the last post, then add another parameter to last_post_column, pass something into it from view_category_page and in last_post_column, check to see if that parameter is not null, and use smart_post_link_last_post only when it's not null.
Reply | Threaded
Open this post in threaded view
|

Re: How to add the post title to the Last Post column with NAML

GregChapman
In 99% of forums this simply repeats what is in the "Sub-forums & Topics" column often with a "Re:" prefix so unlikely to offer worthwhile additional information.

Where a user has decided a change of Subject line in their reply is appropriate then, in most cases, I would suggest the Admin should be moving the reply to a new topic. In that case it could be useful additional information to be displayed to Admins only.

While I see little utility for most users in most Forum apps, the feature could be useful is when it is reporting a topic subject with a sub-forum and so it could be useful in Category apps where Subject lines for topics are not provided.
Just a Volunteer Nabble Helper - because the nice folk at Nabble have helped me!
GregHelp - Building a set of answers to Nabble FAQs.
Reply | Threaded
Open this post in threaded view
|

Re: How to add the post title to the Last Post column with NAML

mark
Well the idea is to make it work in situations where the row item is not a thread (but rather a forum). But yes, it does affect lower threads, too, and seems a little weird. When you get used to it, though, it's not so bad, since the topic can change (and this could encourage people to change the topic within a thread more often where appropriate).

Ideally, we wouldn't have to have the same view in both kinds of Last Topic situations (since a lot of people might not like that), though. So, we need to figure out how to do that. It's still a work in progress, I suppose.

I edited my post to tell more information.
Reply | Threaded
Open this post in threaded view
|

Re: How to add the post title to the Last Post column with NAML

mark
In reply to this post by GregChapman
Oh, wait. I think I see another problem that you're talking about, maybe. It lists the topic in parentheses next to the topic (in the Topics column), also. I'll see what I can do about that.
Reply | Threaded
Open this post in threaded view
|

Re: How to add the post title to the Last Post column with NAML

mark
This is because topics_column uses smart_post_link, too. So, I might have to pass in an extra parameter to smart_post_link or something.
Reply | Threaded
Open this post in threaded view
|

Re: How to add the post title to the Last Post column with NAML

mark
This post was updated on .
Okay. I fixed it. Instead of making a parameter, I made a new macro like the modified smart_post_link, with another name, and accessed that from last_post_column. So, now the parentheses with the duplicate topic don't show up in the Topics column).

I'll edit my code in the original post.
Reply | Threaded
Open this post in threaded view
|

Re: How to add the post title to the Last Post column with NAML

mark
If you already used my old code, revert the macros to the default settings and start over with the new instructions.
Reply | Threaded
Open this post in threaded view
|

Re: How to add the post title to the Last Post column with NAML

mark
In reply to this post by GregChapman
For now, I edited it to put the date before the subject of the last post/reply. I think it looks a little more expected that way.