Attachment 'ToggleCommentsCosmetics.diff'

Download

   1 diff -r a053f41de99e MoinMoin/theme/__init__.py
   2 --- a/MoinMoin/theme/__init__.py	Sat Sep 27 18:47:57 2008 +0200
   3 +++ b/MoinMoin/theme/__init__.py	Sat Sep 27 21:39:42 2008 +0200
   4 @@ -1094,10 +1094,17 @@ actionsMenuInit('%(label)s');
   5  
   6          html = self._cache.get('editbar')
   7          if html is None:
   8 -            # Remove empty items and format as list
   9 -            items = ''.join(['<li>%s</li>' % item
  10 -                             for item in self.editbarItems(page) if item])
  11 -            html = u'<ul class="editbar">%s</ul>\n' % items
  12 +            # Remove empty items and format as list. The item for showing inline comments
  13 +            # is hidden by default. It gets activated through javascript only if inline
  14 +            # comments exist on the page.
  15 +            items = []
  16 +            for item in self.editbarItems(page):
  17 +                if item:
  18 +                    if 'nbannotation' in item:
  19 +                        items.append('<li class="toggleCommentsButton" style="display:none;">%s</li>' % item) 
  20 +                    else:
  21 +                        items.append('<li>%s</li>' % item)
  22 +            html = u'<ul class="editbar">%s</ul>\n' % ''.join(items)
  23              self._cache['editbar'] = html
  24  
  25          return html
  26 @@ -1141,10 +1148,11 @@ actionsMenuInit('%(label)s');
  27                  elif self.request.cfg.supplementation_page and not self.request.getPragma('supplementation-page', 1) in ('off', '0'):
  28                      editbar_actions.append(self.supplementation_page_nameLink(page))
  29              elif editbar_item == 'Comments':
  30 -                # we just use <a> to get same style as other links, but we add some dummy
  31 -                # link target to get correct mouseover pointer appearance. return false
  32 -                # keeps the browser away from jumping to the link target::
  33 -                editbar_actions.append('<a href="#" class="toggleCommentsButton" style="display:none;" onClick="toggleComments();return false;">%s</a>' % _('Comments'))
  34 +                # We just use <a> to get same style as other links, but we add some dummy
  35 +                # link target to get correct mouseover pointer appearance. 'return false'
  36 +                # keeps the browser away from jumping to the link target. Do not name
  37 +                # css class "nbcomment". This will be recognised as an inline comment.
  38 +                editbar_actions.append('<a href="#" class="nbannotation" onClick="toggleComments();return false;">%s</a>' % _('Comments'))
  39              elif editbar_item == 'Edit':
  40                  editbar_actions.append(self.editorLink(page))
  41              elif editbar_item == 'Info':
  42 --- a/wiki/htdocs/common/js/common.js	Sat Sep 27 18:47:57 2008 +0200
  43 +++ b/wiki/htdocs/common/js/common.js	Sat Sep 27 21:48:44 2008 +0200
  44 @@ -203,7 +204,7 @@ function show_toggleComments() {
  45          for (i = 0; i < all.length; i++){
  46              el = all[i];
  47              if ( el.className == 'toggleCommentsButton' ){
  48 -                el.style.display = 'inline';
  49 +                el.style.display = '';
  50              }
  51          }
  52      }

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2008-09-27 21:43:18, 3.1 KB) [[attachment:ToggleCommentsCosmetics.diff]]
  • [get | view] (2008-06-07 19:10:38, 1.8 KB) [[attachment:pic1.png]]
  • [get | view] (2008-06-07 19:10:53, 2.0 KB) [[attachment:pic2.png]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.