[Moin-user] "Discuss" subpage feature for MoinMoin 1.5.x
Jim Wight
j.k.wight at ncl.ac.uk
Mon Jul 24 06:51:41 EDT 2006
On Mon, 2006-07-24 at 11:33 +0200, Christian SCHWARZ wrote:
> I'd like to insert a "Discuss" button (similar to the one used in
> MediaWiki) to MoinMoin, and until 1.5.x it was rather simple to modify.
> In fact, I just added a button "Discuss" which created (if not already
> existing) a subpage "/Discuss" and that's all.
> With the new revision, things are (at least for me) much more
> complicated, and I'd appreciate a hint (or better a diff :) of where to
> add the modifs and how (until now in themes/__init__.py).
Here's how I've done it - still in theme/__init__.py , but using
'Comment' rather than 'Discuss' - to place the link to the right of the
'More Actions' menu:
In editbarItems, replace the line
self.actionsMenu(page),]
with
self.actionsMenu(page),
self.commentLink(page),]
and add this function
def commentLink(self, page):
request = self.request
_ = self.request.getText
link = wikiutil.link_tag
quotedname = wikiutil.quoteWikinameURL(page.page_name)
if not quotedname.endswith('/Comment'):
comment_page = Page(request, quotedname + '/Comment')
if comment_page.isStandardPage(False):
text = _('Comment', formatted=False)
return comment_page.link_to(comment_page.request, text)
else:
text = _('Comment', formatted=False)
return comment_page.link_to(comment_page.request, text, attrs='class="nocomment"')
Jim
More information about the Moin-user
mailing list