Sjabloon:WSNavMenu: verschil tussen versies

Uit Auditpedia
Ga naar:navigatie, zoeken
(Created page with "<noinclude>{{Managed |Version=1.3 |Version notes=1.3 - <span style="color:red;">Modified version for Chameleon 2.0!</span> 1.2 - Removed duplicate ul 1.1 - Add option to use H...")
 
 
(8 tussenliggende versies door dezelfde gebruiker niet weergegeven)
Regel 1: Regel 1:
 
<noinclude>{{Managed
 
<noinclude>{{Managed
|Version=1.3
+
|Version=1.4
|Version notes=1.3 - <span style="color:red;">Modified version for Chameleon 2.0!</span>
+
|Version notes=1.4 - Replaced caamap and array parserfunctions (from the extensions PageForms and Arrays) with WSArrays equivalents.
 +
1.3 - Modified version for Chameleon 2.0
 
1.2 - Removed duplicate ul
 
1.2 - Removed duplicate ul
 
1.1 - Add option to use Href for dropdown links, so you can use url parameters.
 
1.1 - Add option to use Href for dropdown links, so you can use url parameters.
Regel 14: Regel 15:
 
<pre>
 
<pre>
 
{{WSNavMenu
 
{{WSNavMenu
|Input=
+
|Input=<text> enter a list of pages, with each subitem on a new line and an empty line between main menu items (see example below). Use "*" to add a linktext different from the pagetitle and "-" to add a divider between lines.
 
}}
 
}}
 
</pre>
 
</pre>
  
</noinclude><includeonly>{{#vardefine:@lt|*}}<!--
+
<pre>
  navigation bar
+
{{WSNavMenu
  --><div class="navbar navbar-expand-lg p-navbar noprint w-100 pt-0 pb-0"><!--
+
|Input=Main Page*{{Fa|home}} Home
 +
 
 +
Pages
 +
 
 +
Search*Search
 +
 
 +
{{Fa|lock}} Spaces
 +
Special:AddSpace*Add a Space
 +
Special:ActiveSpaces*Manage Active Spaces
 +
Special:ArchivedSpaces*Manage Archived Spaces
 +
 
 +
{{Fa|lock}} Tools
 +
MediaWiki:Ws-navmenu*NavMenu
 +
MediaWiki:Ws-header*Header
 +
MediaWiki:Ws-footer*Footer
 +
-
 +
Wiki:page-types*Page types
 +
Wiki:Wiki pages*Wiki pages
 +
-
 +
File:Logo.png*Logo
 +
}}
 +
</pre>
 +
 
 +
==Test==
 +
{{WSNavMenu
 +
|Input=Main Page*{{Fa|home}} Home
  
--><div class="navbar-header d-lg-none pt-4 pb-4"><!--
+
Pages
            --><div class="navbar-toggle " data-toggle="collapse" data-target="#mw-navigation-collapse"><!--
 
              --><span class="icon-bar"></span><!--
 
              --><span class="icon-bar"></span><!--
 
              --><span class="icon-bar"></span><!--
 
            --></div><!--
 
        --></div><!--
 
  
--><div id="mw-navigation-collapse" class="collapse navbar-collapse" ><!--
+
Search*Search
--><ul class="navbar-nav align-items-center"><!--
 
-->{{#arraymap: {{{Input|}}}  |\n\n |xxx |<!--
 
-->{{#arraydefine:@item|xxx|/\n/}}<!--
 
-->{{#ifeq: {{#arraysize:@item}} |1
 
|<!-- one link: --><li class="nav-item"><!--
 
  -->{{#arraydefine:@link and title| {{#arrayprint:@item}} |{{#var:@lt }} }}<!--
 
  -->{{#widget:Link |type=a
 
|href={{fullurl:{{#arrayindex:@link and title|0}} }}
 
|text={{#if: {{#arrayindex:@link and title|1}}|{{#arrayindex:@link and title|1}}|{{#arrayindex:@link and title|0}} }}
 
|class=nav-link
 
}}</li>
 
|<!-- dropdown. First item is head item. 
 
--><li class="nav-item dropdown"><!--
 
  -->{{#arraydefine:@head link and title| {{#arrayindex:@item|0}} |{{#var:@lt }} }}<!--
 
  -->{{#widget:Link |type=a
 
  |href=#
 
  |text={{#if:{{#arrayindex:@head link and title|1}}|{{#arrayindex:@head link and title|1}}|{{#arrayindex:@head link and title|0}} }} <b class="caret"></b>
 
|class=nav-link dropdown-toggle
 
|datatoggle=dropdown
 
}}<!--
 
-->{{#arrayslice:@li items|@item|1}}<!--
 
  
--><ul class="dropdown-menu" role="menu" aria-labelledby=""><!--
+
{{#ifingroup:moderator,sysop |{{Fa|lock}} Spaces
-->{{#arraymap: {{#arrayprint:@li items|;;;}} |;;;|yyy
+
Special:AddSpace*Add a Space
|{{#switch: yyy
+
Special:ActiveSpaces*Manage Active Spaces
|-=<li class="divider"></li>
+
Special:ArchivedSpaces*Manage Archived Spaces
|#default={{#arraydefine:@link and title| yyy|{{#var:@lt }} }}<!--
+
}}
-->{{#switch:{{#arrayindex:@link and title|2}}  
+
 
|Href={{Dropdown link
+
{{#ifingroup:sysop |{{Fa|lock}} Tools
|Href={{#arrayindex:@link and title|0}}
+
MediaWiki:Ws-navmenu*NavMenu
|Text={{#if:{{#arrayindex:@link and title|1}}|{{#arrayindex:@link and title|1}}|{{#arrayindex:@link and title|0}} }}
+
MediaWiki:Ws-header*Header
}}
+
MediaWiki:Ws-footer*Footer
|#default={{Dropdown link
+
-
|Page={{#arrayindex:@link and title|0}}
+
Wiki:page-types*Page types
|Text={{#if:{{#arrayindex:@link and title|1}}|{{#arrayindex:@link and title|1}}|{{#arrayindex:@link and title|0}} }}
+
Wiki:Wiki pages*Wiki pages
}} }}
+
-
}}
+
File:Logo.png*Logo
|}}<!--
+
}}
--></ul>
+
}}
</li>
 
<!-- end of switch: --->}}<!--
 
end of first array: --></li>|}}<!--
 
--></ul><!--
 
  
--></div></div></includeonly>
+
</noinclude><includeonly><!--
 +
-->{{#vardefine:@lt|*}}<!--
 +
  --><div class="navbar navbar-dark navbar-expand-lg bg-primary mt-3 mt-md-0" ><!--
 +
    --><wsfield class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar1"><!--
 +
    --></wsfield><!--
 +
    --><div class="collapse navbar-collapse justify-content-between w-100" id="navbar1"><!--
 +
      --><ul class="navbar-nav align-items-center"><!--
 +
        -->{{#caamap: {{{Input|}}}  |\n\n |xxx |<!--
 +
        -->{{#cadefine:@item|{{#regex:xxx|/\n/|_@_}}|_@_}}<!--
 +
        -->{{#ifeq: {{#casize:@item}} |1<!--
 +
        -->|<!--
 +
        --><li class="nav-item"><!--
 +
          -->{{#vardefine:@navitem| xxx |{{#var:@lt }} }}<!--
 +
          -->{{#vardefine:@navitem page |{{#explode:{{#var:@navitem}} |{{#var:@lt}} |0}} }}<!--
 +
          -->{{#vardefine:@navitem title |{{#explode:{{#var:@navitem}} |{{#var:@lt}} |1}} }}<!--
 +
          -->{{#widget:Link |type=a<!--
 +
          -->|href={{fullurl:{{#var:@navitem page}} }}<!--
 +
          -->|text={{#var:@navitem title |{{#var:@navitem page}} }}<!--
 +
          -->|class=nav-link<!--
 +
          -->|style=color:#fff<!--
 +
        -->}}<!--
 +
        --></li><!--
 +
        -->|<!--
 +
        --><li class="nav-item dropdown"><!--
 +
          -->{{#widget:Link |type=a<!--
 +
          -->|href=#<!--
 +
          -->|text={{#caprint:@item[0] }} <!--
 +
          --><b class="caret"><!--
 +
          --></b><!--
 +
          -->|class=nav-link dropdown-toggle<!--
 +
          -->|style=color:#fff<!--
 +
          -->|datatoggle=dropdown<!--
 +
          -->}}<!--
 +
          -->{{#caslice:@sub items|@item|1}}<!--
 +
          --><ul class="dropdown-menu" role="menu" aria-labelledby=""><!--
 +
            -->{{#camap:@sub items |yyy <!--
 +
            -->|{{#switch: yyy<!--
 +
            -->|-=<!--
 +
            --><li class="divider"><!--
 +
            --></li><!--
 +
            -->|#default={{#vardefine:@navitem| yyy |{{#var:@lt }} }}<!--
 +
              -->{{#vardefine:@navitem page |{{#explode:{{#var:@navitem}} |{{#var:@lt}} |0}} }}<!--
 +
              -->{{#vardefine:@navitem title |{{#explode:{{#var:@navitem}} |{{#var:@lt}} |1}} }}<!--
 +
              -->{{#vardefine:@navitem type |{{#explode:{{#var:@navitem}} |{{#var:@lt}} |2}} }}<!--
 +
              -->{{#switch:{{#var:@navitem type}} <!--
 +
              -->|Href={{Dropdown link<!--
 +
                -->|Href={{#var:@navitem page}}<!--
 +
                -->|Text={{#var:@navitem title |{{#var:@navitem page}} }}<!--
 +
                -->}}<!--
 +
              -->|#default={{Dropdown link<!--
 +
                -->|Page={{#var:@navitem page}}<!--
 +
                -->|Text={{#var:@navitem title |{{#var:@navitem page}} }}<!--
 +
                -->}}<!--
 +
              -->}}<!--
 +
            -->}}<!--
 +
            -->|}}<!--
 +
          --></ul><!--
 +
        --></li><!--
 +
        -->}}<!--
 +
      --></li>|\s}}<!--
 +
    --></ul><!--
 +
--></div><!--
 +
--></div><!--
 +
--></includeonly>

Huidige versie van 23 apr 2022 om 15:08


This is the WSNavMenu template. It should be called in the following format:

{{WSNavMenu
|Input=<text> enter a list of pages, with each subitem on a new line and an empty line between main menu items (see example below). Use "*" to add a linktext different from the pagetitle and "-" to add a divider between lines.
}}
{{WSNavMenu
|Input=Main Page*{{Fa|home}} Home

Pages

Search*Search

{{Fa|lock}} Spaces
Special:AddSpace*Add a Space
Special:ActiveSpaces*Manage Active Spaces
Special:ArchivedSpaces*Manage Archived Spaces

{{Fa|lock}} Tools
MediaWiki:Ws-navmenu*NavMenu
MediaWiki:Ws-header*Header
MediaWiki:Ws-footer*Footer
-
Wiki:page-types*Page types
Wiki:Wiki pages*Wiki pages
-
File:Logo.png*Logo
}}

Test