X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/441ed176bdff586e94390740969e103d783bd5f8..a927a78b4b0571dbdbd850a7b192bdb434e16061:/forum/modules/ui.py?ds=inline diff --git a/forum/modules/ui.py b/forum/modules/ui.py index 49ce249..2694110 100644 --- a/forum/modules/ui.py +++ b/forum/modules/ui.py @@ -1,13 +1,23 @@ class Registry(list): - def add(self, register): + def add(self, item): for i, r in enumerate(self): - if r.weight > register.weight: - self.insert(i, register) + if r.weight > item.weight: + self.insert(i, item) return - self.append(register) + self.append(item) + + def find_by_name(self, name): + for i in self: + if i.name and (i.name == name): + return i + + def remove_by_name(self, name): + for i, r in enumerate(self): + if r.name and (r.name == name): + return self.pop(i) HEAD_CONTENT = 'HEAD_CONTENT' @@ -16,6 +26,8 @@ PAGE_TOP_TABS = 'PAGE_TOP_TABS' FOOTER_LINKS = 'FOOTER_LINKS' PROFILE_TABS = 'PROFILE_TABS' +USER_MENU = 'USER_MENU' + __CONTAINER = { HEAD_CONTENT: Registry(), @@ -23,6 +35,8 @@ __CONTAINER = { PAGE_TOP_TABS: Registry(), FOOTER_LINKS: Registry(), PROFILE_TABS: Registry(), + + USER_MENU: Registry(), }