Jump to content

Template talk:Navbox generic/Archive 1

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Archive 1Archive 2Archive 3Archive 5

Color modification and Show/hide function

Can somebody modify the code so users can change the color of the template, and that it automatically includes some kind of show/hide function? JQF 19:40, 26 October 2006 (UTC)

Have implemented the latter by amending the class of the table used to "navbox collapsible"; as of now, however, this seems to be pushing the template's title off-center... Regards, David Kernow (talk) 12:29, 8 November 2006 (UTC)

Optional group# parameters

I modified the template so that blank or omitted group#= tags don't show up in the final product. --Dinoguy1000 Talk 11:17, 7 November 2006 (UTC)

Thanks; have already found this useful here. Regards, David Kernow (talk) 12:31, 8 November 2006 (UTC)
Don't mention it... ;) --Dinoguy1000 Talk 19:24, 8 November 2006 (UTC)

Adding blank lines...?

When displayed, a few blank lines seem to appear above the template; cf example on the template's page. I scanned the code in case there were a few hidden carriage-returns, but haven't spotted any... Anyone else seeing this...?  Thanks, David Kernow (talk) 12:16, 8 November 2006 (UTC)

This appears to be coming from the table itself. Which is odd because tables don't normally do that, but when I remove the table definition text appear on the immediate next line. However, if I put the table back, even using wiki-markup with no class definition, I get the gap. --CBD 13:55, 8 November 2006 (UTC)

Width

Heh, I never knew that style="width:auto" would actually work... Evidently, I didn't pay close enough attention to the tutorials that I've read... --Dinoguy1000 Talk 19:37, 8 November 2006 (UTC)

align parameter

Might this be made applicable to the groupX and/or listX parameters...?  (Hope I'm not missing something obvious.)  When one or more lists contain only one or two entries, for example, a left-align (plus a little padding-left) seems more appropriate for all lists as otherwise there can be a wide gap between a groupX name and the beginning of a short listX...)  Hope that makes sense, David Kernow (talk) 04:35, 9 November 2006 (UTC)

I don't know, I would think that if the template has that musch whitespace, it should just be collapsed horizontally... Perhaps that should be enabled by default, via the width:auto CSS code? Any thoughts? --Dinoguy1000 Talk 21:49, 9 November 2006 (UTC)
Yeah, that's why I added the 'width' parameter... to allow it to be collapsed down to a size with less whitespace. I agree that left default seems to make more sense (and created it that way back in March), but changing that now could impact alot of templates which were carefully designed to look ok with the centered text that someone added later. It should be possible to add extra parameters to set text alignment for the entire table or (ugh) individual rows. We'd probably need to go through the list and see which ones look better with centering. --CBD 13:01, 10 November 2006 (UTC)
No, just change it to left-aligned. The center-aligned text looks bad, is hard to read, and is redundant when placed inside a box that is already center-aligned on the page. Sure, it'll break a few poorly-designed templates, but it's not worth the drama.. We can allow for extra styling of the cells somewhere, but the current default center-alignment should be done away with. —Down10 TACO 21:00, 20 January 2007 (UTC)

Misalignment with other templates...?

Anyone else seeing the slight misalignment of the {{Chadian-Sudanese conflict}} Navbox generic template (as regards the other two templates below it) at the end of the Sudan article...?  If so, I'm not sure how it may be corrected...  Regards, David Kernow (talk) 04:44, 9 November 2006 (UTC)

...It appears to be caused by the align parameter...  David (talk) 04:48, 9 November 2006 (UTC)

I couldn't find that template on Sudan, but it looks ok on History of Sudan. May be due to some of the subsequent adjustments. --CBD 12:54, 10 November 2006 (UTC)

N lines

Is there any way the template can be designed so that you can use any number of lines you need, without all those lines actually being individually represented in the template? I'm especially looking for a method that doesn't use another template, for the sake of simplicity (or something like that). --Dinoguy1000 Talk 22:01, 9 November 2006 (UTC)

There is, but it isn't a good idea. You can make 'virtual lines' by inserting <br/> tags in the parameters. Thus 'group1' could have three lines on it and 'list1' three corresponding lists. The reason this isn't generally liked is that screenreaders for the blind describe content by cell rather than matching the visual layout... so they'd hear the three items in 'group1' all at once and then the three items in 'list1' and have to remember the order to match them up... not too bad with three, but gets icky with lots of rows. Alternatively, you could put all the table markup for new rows into a single parameter passed to the template... but at that point you might as well just write the table manually directly on the page. Do we really need navboxes with more than ten rows though? --CBD 12:46, 10 November 2006 (UTC)

Unfair whining

I'd just like to mention that even though I suck at doing anything with templates so I'm not going to fix it myself for fear of breaking half the 'pedia, I don't like this new centeredness thing. Just my two cents. Thanks, Mak (talk) 03:30, 10 November 2006 (UTC)

How do you mean? IIRC (is my memory really that bad?), the template was centered before all these changes as well... Indeed, that seems to be more or less the norm amongst many nav templates on WP. --Dinoguy1000 Talk 09:54, 10 November 2006 (UTC)
Somewhere along the line the template was set to 100% width... at which point 'alignment' should be irrelevant - left, right, or center it still takes up the full width of the screen. When I made the width optional I left it defaulted to 100% and thus I'd think it should look unchanged for existing uses without the '|width=' parameter. I used 'center' as the default alignment because that's the way most navboxes are displayed, but '|align=left' or '|align=right' can now be added to the template call to reposition it. --CBD 12:40, 10 November 2006 (UTC)

Border too thick

Can we get a thinner border (actually, the "cellpadding" or whatever, between the outer border and the box itself)? It's something like 6 or 8px now, and it looks too "fat". Duja 12:34, 19 December 2006 (UTC)

See my comments below under #Changing CSS padding of table which explain the reason for this and give a solution. -- Zyxw 08:55, 5 March 2007 (UTC)

16 items

I added 4 more optional items, adding up to 16 because... I need them. Is that a problem? Duja 13:02, 19 December 2006 (UTC)

I added four additional lines to allow for larger navtemplates in the future. --Dinoguy1000 Talk 20:39, 19 December 2006 (UTC)

Question regarding column widths

I'm having some issues with this template and despite trying to figure it out for myself I just can't nail it. The "style" parameter determines the width of the whole box, but what determines the width of the "groups" column and the "lists" column? I would like the "groups" column to resize itself just slightly bigger than the text it contains, but often it decides to go much bigger. For example:

Is it possible to add an extra parameter so that the width of the "groups" column can be directly adjusted? Templationist 20:36, 17 January 2007 (UTC)

I'm not sure, but I think (suspect?) these widths are a result of the template's table being class="navbox collapsible..."  Anyone else...?  Regards, David Kernow (talk) 07:54, 18 January 2007 (UTC)
Yes, the default column width is being defined by the HTML class. A different class could be used or additional parameters added to define this value separately. Alternatively, adding &nbsp repeatedly to the end of one of the 'list' parameters will cause the left hand column to be compressed. Essentially, each column receives a percentage of the total box width equivalent to the number of characters it contains over the total number of characters. --CBD 13:15, 18 January 2007 (UTC)
The new group-style parameter can fix this problem. Below is the same template shown above, but with the following line added: |group-style = width:33%;.
Another example: |group-style = width:1%;. Note that the column expands to fit the text.
This wasn't what I had in mind when adding group-style, but it seems to work. -- Zyxw 12:40, 8 February 2007 (UTC)

Colour parameter

The colour parameter only affects the titlebar colour. This usually means it will clash with the default blueish colour that's used for the "group" cells. Is it possible to either add an extra parameter for the group cells, or have the current parameter cover the group cells too? Templationist 20:59, 17 January 2007 (UTC)

This is something I forgot to mention before, so thanks for the reminder. Along the lines of the thread above, there may be a more elegant method using parameters with the class="navbox collapsible..."; otherwise, my first thought would be to convert all <th>{{{group''N''}}}</th> to <th style="background:{{{group_col|}}};">{{{group''N''}}}</th> or the like, i.e. where the parameter {{{group_col}}} can be used to set the color. Yours, David Kernow (talk) 08:02, 18 January 2007 (UTC)
I've added a new group-style parameter to the template. This allows you to specify CSS values to apply to the "group" cells. For instance: background-color: #nnnnnn; text-align: (left|center|right); vertical-align: (top|middle|bottom)...etc. This option overrides any styles that are applied to the entire table. Below is an example showing altered title and group backgrounds with the group text aligned to the right and top. It also shows how the text-alignment of the table (center) is overridden by the text-alignment of the group (right). -- Zyxw 10:26, 8 February 2007 (UTC)
{{Navbox generic
| name   = {{subst:PAGENAME}}
| title  = Navbox_generic using "group-style" parameter
| color  = #DDDDDD
| style  = width: 60%; text-align: center;
| group-style = background-color: #EEEEEE; text-align: right; vertical-align: top;
| state  = uncollapsed
| group1 = Group1
| list1  = Item1{{·}} Item2<br> Item3{{·}} Item4<br> Item5{{·}} Item6<br> Item7{{·}} Item8
| group2 = Group2
| list2  = Item1{{·}} Item2{{·}} Item3{{·}} Item4{{·}} Item5{{·}} Item6{{·}} Item7 {{·}} Item8
}}
Thank you. Putting white-space:nowrap; in group-style is useful for visual effect and reducing vertical space. Pomte 08:55, 16 February 2007 (UTC)

Added "image" and "bottom" parameters, as used in Template: Navbox generic with image

In an attempt to consolidate the navigation templates, I have updated {{Navbox generic}} to handle the image and bottom parameters as currently used in {{Navbox generic with image}}, plus a new top parameter. The template documentation has also been updated with descriptions and examples. The changes were made in a way that should not effect any existing templates using {{Navbox generic}}.

Notice that {{Navbox generic with image}} displays the image by creating two tables (one embedded inside another), while the new {{Navbox generic}} does it with a single table. I tested these changes before adding them to the template, but please post a message here if it causes any unforeseen problems. -- Zyxw 21:10, 22 February 2007 (UTC)

This change should have never taken place, because it adds more complexity to the code. This type of feature bloat is really unneeded. If there weren't all these new navbox templates being created then we have a pretty simple system. Three type: Navigation, dynamic navigation box, and navbox generic, each with and without image. And while I applaud you on implementing it without nested tables, it adds too much in code complexity for future maintainers. Keep the two separate in ability. —Dispenser 03:41, 23 February 2007 (UTC)
Dispenser brings up good points, though I have no idea how much extra load this puts on rendering templates. For the maintenance issue, clear documentation could be written to show which lines deal with the image. What I like about this new version is no table nesting, so there is no extra cellpadding around the groups and lists, a minor problem I was struggling with. If consensus says keep {{Navbox generic with image}} as a separate entity, could you (Zyxw) please incorporate this one-table-only aspect to that template as well? Thanks, Pomte 04:05, 23 February 2007 (UTC)
With all due respect, I disagree, and I'll argue also on maintainability. I come from a software background. And an important thing I learn is that copying and pasting code is bad. If somebody wants to change something, then he/she would have to duplicate the change to multiple places. It would be an opportunity to make human mistakes. The editor might forget (e.g. has to leave for real life duty and never finishes the job). Or there could be more than 2 places to update and the editor fails to catch all of them. --ChoChoPK (球球PK) (talk | contrib) 04:16, 23 February 2007 (UTC)
It's more of a fork than just coping and pasting. There could be instances where a change to WP cause breakage in one but not the other. Or where we have to put an ugly hack in one but not the other. And yes this happens look at the {{dynamic navigation box}} and {{dynamic navigation box with image}}Dispenser 05:20, 23 February 2007 (UTC)
I did change it to a single table in the past, but it got reverted with the introduction of the bottom parameter. Zyxw's code does not take into account that the user could leave out the first item. —Dispenser 05:20, 23 February 2007 (UTC)
It seems like every time someone wants a new feature we get another new template. We have four different types of generic (name/title/body) navigation templates and three of those have separate "... with image" templates. In addition there are generic navigation templates under other names that do things like place the {{tnavbar}} "v-d-e" on the right side or use {{edit}} instead. The problem, as mentioned above, is maintaining all these templates - eventually they get out of sync. The worst example is {{Dynamic navigation box}} which started out a NavFrame and changed to collapsible table, while {{Dynamic navigation box with image}} still uses NavFrame. It is getting to the point where we need a new WikiProject dedicated to navigational templates.
The reason I made these changes is because I wanted to create a template using {{Navbox generic with image}}, but I also wanted to use the group-style parameter from {{Navbox generic}}. At first I was going to revise the image version, but then realized my changes could be added to the original version without breaking any existing templates that use it.
I understand that some people prefer to have multiple templates where each is simple to understand and update. However, Navbox generic was already more complex than the other templates due to its extensive use of ParserFunctions which included examining 40 parameters for groups and lists. Anyone who could make sense of it before should be able to understand my revisions.
Finally, the reason for requiring the list1 parameter (when displaying an image) was to keep the template code relatively simple. It won't break existing templates because they don't have images. Every template created with Navbox generic needs at least one list item and that would normally be list1. The only exception I can think of is a template where ParserFunctions cause a different list to be displayed first. If this is an issue, the template can be revised (assuming someone doesn't just revert the entire thing). -- Zyxw 01:07, 24 February 2007 (UTC)
Personally, I like the whole thing. I had been thinking for some time of implementing an image in this template to eliminate the redundancy between the two, but I never got around to trying it... --Dinoguy1000 Talk 22:49, 7 March 2007 (UTC)