# HG changeset patch # User Paul Boddie # Date 1264974189 -3600 # Node ID ee7a531577d3c4c6cab29da7643006bf1f43f42d # Parent f18865d6d6a4b7c262f47f75cdc085fd913922a4 Introduced a menu holder method to wrap the different controls. Added a link to the front page at the top of each page. Switched off the editing menu when it is not desired. diff -r f18865d6d6a4 -r ee7a531577d3 themes/minimalmoin/css/screen.css --- a/themes/minimalmoin/css/screen.css Sun Jan 31 02:45:07 2010 +0100 +++ b/themes/minimalmoin/css/screen.css Sun Jan 31 22:43:09 2010 +0100 @@ -91,6 +91,7 @@ /* Menus and lists. */ .editbar, +#mainpages, #navibar, #username, #pageabout, @@ -99,6 +100,7 @@ } .editbar, +#mainpages, #pageabout, #pagelocation, #pagetrail, @@ -114,6 +116,7 @@ } .editbar li, +#mainpages li, #pageabout li, #pagelocation li, #pagetrail li, @@ -207,10 +210,6 @@ vertical-align: middle; } -#interwiki { - font-size: 1em; -} - #pageline { } diff -r f18865d6d6a4 -r ee7a531577d3 themes/minimalmoin/minimalmoin.py --- a/themes/minimalmoin/minimalmoin.py Sun Jan 31 02:45:07 2010 +0100 +++ b/themes/minimalmoin/minimalmoin.py Sun Jan 31 22:43:09 2010 +0100 @@ -109,6 +109,7 @@ html.append(self.title(d)) html.append(self.about(d)) + html.append(self.mainpages(d)) html.append(fmt.div(on=0)) @@ -140,6 +141,7 @@ request = self.request fmt = request.formatter _ = request.getText + page = d["page"] html = [] # NOTE: Some pages cause section numbers to be enabled, affecting the @@ -156,32 +158,10 @@ html.append(fmt.div(on=1, attr={"id" : "footer"})) - html.append(fmt.div(on=1, attr={"class" : "editing"})) - html.append(fmt.span(on=1, attr={"class" : "menutitleholder"})) - html.append(fmt.span(on=1, attr={"class" : "menutitle"})) - html.append(fmt.text(_("Editing options"))) - html.append(fmt.span(on=0)) - html.append(self.editbar(d)) - html.append(fmt.span(on=0)) - html.append(fmt.div(on=0)) - - html.append(fmt.div(on=1, attr={"id" : "navigation"})) - html.append(fmt.span(on=1, attr={"class" : "menutitleholder"})) - html.append(fmt.span(on=1, attr={"class" : "menutitle"})) - html.append(fmt.text(_("Useful pages"))) - html.append(fmt.span(on=0)) - html.append(self.navibar(d)) - html.append(fmt.span(on=0)) - html.append(fmt.div(on=0)) - - html.append(fmt.div(on=1, attr={"id" : "identity"})) - html.append(fmt.span(on=1, attr={"class" : "menutitleholder"})) - html.append(fmt.span(on=1, attr={"class" : "menutitle"})) - html.append(fmt.text(_("User information"))) - html.append(fmt.span(on=0)) - html.append(self.username(d)) - html.append(fmt.span(on=0)) - html.append(fmt.div(on=0)) + if self.shouldShowEditbar(page): + html.append(self.menuholder(d, {"class" : "editing"}, _("Editing options"), self.editbar)) + html.append(self.menuholder(d, {"id" : "navigation"}, _("Useful pages"), self.navibar)) + html.append(self.menuholder(d, {"id" : "identity"}, _("User information"), self.username)) #html.append(self.trail(d)) @@ -194,6 +174,29 @@ return u''.join(html) + def mainpages(self, d, **kw): + """ Link to the front page and potentially other pages. + + @param d: parameter dictionary + @rtype: unicode + @return: front page link html + """ + + request = self.request + fmt = request.formatter + _ = request.getText + html = [] + + page = wikiutil.getFrontPage(self.request) + + html.append(fmt.bullet_list(on=1, attr={"id" : "mainpages"})) + html.append(fmt.listitem(on=1)) + html.append(page.link_to(request, text=_("Front page"), rel='nofollow')) + html.append(fmt.listitem(on=0)) + html.append(fmt.bullet_list(on=0)) + + return u''.join(html) + def about(self, d, **kw): """ Link to the controls in the footer. @@ -219,6 +222,32 @@ return u''.join(html) + def menuholder(self, d, menu_attr, menu_title, menu_fn): + """ Wrap controls in a menu container. + + @param d: parameter dictionary + @param menu_attr: menu container element attributes + @param menu_title: the menu label text + @param menu_fn: the function or method producing the controls + @rtype: unicode + @return: menu container html + """ + + request = self.request + fmt = request.formatter + html = [] + + html.append(fmt.div(on=1, attr=menu_attr)) + html.append(fmt.span(on=1, attr={"class" : "menutitleholder"})) + html.append(fmt.span(on=1, attr={"class" : "menutitle"})) + html.append(fmt.text(menu_title)) + html.append(fmt.span(on=0)) + html.append(menu_fn(d)) + html.append(fmt.span(on=0)) + html.append(fmt.div(on=0)) + + return u''.join(html) + # Theme instantiation. def execute(request):