Page MenuHomePhabricator

Namespace specific GUI Changes
Closed, DeclinedPublic

Description

Author: mickflemm

Description:
I thought it would be usefull if someone could use different logos and sidebars
in different namespaces (e.g. different logo for the Help namespace and a
sidebar with the help categories) but i couldn't find a way to do it. So i
created a patch that does the folowing:

You can change the logo on a namespace using the $wgNamespaceLogos array.

$wgNamespaceLogos = array(<namespace_number> => <url_path_to/logo.gif>)

You can attach a custom sidebar to a namespace by creating a message
"nsbar_<namespace_number>" in the MediaWiKi namespace (that has the same format
as the "sidebar" message).

Hope you find it useful :-)

Nick


Version: unspecified
Severity: enhancement

Details

Reference
bz4042

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 8:57 PM
bzimport set Reference to bz4042.
bzimport added a subscriber: Unknown Object (MLST).

mickflemm wrote:

Patch for Skin.php

To apply the patch, save the patch to a file e.g. nsattrs.patch, go to the
mediawiki directory and run:

patch -p0 < nsattrs.patch

Attached:

mickflemm wrote:

Note: The above patch is for version 1.5.2

ayg wrote:

*** Bug 2291 has been marked as a duplicate of this bug. ***

dto wrote:

patch for r16100 adding namespace-specific interfaces (1.8-svn)

This patch does pretty much the same thing as the 1.5.2 patch, for 1.8.

Logos (same):

  • $wgNamespaceLogos -- array: NS_* => [logo url]

Sidebar (different):

  • sidebar[NS_*] (instead of nsbar_[NS_*]) -- sidebar sounds better than nsbar,

IMHO

  • sidebar[NS_*] replaces sidebar, instead of augmenting it, but falls back to

sidebar if it doesn't exist

Attached:

Going to close this as WONTFIX, because I don't think this is something we need in core.

However, there are a few good workarounds to do what you want. Since we include the namespace as a class on <body> (in addition to in the Javascript globals we provide), it's very easy to write custom CSS and use Javascript to manipulate the page on a per-namespace basis. Same goes for the sidebar: you can write a function to hook into SkinBuildSidebar to customize the sidebar; this does break the sidebar cache, though.

ayg wrote:

Note that for instance, you can do a per-namespace logo with CSS like this:

body.ns-1 #p-logo a { background-image: url(my_talk_logo_url.png) !important; }

That will use the given image for the logo in ns1 (i.e., Talk:). The logo is only added in the first place using CSS anyway. So a whole new config option just for this is overboard.