Template talk:Collection nav
String code[edit]
Is all of that string code just to figure out newlines? Couldn't we use the hlist class like on Template:Achievement nav? -Chieftain Alex 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 Alex 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)
- There are a few spanners in the “Is part of collection” list.
- Some of these sounds like broader template
collection
usage problems which need careful ironing out :/ -Chieftain Alex 22:28, 23 April 2017 (UTC)
- Some of these sounds like broader template
- 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 Alex 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:
- 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. - Create a meta page instead of having a redirect.
- 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
- 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 (talk • contribs) 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 thecollection
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)
- 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
- @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)
- @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)
- 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)
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)
- 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)
- 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)
- 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)
- 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)
Reward[edit]
The reward does not seem to use the item name in the item infobox. See Skyscale Scales 1, the reward is displayed as "Skyscale Scales (item)". —Kvothe (talk) 11:36, 12 June 2020 (UTC)
- The template now checks for the canonical name of the reward item and sets the correct wikilink if it exists. It has been a while since I last edited a template on the wiki, so if anyone else can double-check my change, that would be great! —Nefastu 19:34, 13 June 2020 (UTC)
[edit]
Looking specifically at the bottom of Anti-Singe Containment Field, the navs would ideally be sorted 3,4,5,6. The current output is 6,3,4,5.
I thought adding "+order" into it would work (based on the similar edit to the mastery point template per smw:Help:Ask syntax/Printout sorting order), but can't quite get it correct (I can only get it to sort 6,5,4,3, but not 3,4,5,6). Any given value for the +order parameter seems to make it sort in descending order...
- default (unsorted): Requiem: Experiment 6;Requiem: Experiment 3;Requiem: Experiment 4;Requiem: Experiment 5
- sorted ascending: Requiem: Experiment 6;Requiem: Experiment 5;Requiem: Experiment 4;Requiem: Experiment 3
- sorted descending: Requiem: Experiment 6;Requiem: Experiment 5;Requiem: Experiment 4;Requiem: Experiment 3
- sorted numerically ascending: Requiem: Experiment 6;Requiem: Experiment 5;Requiem: Experiment 4;Requiem: Experiment 3
- sorted numerically descending: Requiem: Experiment 6;Requiem: Experiment 5;Requiem: Experiment 4;Requiem: Experiment 3
Ideas? Is this a SMW bug? -Chieftain Alex 17:52, 10 October 2021 (UTC)
- Seems to working fine with the following edit to the first line:
<includeonly>{{#arraymap: {{{1|{{#show: {{{page|{{PAGENAME}}}}} | ?Is part of collection |+order=asc | valuesep=; | link = none }}}}} |;|@@@|
- If I move the
|+order=asc
block in front of the| ?Is part of collection
block, things get wonky. Looks like the sort order must be set for the result column 'Is part of collection'? —Nefastu 18:02, 10 October 2021 (UTC)
- Really..
- sorted asc: Requiem: Experiment 3;Requiem: Experiment 4;Requiem: Experiment 5;Requiem: Experiment 6
- sorted desc: Requiem: Experiment 6;Requiem: Experiment 5;Requiem: Experiment 4;Requiem: Experiment 3
- so "asc" works but "ascending" does not. wtf. Thanks though I don't understand why. -Chieftain Alex 19:09, 10 October 2021 (UTC)
- Yup that's exactly the line in the source code I was looking at.... -Chieftain Alex 10:25, 11 October 2021 (UTC)
- For example also "|+offset=<number>" works (although it's not documented anywhere), but I couldn't find out where this file handles it.
- The more one tries to understand SMW, the messier it gets... like they are adding gimmicks all over the place and probably are only testing them with the simplest queries available. --Tolkyria (talk) 12:41, 11 October 2021 (UTC)
- Yes, often feels like they don't really test features. I have long suspected we have the largest database annotated with semantic stuff and the most complicated SMW templates/demands. -Chieftain Alex 13:32, 11 October 2021 (UTC)