Difference between revisions of "Template:Icon"

From Project: Gorgon Wiki
Jump to: navigation, search
m (Trying to fix the "none" icon DIV ("none" is also an image alignment parameter, hence the extra div))
m
 
(31 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[File:{{#switch:{{lc:{{{1|}}}}}
+
<includeonly>[[File:item-icon-{{#switch:{{{1|}}}
<!-- special case, "none" is mistaken as a horizontal alignment option -->
+
<!-- icon substitutions for lookalike items (in alpha) -->
  | none     = item-icon-none.png
+
  | lemon    = banana
<!-- icons with a custom wiki page destination -->
+
| #default  = {{{1|none}}}
  | firedust  = item-icon-firedust.png{{!}}link=Fire Dust
+
}}.png|class=js-icon-tt|{{#if: {{{size|}}} | {{{size}}}{{!}}sub{{!}} }}{{#switch:{{{1|}}}
  | saltpeter = item-icon-saltpeter.png{{!}}link=Saltpeter
+
<!-- set the item name based on icon name, and link for some -->
  | sulfur    = item-icon-sulfur.png{{!}}link=Sulfur
+
| bottle    = Empty Bottle
<!-- Add mouseover title to help identify similar looking icons in the recipes table -->
+
  | firedust  = Fire Dust{{!}}link=Fire Dust
  | banana    = item-icon-banana.png{{!}}Banana
+
| milk      = Bottle of Milk
  | beet      = item-icon-beet.png{{!}}Beet
+
| redapple  = Red Apple
  | butter    = item-icon-butter.png{{!}}Butter
+
  | saltpeter = Saltpeter{{!}}link=Saltpeter
  | beet      = item-icon-grape.png{{!}}Grapes
+
  | sulfur    = Sulfur{{!}}link=Sulfur
  | lemon    = item-icon-banana.png{{!}}Lemon
+
  | water    = Bottle of Water
  | milk      = item-icon-milk.png{{!}}Bottle of Milk
+
  | roughtan = Rough Tannin Powder{{!}}link=Rough Tannin Powder
  | orange    = item-icon-orange.png{{!}}Orange
+
  | decenttan = Decent Tannin Powder{{!}}link=Decent Tannin Powder
  | potato    = item-icon-banana.png{{!}}Potato
+
  | qualitytan = Quality Tannin Powder{{!}}link=Quality Tannin Powder
  | redapple  = item-icon-redapple.png{{!}}Red Apple
+
  | shoddy_animalskin = Shoddy Animal Skin{{!}}link=Shoddy Animal Skin
  | salt      = item-icon-salt.png{{!}}Salt
+
  | rough_animalskin = Rough Animal Skin{{!}}link=Rough Animal Skin
  | sugar    = item-icon-sugar.png{{!}}Sugar
+
  | crude_animalskin = Crude Animal Skin{{!}}link=Crude Animal Skin
  | water    = item-icon-water.png{{!}}Bottle of Water
+
  | decent_animalskin = Decent Animal Skin{{!}}link=Decent Animal Skin
 +
  | nice_animalskin = Nice Animal Skin{{!}}link=Nice Animal Skin
 +
  | quality_animalskin = Quality Animal Skin{{!}}link=Quality Animal Skin
 +
  | potato = Potato{{!}}link=Potato
 +
  | onionseedling = Onion Seedling{{!}}link=Onion Seedling
 
<!-- default uses the shop item naming convention -->
 
<!-- default uses the shop item naming convention -->
  | #default  = item-icon-{{{1|none}}}.png{{!}}{{{1}}}
+
  | #default  = {{#if:{{{label|}}}|{{{label}}}|{{ucfirst:{{{1}}}}} }}
<!-- WTF?
+
}}]]</includeonly><noinclude>
==> if size not provided, try to get the icon name to show as red text when icon is missing, and otherwise show custom title above
 
==> if size is provided, then custom captions above don't work, short of using more complex templating due to caption not being a named param.
 
-->
 
}}{{#if: {{{size|}}} | {{!}}{{{size}}}{{!}}sub{{!}} }}]]<noinclude>
 
 
__NOTOC__
 
__NOTOC__
==Syntax==
+
Do not use this template. Use: [[Template:Item_icon]] instead.
 +
==Usage==
 
<pre>
 
<pre>
 +
{{icon|<name>}}
 
{{icon|<name>|size=16px}}
 
{{icon|<name>|size=16px}}
 +
{{icon|<name>|label=<full item name>}}
 +
{{icon|<name>|size=16px|label=<full item name>}}
 
</pre>
 
</pre>
  
 
==Description==
 
==Description==
This template has several purposes:
+
Create an item icon with a mouseover tooltip that shows the full item name.
* Makes some item icons link to relevant article pages instead of the default "File history" page (eg. Saltpeter).
+
 
* It can save many edits in the future, for example certain foods that have the same icon now (banana & lemon), could have a unique icon later. The article refers to the individual foods, so the article won't need updating.
+
The template code does the following:
* Adds mouseover title. <span style="color:red">'''TODO'''</span>: add a mouseover popup with the title (very handy in recipes tables)
+
* Makes certain icons link to relevant article instead of the "File history" page (eg. Saltpeter).
* Reduces custom mediawiki code in the articles.
+
* Substitute certain icons during alpha, when several items use the same icon (eg. lemon uses banana icon), this is important so that the wiki article is specifying the proper icons. If/when these items get a unique icon, only the substitution in the template needs to be removed.
 +
* Adds a mouseover tooltip effect that display the full name of the item.
 +
* The capitalized icon name is the item name by default, which saves providing a separate item name for simple one-word items (eg. "banana" > "Banana").
 +
* Automatically provides a long name for common icons, eg. "water" => "Bottle of Water", which reduces code in the article.
  
 
==Parameters==
 
==Parameters==
Line 43: Line 50:
 
: Name of the icon. See [[Item Icons Guide]] for available icons (eg. "firstaid"). If not provided, an empty box is shown.
 
: Name of the icon. See [[Item Icons Guide]] for available icons (eg. "firstaid"). If not provided, an empty box is shown.
  
; size  
+
; size
 
: OPTIONAL. Changes the size of the icon (default is 32px).
 
: OPTIONAL. Changes the size of the icon (default is 32px).
 +
 +
; label
 +
: OPTIONAL. Specify the image title, which also becomes a mouseover tooltip. Use this for long item names where the capitalized icon name does not match, and for items that use the same icon so the tooltip shows the correct item name (eg. "Advanced Holistic Ink" and "Basic Holistic Ink" which use the same icon).
  
 
==Examples==
 
==Examples==
 +
Default 32x32px icon. By default the capitalized icon name becomes the tooltip: "lemon" => "Lemon".
 +
<pre>
 +
{{icon|lemon}}
 +
</pre>
 +
 +
Smaller inline icon.
 +
<pre>
 +
{{icon|saltpeter|size=16px}}
 +
</pre>
 +
 +
Provide the full name for items that have similar looking icons with '''label''' parameter.
 
<pre>
 
<pre>
{{icon|saltpeter}}
+
{{icon|genericpot|label=Advanced Holistic Ink}}
 
</pre>
 
</pre>
  
 
[[Category:Formatting templates|ItemT]]
 
[[Category:Formatting templates|ItemT]]
 
</noinclude>
 
</noinclude>

Latest revision as of 19:19, 24 February 2017


Do not use this template. Use: Template:Item_icon instead.

Usage

{{icon|<name>}}
{{icon|<name>|size=16px}}
{{icon|<name>|label=<full item name>}}
{{icon|<name>|size=16px|label=<full item name>}}

Description

Create an item icon with a mouseover tooltip that shows the full item name.

The template code does the following:

  • Makes certain icons link to relevant article instead of the "File history" page (eg. Saltpeter).
  • Substitute certain icons during alpha, when several items use the same icon (eg. lemon uses banana icon), this is important so that the wiki article is specifying the proper icons. If/when these items get a unique icon, only the substitution in the template needs to be removed.
  • Adds a mouseover tooltip effect that display the full name of the item.
  • The capitalized icon name is the item name by default, which saves providing a separate item name for simple one-word items (eg. "banana" > "Banana").
  • Automatically provides a long name for common icons, eg. "water" => "Bottle of Water", which reduces code in the article.

Parameters

parameter 1
Name of the icon. See Item Icons Guide for available icons (eg. "firstaid"). If not provided, an empty box is shown.
size
OPTIONAL. Changes the size of the icon (default is 32px).
label
OPTIONAL. Specify the image title, which also becomes a mouseover tooltip. Use this for long item names where the capitalized icon name does not match, and for items that use the same icon so the tooltip shows the correct item name (eg. "Advanced Holistic Ink" and "Basic Holistic Ink" which use the same icon).

Examples

Default 32x32px icon. By default the capitalized icon name becomes the tooltip: "lemon" => "Lemon".

{{icon|lemon}}

Smaller inline icon.

{{icon|saltpeter|size=16px}}

Provide the full name for items that have similar looking icons with label parameter.

{{icon|genericpot|label=Advanced Holistic Ink}}