[drupal-devel] [feature] Display comments on own tab like wikipedia (patch attached)

chx drupal-devel at drupal.org
Tue Sep 13 19:09:40 UTC 2005


Issue status update for 
http://drupal.org/node/24804
Post a follow up: 
http://drupal.org/project/comments/add/24804

 Project:      Drupal
 Version:      cvs
 Component:    comment.module
 Category:     feature requests
 Priority:     normal
 Assigned to:  chx
 Reported by:  moshe weitzman
 Updated by:   chx
 Status:       patch (code needs review)

First, let me give you background of this patch: I was contracted for
some comment module (4.6) work. Per node type and print theme page
stuff comes from that. I was trying to give you a good port forward and
eradicating all the per content type stuff. Sorry for the remnants.




chx



Previous comments:
------------------------------------------------------------------------

Sat, 11 Jun 2005 20:57:10 +0000 : moshe weitzman

Attached please find a demonstration patch which moves comment display
to its own tab on the node view page. Admin may choose this new view or
old view.


The patch needs work still:
- comment control form redirects to the node page after submit. Should
be comment page
- same for comment posting form
- probably more


I hope someone gets inspired to finish this patch. I won't revisit this
for a while.




------------------------------------------------------------------------

Sat, 11 Jun 2005 21:00:56 +0000 : moshe weitzman

Attachment: http://drupal.org/files/issues/discuss.patch (3.87 KB)

with attachment  this time




------------------------------------------------------------------------

Sat, 11 Jun 2005 23:24:12 +0000 : moshe weitzman

oh yeah - also on the TODO list is to comment URLs to always point to
comment.module and never to node/x#comment-cid or node/x#comment-new
and so on. then comment.module can work out whether to show you the
discuss tab or the traditional view.




------------------------------------------------------------------------

Sun, 12 Jun 2005 00:56:02 +0000 : Boris Mann

I like the concept. Would want this to be part of workflow settings, so
that comment-tab could be enabled/disabled per content type.




------------------------------------------------------------------------

Sun, 12 Jun 2005 02:20:42 +0000 : Jaza

I like the idea - big +1. This is a must for sites that have long
articles and/or many comments - viewing the node is enough bandwidth as
it is, without all the comments getting displayed as well. Also improves
usability, IMO.


Would also like to see pagination of the comments tab (I'm sure you've
thought of this already, Moshe). Something similar to A List Apart
[1]'s system, e.g. node/x/discuss/2 (page 2 of that node's comments).
Or, if the existing pager system demands it, node/x/discuss?page=2.
[1] http://www.alistapart.com/




------------------------------------------------------------------------

Tue, 30 Aug 2005 00:41:42 +0000 : chx

Attachment: http://drupal.org/files/issues/discuss_0.patch (3.87 KB)

Let's discuss! Like do we want to have a reply form on the node display
even if the comments are on the discuss page?




------------------------------------------------------------------------

Tue, 30 Aug 2005 00:50:13 +0000 : chx

Attachment: http://drupal.org/files/issues/discuss_1.patch (3.58 KB)

I have uploaded moshe's patch. Let's try again.




------------------------------------------------------------------------

Tue, 30 Aug 2005 11:22:18 +0000 : Bèr Kessels

I like this approach a lot. However, as i use drupal also for blogging, 
would dislike my bog to behave the same. Thus there must be some -easy-
way to get around this. µ


The problem lies mainly in the fact that tabs are not administratable
in Drupals menu admin. And I think it is a very bad idea to add a
config option where to place the comments. We should go for one way,
teh default way, and offer a menu-admin of some sort to change this,
for bloggers and slashdot alikes. 


How to achieve this? I see two options, but I really hope people see
more then one.:
- make local-tasks appear in the menu admin (gets a huge +1 from me)
It's a separate issue, though.
- add a config option to the comment admin to allow comments either as
tab or as thread under the post. IMO that config option should not set
a variable, that gets checked every hook_menu call, but it should alter
the menu-entry in the database for the tabs Its possible, I did that
before. 


But, as said, I hope others have better ideas. for I really would love
this feature to get in. But I am afraid a huge lot of people will move
away from drupal if we allow tabs only.




------------------------------------------------------------------------

Tue, 30 Aug 2005 14:05:59 +0000 : chx

No, not tabs only. I know the drupal_gotos are giving you this
impression, but will fix in the evening. Also, there is only a
variable_get for node/nid pages and then again, variable_get is double
cached, it's very fast.




------------------------------------------------------------------------

Tue, 30 Aug 2005 16:19:22 +0000 : Bèr Kessels

I know variable is fast, but I was referring to:
&& variable_get('comment_task', FALSE) that is evaluated every node
view. 


As well as the setting in the comment options. I am no fan of such
options; However, it seems in this case that setting is sortof
required, unfortunately. So unless others come up with better ideas,
just ignore my previous comment/post.


Another idea: put this in hook_nodeapi() $op == "settings". that way
this setting can be used per type. I can imagine that this makes no
sense for forums and blog entries, yet is very usefull for the books on
that same site.




------------------------------------------------------------------------

Tue, 30 Aug 2005 16:20:36 +0000 : Bèr Kessels

sorry, with "Another idea: put this in..." I meant to say "Another idea:
put the settings for tabs vs threads ..."




------------------------------------------------------------------------

Mon, 12 Sep 2005 22:24:22 +0000 : chx

Attachment: http://drupal.org/files/issues/discuss_2.patch (6.71 KB)

Comment URL is introduced. Instead of node/$nid#comment-cid we have
comment/$nid#comment-cid


Other minor fixes.




------------------------------------------------------------------------

Tue, 13 Sep 2005 00:31:31 +0000 : Boris Mann

Comment URLs are great, except I'd love to have a *full* comment URL --
e.g. comment/$nid/$cid. The probably with anchor tags is that they are
not visible at the server level -- i.e. not tracked in referrers, etc.
etc.


Don't want to hijack this issue, so feel free to ignore for now, but
wanted to bring up the issue from a search/web traffic/etc.
perspective.




------------------------------------------------------------------------

Tue, 13 Sep 2005 05:51:09 +0000 : nedjo

+1 in principle.  (I've looked over but not applied the code.)


(Optional) tabbed display is a useful enhancement and justifies the
extra configuration option.  I also like the new comment URL.




------------------------------------------------------------------------

Tue, 13 Sep 2005 05:59:36 +0000 : nsk

As a user I have no problem with this as long as I can disable it and
use the old view. Please note that there is nothing special or
innovative in Wikipedia's use of the comment page (talk page), it's
just a feature of MediaWiki, the software they use. Many other sites
use the same software. IMO it's bad but others may need, so it's
probably good to add something similar in Drupal as long as it's not
the default.




------------------------------------------------------------------------

Tue, 13 Sep 2005 06:06:20 +0000 : moshe weitzman

@nsk (and others) - please do not post simple "like/dislike" comments
when an issue is in 'rpatch: code needs review' status. the review
guidelines are at http://drupal.org/patch/review. thank you.




------------------------------------------------------------------------

Tue, 13 Sep 2005 08:02:03 +0000 : Bèr Kessels

Discussion about a patch should go further then just comments on the
code. NSK (and I) just did what the patch review guidelines say under
"Challenge the proposed changes.".




------------------------------------------------------------------------

Tue, 13 Sep 2005 18:37:46 +0000 : moshe weitzman

Attachment: http://drupal.org/files/issues/discuss_tab.patch (6.29 KB)

Note: here is a patch which build upon chx's patch, with the changes i
describe below. I'd like another person to review this patch before we
promote it.


1. I like that access to the new tab is switchable by node type, but
you use the permission system to do this. Also, are these permissions
defined somewhere? Specifically, 



<?php
user_access('access '. node_invoke($node, 'node_name') .' comments')
?>




To me, it makes more sense to put this switch on the content-types
admin pages and leave comment permissions as a global, not node type
specific. This adds a couple node_load() calls but we are saved by the
node cache.


2. Here is a description for the checkbox "Show comments on own tab.":
"If unchecked, comments will be shown directly beneath the
corresponding post, instead of in a tab called discuss"


3: in comment_task(), you have some commented out lines that look
useful. You can avoid calling comment_render() when there are no
comments by inspecting $node->comment_count . Also use that element
instead comment_num_all() in hook_menu().


4. consider adding a 'create new comment' link at the top of the new
'discuss' page (similar to forum/x page).


5. I removed line 792 - looks like a misplaced cut and paste.


6. new discuss page was printing its own output. @chx - you are losing
your memory?


Thanks for enhancing this patch.







More information about the drupal-devel mailing list