Last modified: 2008-08-10 08:30:19 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T17079, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 15079 - Add class="ns-talk" / "ns-subject" to <body>
Add class="ns-talk" / "ns-subject" to <body>
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: easy
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-08-07 21:18 UTC by Happy-melon
Modified: 2008-08-10 08:30 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch to add ns-talk or ns-subject to body (2.82 KB, patch)
2008-08-09 06:23 UTC, SQL
Details

Description Happy-melon 2008-08-07 21:18:42 UTC
Per DavidGothberg's suggestion at http://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_%28technical%29&oldid=230482022#CSS_talkpage_detection it would be sensible to add another class to the attributes of <body> in all pages: "ns-talk" for all odd namespaces, and something like "ns-subject" for all even namespaces. I expect this would be trivial in both performance and coding time.
Comment 1 Chad H. 2008-08-07 22:47:39 UTC
I suggest WONTFIX. The rationale for adding this is rather limited, as .ns-1, .ns-3, etc is perfectly valid CSS. Unlike bug 15052 which is at least arguably useful. The body class has _quite_ a few classes on it already, and tacking another one (esp. one with such limited actual use) seems like a waste. 

The data is already there, use it.
Comment 2 Brion Vibber 2008-08-08 00:11:31 UTC
The set of namespaces is potentially open-ended; new custom (and new standard!) namespaces could be added at any time, requiring an infinite list of all odd numbers to cover your bases. ;)

Much simpler to have a distinct marker.
Comment 3 Aryeh Gregor (not reading bugmail, please e-mail directly) 2008-08-08 00:35:09 UTC
Not infinite, just 2^30 or so.  ;)  I guess it's simpler to have this if a lot of user CSS relies on it, since that can't be so easily tracked down and updated, but it seems excessive.  Then again, there's technically no cost to having loads of extra classes, I suppose.
Comment 4 AlexSm 2008-08-08 01:34:19 UTC
Note that the existence of multipurpose ns-4 "Project" namespace (used for discussions, guides, essays, etc) makes the "ns-talk" proposal a lot less useful.
Comment 5 Happy-melon 2008-08-08 09:24:04 UTC
I don't remember putting that in the user manual... :D

It's only tradition that results in multipurpose use of ns-4; it's rather counterintuitive given the rigidity with which we control the use of other namespaces.  In an ideal world ns-4 and ns-5 would be as clearly delimited as the others.  But that's besides the point. 

For a real example, I have an inkling that what DavidGothberg wants to do is unite all the messagebox templates on en.wiki ([[Template:Ambox]], [[Template:Imbox]], [[Template:Tmbox]], etc), and present one template with a display switched by CSS, not by parser functions.  [[Template:Tmbox]] is intended to be used in *all* our even namespaces (for reference, [[Template:Ombox]] is the style prescribed for ns-4).  This would instantly give namespace-switching capabilities to all our messageboxes, which is something we've been struggling to do without creating a monster of a metatemplate.  So in this example, the presence of the "multipurpose" ns-4 is of no relevance.  
Comment 6 Happy-melon 2008-08-08 10:20:24 UTC
If anyone does want to do this, I think it's as easy as adding:

($wgTitle->getNamespace() % 2 ? "ns-talk" : "ns-subject").' '.

to the end of line 549 in /trunk/phase3/includes/Skin.php (one day I'm going to have to learn how to write proper patches!)
Comment 7 Aryeh Gregor (not reading bugmail, please e-mail directly) 2008-08-08 13:43:47 UTC
MWNamespace::isTalk( $wgTitle->getNamespace ) ? 'ns-talk' : 'ns-subject' would be more correct, although they might be functionally similar at the moment.  Anyway, yes, it's trivial to do, the question is whether we want it.
Comment 8 Brion Vibber 2008-08-08 23:35:33 UTC
$wgTitle->isTalkPage() would be even better. :)

And yes, we want it. There's no other reliable way to apply CSS to all talk pages or all subject pages. (Listing every possible talk namespace is not an option, as that's an open-ended set.)
Comment 9 SQL 2008-08-09 06:23:36 UTC
Created attachment 5155 [details]
Patch to add ns-talk or ns-subject to body

This patch should do what you guys want. Ended up having to modify a couple other files as well to get it to appear on all skins.
Comment 10 SQL 2008-08-10 08:30:19 UTC
Fixed in r39054 .

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links