Commits

Anonymous committed 8edba9d

Patch for th:#9556: Resource name not displayed in the hover-over drop-down menu after clicking the add / remove bookmark icon.

  • Participants
  • Parent commits 77f82ec

Comments (0)

Files changed (1)

0.12/tracbookmark/__init__.py

 
                 req.redirect(resource)
 
-        base_path = req.base_path
-
         # listing bookmarks
         if self._is_ajax(req):
             menu = tag.ul('', id='bookmark_menu', title='')
 
             anc = tag.a("Bookmarks", href=req.href.bookmark())
             menu.append(tag.li(anc))
-
-            for url, name, username in self.get_bookmarks(req):
-                resource = url
-                anc = tag.a(resource, href=base_path + resource)
-                menu.append(tag.li(anc))
+            
+            self.__append_bookmarks_to_menu(req, menu)
 
             content = "%s" % menu
 
 
     ### internal methods
 
+    def __append_bookmarks_to_menu(self, req, menu):
+    
+        for url, name, username in self.get_bookmarks(req):
+            params = self.__format_name(req, url)
+            if params['name']:
+                name = ' '.join([params['linkname'], params['name']])
+            else:
+                name = params['linkname']
+            anc = tag.a(name, href=req.base_path + url)
+            menu.append(tag.li(anc))
+            
     def __format_name(self, req, url):
         linkname = url
         name = ""
         anc = tag.a("Bookmarks", href=req.href.bookmark())
         menu.append(tag.li(anc))
 
-
-        for url, name, username in self.get_bookmarks(req):
-            base_path = req.base_path
-            params = self.__format_name(req, url)
-            if params['name']:
-                name = ' '.join([params['linkname'], params['name']])
-            else:
-                name = params['linkname']
-            anc = tag.a(name, href=base_path + url)
-            menu.append(tag.li(anc))
+        self.__append_bookmarks_to_menu(req, menu)
 
         placeholder = tag.span(menu, id='bookmark_placeholder')
         req.chrome.setdefault('ctxtnav', []).append(placeholder)