Template talk:Collection nav

From Guild Wars 2 Wiki
Jump to: navigation, search

Is all of that string code just to figure out newlines? Couldn't we use the hlist class like on Template:Achievement nav? -Chieftain AlexUser Chieftain Alex sig.png 19:40, 23 April 2017 (UTC)

{{#arraymap: {{{1|{{#show: {{{page|{{PAGENAME}}}}} | ?Is part of collection | link = none }}}}} |,|@@@|
<hr style="margin: 1em 0em; clear: both;" />
<div class="nav mech1 wide">
<div class="box">
<div class="heading">[[@@@|{{#replace:@@@| (achievement)|}} Collection]]</div>
<div class="wrapper">{{#vardefine:achievement-page|{{#ask: [[Has achievement page::@@@]] | link = none }}}}
{{{!}} class="hlist center"
{{#if: {{#show:{{#var:achievement-page}}|?Has unlock item}} | {{!}}<b>Unlock Item:</b> {{#show:{{#var:achievement-page}}|?Has unlock item}} }}
{{!}}-
{{!}} {{#ask: [[Is part of collection::@@@]] | link = none | format = ul | template = cname }}
{{!}}-
{{#if: {{#show:{{#var:achievement-page}}|?Gives item}} | {{!}}<b>Reward:</b> {{#show:{{#var:achievement-page}}|?Gives item}} }}
{{!}}}
|\n}}
I really wouldn't worry about the bullets hanging over newlines. -Chieftain AlexUser Chieftain Alex sig.png 20:08, 23 April 2017 (UTC)
There are a few spanners in the “Is part of collection” list.
First are the item skins that show up alongside the regular weapon. They need filtering out.
{{#if:{{#pos:@@@|(skin)}}|| …
The item to unlock the collection is included in “is part of collection” so it needs to be taken out.
{{#ifeq:@@@|{{#show:{{#var:achievement-page}}|?Has unlock item|link=none}}|| …
There are items that have rarity variants but their page acts as it’s own entry so they need to be filtered out. It’s easy enough to check if it has an item ID or not. Ancient Emerald Orrian Spoon is an example.
{{#if:{{#show:@@@|?Has game id}}| …
Finally there are collections with a fine and masterwork version of the same item so the rarity needs to be added to differentiate. These items have the same name with a #fine or #masterwork after them. The ancient spoon again has a good example.
{{#vardefine:canonical-name|{{#show:@@@|?Has canonical name}}{{#if:{{#pos:@@@|#}}| <i>({{#show:@@@|?Has item rarity}})</i>}}}}
It’s the five lines of code from line 20 to 24 that check the length of the current line and decides weather to line break or separate with a •. It may not be necessary but I think it looks better. J.Tesla (talk) 21:19, 23 April 2017 (UTC)
Some of these sounds like broader template collection usage problems which need careful ironing out :/ -Chieftain AlexUser Chieftain Alex sig.png 22:28, 23 April 2017 (UTC)
That would fix the skins and non-item issues. The unlocked item is more of a mislabelling. It is part of a collection but it’s a special part. The #rarity issue is because we have two items on the same page. They could be split up into two pages to make things clearer. J.Tesla (talk) 23:20, 23 April 2017 (UTC)
Have you got an example of a non-item? I can't think what non-item template would set Property:Is part of collection. -Chieftain AlexUser Chieftain Alex sig.png 23:29, 23 April 2017 (UTC)
Ancient_Emerald_Orrian_Spoon is listed three times; the two variants (fine/masterwork) and the page itself. You can see in the info boxes that it has a collection but no id. I just checked through Property:Is_part_of_collection and found only one other instance of this with Submarine_Periscope_Lens. I found this issue early on while testing and thought all accessories were setup like that. With these two fixed that line can be taken out. J.Tesla (talk) 06:10, 24 April 2017 (UTC)

Collapse option[edit]

Can we have an option to collapse it? The Tier 4 for the HoT Legendaries have rather large collections, making some small pages double in size due to the collection nav box. - Doodleplex 18:52, 22 May 2017 (UTC)

Added param and logic to automatically hide contents of the nav table if there are 30 or more collection items to render. I'm not too sure about what should be shown if the nav is collapsed (since I add an extra table row to hide the other table rows), so if you got a better idea, feel free to modify it. —Nefastu 22:09, 22 May 2017 (UTC)
Thank you! As for the text, maybe something like This collection has {{#var:achievement-item-count}} total items. Click the link on the right for the full list. Feels a little wordy though. - Doodleplex 22:22, 22 May 2017 (UTC)

Applicable with collection unlock items[edit]

Would it be possible to allow the Unlock item to also display the collection? For example, Astralaria Vol. 1 is the unlock item for Astralaria I: The Device, but doesn't display this template as it's not part of the collection per se. G R E E N E R 18:02, 22 June 2017 (UTC)

Quick workaround: add a collection item to the page parameter. —Nefastu 18:47, 22 June 2017 (UTC)
Usualy the unlock item is included in the list of items as part of the collection. This is a wierd one where it isn't (damn you Anet and your inconsistancy!). Two options: either add "collection = ..." to the infobox of the item or, as Nefastu said, add the template with another item linking it which gets the result for anyone browsing the page. J.Tesla (talk) 22:02, 22 June 2017 (UTC)
Thanks for the workaround. If this group of items is just a one-off example, then no need to fiddle with the template. G R E E N E R 06:46, 25 June 2017 (UTC)

fails when pointing to redirect[edit]

Seems like there's an issue when the achiev page is a redirect. See Ancient_Sunspear_Regalia. -Darqam 19:15, 3 December 2017 (UTC)

The infobox is storing the redirect location as the item's collection and so all the items think that they are part of the “Daybreak (achievements)” collection instead of the “This Belongs in a Museum” collection.
There are two solutions:
  1. Store the achievement property page as the collection instead of the achievement name. We can do this without changing what we write in the infobox by asking {{#ask:[[Has canonical name::This Belongs in a Museum]][[Has context::Achievement]]}}. The result will be Daybreak (achievements)#achievement4032 instead of This Belongs in a Museum. This will require a rewrite of any template that uses "Is part of collection" but will have the bonus of grouping all the achievement information into one place.
  2. Create a meta page instead of having a redirect.
I’d like to do the first option but it will require some prep so as to not cause havoc across the collection pages. For now option 2 is easier. J.Tesla (talk) 23:58, 3 December 2017 (UTC)
Yeah, That page is honestly one that should have it's own page, so eventually it won't be an issue, but I didn't want to create it until you had an opportunity to look into it a bit. I haven't touched the LWS4 achievs yet but that should get resolved when pages get built for it anyway. So no rush, but at least so it's know that it *can* happen. -Darqam 01:44, 4 December 2017 (UTC)

Collection items[edit]

moved from Talk:Ascended Accoutrement

Currently, a lot of armor pieces are marked as part of this collection, for example the Assaulter's Masque. This adds a lot of content to the {{collection nav}}s used at the bottom of the skin pages like Illustrious Masque; there's already a "... further results" link in the navbox. I suggest that only the skin pages should have the property "Is part of collection" set. In case a complete list of collection items is required somewhere, this can be done with an inline query like {{#ask: [[Has skin.Is part of collection::Ascended Accoutrement]]}}. Thoughts? —Blackice (talk) 18:02, 21 December 2017 (UTC)

The achievement does specify in its API that the collection is for skins, not items. I should be able to add a parameter to include (default), exclude, or only show skins. In this case we would use “only”. J.Tesla (talk) 14:22, 22 December 2017 (UTC)
I have added the parameter “skin” with the options “include”, “exclude”(default) and “only”. I’ve excluded skins by default because in most cases I’ve seen the skins are not a part of the collection. With this change the template no longer uses {{collection nav element}}. I’ll wait to see if anyone disagrees before I put a delete request on it. The preceding unsigned comment was added by J.Tesla (talkcontribs) at 17:50, 22 December 2017 (UTC).
Hmm, I'm a bit conflicted about this change. I played around with Special:ExpandTemplates and everything seems to work fine. But there are some collections that include both skins and regular items, where the #default choice hides part of the collection list. For example this one. So we have to check every page where this template is used and add the skin param manually when there's anything excluded. That does seem like some effort...
Honestly, regard the Ascended Accoutrement collection, I was just asking whether to remove the collection param from all non-skin infoboxes. Even if they are hidden from the navbox, pages like Assaulter's Masque shouldn't have the Is part of collection property set, because that's just wrong according to the API. —Blackice (talk) 19:12, 22 December 2017 (UTC)
@Doodleplex - could you please run your bot through all the items currently in this collection and remove the collection parameter? -86.177.235.196 19:31, 22 December 2017 (UTC)
Sure thing Alex. - Doodleplex 19:41, 22 December 2017 (UTC)
I've had a look at the API a little more and you're right, every weapon/armour in a collection is a skin, not an item. It shouldn't be too hard to pull all the item and skin IDs out of the API and ensure only they have the template on them but I don't think you'll ever keep it that way. I think the link to the collection and navs belong on the item pages even if they aren't technically part of the achievement because all the useful information is on the item page and that's where I usually end up when I'm working on a collection. I think the only way to solve this once and for all is to have the item/skin IDs directly on achievement infoboxes instead of scattered on individual item pages. J.Tesla (talk) 19:57, 22 December 2017 (UTC)
Showing the collection navbox on item pages is definitely a good idea, even if the navbox just links to the item's skin. —Blackice (talk) 22:49, 22 December 2017 (UTC)

Punctuation problems[edit]

Pretty much any collection that had items with punctuation in it, such as Magister's Pack and Zinn's Prize Student, is currently not working at all with the nav causing quite a large number of broken links instead. - Doodleplex 19:39, 26 December 2017 (UTC)

I tried to fix it. There should be less broken links now, ideally zero. —Blackice (talk) 20:54, 26 December 2017 (UTC)
I figured it was something small, but unfortunately I'm still a code novice, so thank you, it did fix the broken links. Was the reward going to the side the result of this or the earlier tweak though? It looks nice sometimes, but other times it doesn't. I'm not picky about the location, just that everything stays inside the box. - Doodleplex 21:07, 26 December 2017 (UTC)
I looked through this template's history, and it seems like the reward was always on the side. Not sure what to do about the overflow except for moving the reward below the link list. But I don't have anymore time to edit it today... :( —Blackice (talk) 21:46, 26 December 2017 (UTC)
Fixing broken link issue is infinitely more important than the rewards looks a little silly. Don't worry about it for now. ;) - Doodleplex 21:52, 26 December 2017 (UTC)
A little - was accidentaly removed in the swap from , to ;. When previewing the history of the template it will actually call the current template in the examples section, not the code in that little slice of time. Hense why all the old versions appeared to have the reward to the side. The best way to view older templates is to copy it into a sandbox and call that instead. J.Tesla (talk) 23:37, 26 December 2017 (UTC)
Thanks Tesla! =) - Doodleplex 23:38, 26 December 2017 (UTC)