Jump to content

Template talk:PortalButton

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Troubleshooting

[edit]

@JLJ001:

I think I've fixed the narrow misbehaviour by wrapping the image syntax in a div with style clear:both. Now the text stays below the image in narrow widths.

Would you be able to take a look at the font-weight problem? I'm at a dead end on that. Cheers Cesdeva (talk)

Well it now does bold or italics, default is none. This uses a conditional function to add ''' wiki-markup. JLJ001 (talk) 15:27, 23 May 2018 (UTC)[reply]
Thanks, that's amazing. Cesdeva (talk) 16:34, 23 May 2018 (UTC)[reply]
@JLJ001: I'm not versed in the slightest on #ifreq, but is that line of markup defined outside of the main div (below the noinclude tags) supposed to be there? Also where on Wikipedia can i learn about that type of markup? Cheers Cesdeva (talk) 00:25, 25 May 2018 (UTC)[reply]
@Cesdeva: Indeed I seem to have left that there by accident (fixed now). The actual markup is explained in more detail at MW:Help:Extension:ParserFunctions and MW:Help:Magic words. JLJ001 (talk) 09:01, 25 May 2018 (UTC)[reply]
Thanks. Cesdeva (talk) 19:46, 25 May 2018 (UTC)[reply]

Live testing

[edit]

The template is being tested at Portal:Herbalism/RelatedArticles.

  • Issues:

- The templates, when in formation, have a slight affinity to the left margin of the page. Possibly a mediawiki trait.

- Mixing portrait dimensioned images with landscapes requires making adjustments, or just not using portrait images.

  • Notes:

Template generally performing well.

Would like to be able to center the inline-block, relative to the mediawiki skin.

  • Adding the |center=yes parameter will now center it, but also overrides the margin setting if used, and if used may also change other behavior since the element is declared as a block rather than as inline. JLJ001 (talk) 20:50, 25 May 2018 (UTC)[reply]
Cheers, yep, it's now centered but in a block. I was thinking...
  • center=yes opens div tag
  • center=end closes div tag

That way you could open the centering div in one pb template, and close the centering div in another. Every template in-between would be centered right? Or am I just bonkers? Cesdeva (talk) 21:27, 25 May 2018 (UTC)[reply]

While that is technically possible (and coded), I can't help but feeling some future editor with no knowledge of how this template works would find it a real pain to find why all their elements are mysteriously floating around. A better solution may be to use {{center}} immediately after, which can center numerous elements at once by putting the closing }} where you want it to close. However if desired, |nocenterend=yes will omit the closing </div>, and |centerendneeded=yes will add an otherwise unnecessary </div> just before the template. JLJ001 (talk) 22:00, 25 May 2018 (UTC)[reply]

Thanks for the extra fun. I think you are probably right. As I was nodding off to sleep, another way to do it occurred to me:

{{{image-s}}}

{{{image-s}}}

{{{image-s}}}

{{{image-s}}}

{{PortalButton|center=yes|text={{PortalButton|margin=0px|border-w=0px|text={{PortalButton|margin=0px|border-w=0px|text={{PortalButton|margin=0px|border-w=0px}}}}}}}}

Cesdeva (talk) 22:38, 25 May 2018 (UTC)[reply]


Sandbox testing

[edit]

Observation: Removing the overflow:hidden attribute caused the template to adjust its rendered sizing slightly.

Action: Overflow values are now a parameter. Will probe this further.

Action/Observation: Removed the centering code and added 'left:%' and 'right:%' parameters. Set 'left' to 5%. Buttons sat in a regular inline-block formation without centering issues. In mobile-mode the buttons acted as expected.

I also removed clear:both from the div wrapping the image, but that likely had no effect, so will restore.

Action:

  • Will remove the 'right%' parameter as I think it may be obsolete.
  • Restore clear:both

@JLJ001: Sorry I keep pinging you. I want to set 'left:5%' as default but I don't think that would be a good idea for individual buttons, and I don't want to interfere with the code you've already added. Do you think I should make a new derivative template called 'PortalMultiButton' (or similar) that focuses on using multiple buttons at once? Cesdeva (talk) 18:09, 26 May 2018 (UTC)[reply]

It could be an option to add a |multi=yes parameter which activates it (and maybe other things specific to multi button use), but keeping it in the same template? JLJ001 (talk) 18:24, 26 May 2018 (UTC)[reply]
Ya i hadn't thought of that. Let's give that a go. I'll update the documentation with the latest developments. Cesdeva (talk) 18:42, 26 May 2018 (UTC)[reply]

Lua

[edit]

I've created Module:PortalButton for use with this template.

The first function is called 'yesparity'. It should check the value of the {{{multi}}} parameter against lowercase "yes" or "y", and prevent it activating when people inevitably write 'no'.

I haven't tested the function yet and it may not work. My knowledge of Lua, or any programming, is very limited Cesdeva (talk) 11:29, 30 May 2018 (UTC)[reply]

Documentation page Style

[edit]

Is there a particular reason the documentation subpage is so marked-up? It makes it a bit difficult to add anything because I have to navigate the tangle of divs. — AfroThundr (u · t · c) 22:01, 2 June 2018 (UTC)[reply]

I didn't understand how other templates produced the standard doc page, so I just hashed out a quick sketch using some transitional markup. Just a temporary solution. Cesdeva (talk) 23:18, 2 June 2018 (UTC)[reply]