Pwirth has uploaded a new change for review.
https://gerrit.wikimedia.org/r/249383
Change subject: TopMenuBarCustomer: Added anchor ids to output +
fixes/improvements
......................................................................
TopMenuBarCustomer: Added anchor ids to output + fixes/improvements
* Added anchorID property + setter to view
* Fixed "wiki" navigation site id
* Added this return to each setter in view
* Fixed white-space wrap for child items
* Did some cc
=> needs merge to REL1_23!
Change-Id: I99ed9e79242636cadce46550847bb62f1c82b501
---
M TopMenuBarCustomizer/TopMenuBarCustomizer.class.php
M TopMenuBarCustomizer/resources/bluespice.TopMenuBarCustomizer.css
M TopMenuBarCustomizer/views/view.TopMenuItem.php
3 files changed, 67 insertions(+), 13 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions
refs/changes/83/249383/1
diff --git a/TopMenuBarCustomizer/TopMenuBarCustomizer.class.php
b/TopMenuBarCustomizer/TopMenuBarCustomizer.class.php
index 63c5d32..8b9c6b5 100644
--- a/TopMenuBarCustomizer/TopMenuBarCustomizer.class.php
+++ b/TopMenuBarCustomizer/TopMenuBarCustomizer.class.php
@@ -126,7 +126,7 @@
$oMainPage = Title::newMainPage();
self::$aNavigationSites[] = array(
- 'id' => 'wiki',
+ 'id' => 'nt-wiki',
'href' => $oMainPage->getFullURL(),
'text' => $wgSitename,
'active' => $oCurrentTitle->equals( $oMainPage ),
@@ -204,13 +204,16 @@
foreach( self::getNavigationSites() as $aApp ) {
$aApp = array_merge(self::$aNavigationSiteTemplate,
$aApp);
$oMainItem = new ViewTopMenuItem();
- $oMainItem->setLevel( $aApp['level'] );
- $oMainItem->setName( $aApp['id'] );
- $oMainItem->setLink( $aApp['href'] );
- $oMainItem->setDisplaytitle( $aApp['text'] );
- $oMainItem->setActive( $aApp['active'] );
- $oMainItem->setContainsActive( $aApp['containsactive']
);
- $oMainItem->setExternal( $aApp['external'] );
+ $oMainItem
+ ->setName( $aApp['id'] )
+ ->setLink( $aApp['href'] )
+ ->setLevel( $aApp['level'] )
+ ->setActive( $aApp['active'] )
+ ->setExternal( $aApp['external'] )
+ ->setAnchorID( $aApp['id'] )
+ ->setDisplaytitle( $aApp['text'] )
+ ->setContainsActive( $aApp['containsactive'] )
+ ;
if( !empty($aApp['children']) ) {
$oMainItem->setChildren( $aApp['children'] );
}
diff --git a/TopMenuBarCustomizer/resources/bluespice.TopMenuBarCustomizer.css
b/TopMenuBarCustomizer/resources/bluespice.TopMenuBarCustomizer.css
index b10b7a2..f301117 100644
--- a/TopMenuBarCustomizer/resources/bluespice.TopMenuBarCustomizer.css
+++ b/TopMenuBarCustomizer/resources/bluespice.TopMenuBarCustomizer.css
@@ -33,3 +33,6 @@
.bs-apps-child a:hover{
background: none;
}
+.bs-apps-child a{
+ white-space: nowrap;
+}
\ No newline at end of file
diff --git a/TopMenuBarCustomizer/views/view.TopMenuItem.php
b/TopMenuBarCustomizer/views/view.TopMenuItem.php
index 2e2417d..c1d82f1 100644
--- a/TopMenuBarCustomizer/views/view.TopMenuItem.php
+++ b/TopMenuBarCustomizer/views/view.TopMenuItem.php
@@ -26,6 +26,11 @@
*/
protected $iLevel = 1;
/**
+ * Item AnchorID
+ * @var string
+ */
+ protected $sAnchorID = '';
+ /**
* Name of the item
* @var string
*/
@@ -71,65 +76,91 @@
/**
* Sets the level property
* @param integer $iLevel
+ * @return ViewTopMenuItem
*/
public function setLevel( $iLevel ) {
$this->iLevel = $iLevel;
+ return $this;
+ }
+
+ /**
+ * Sets the sAnchorID property
+ * @param string sAnchorID
+ * @return ViewTopMenuItem
+ */
+ public function setAnchorID( $sAnchorID ) {
+ $this->sAnchorID = $sAnchorID;
+ return $this;
}
/**
* Sets the name property
* @param string $sName
+ * @return ViewTopMenuItem
*/
public function setName( $sName ) {
$this->sName = $sName;
+ return $this;
}
/**
* Sets the display title property
* @param string $sDisplayTitle
+ * @return ViewTopMenuItem
*/
public function setDisplaytitle( $sDisplayTitle ) {
$this->sDisplayTitle = $sDisplayTitle;
+ return $this;
}
/**
* Sets the Link property
* @param string $sLink
+ * @return ViewTopMenuItem
*/
public function setLink( $sLink ) {
$this->sLink = $sLink;
+ return $this;
}
/**
* Sets the active property
* @param boolean $bActive
+ * @return ViewTopMenuItem
*/
public function setActive( $bActive ) {
$this->bActive = $bActive;
+ return $this;
}
/**
* Sets the contains active property
* @param boolean $bContainsActive
+ * @return ViewTopMenuItem
*/
public function setContainsActive( $bContainsActive ) {
$this->bContainsActive = $bContainsActive;
+ return $this;
}
/**
* Sets the external property
* @param boolean $bExternal
+ * @return ViewTopMenuItem
*/
public function setExternal( $bExternal ) {
$this->bExternal = $bExternal;
+ return $this;
}
/**
* Sets the children property
* @param boolean $aChildren
+ * @return ViewTopMenuItem
*/
public function setChildren( $aChildren ) {
$this->aChildren = $aChildren;
+ return $this;
}
/**
@@ -140,26 +171,39 @@
public function execute( $aParams = false ) {
$aClasses = array();
- $aClasses[] = empty($this->aChildren) ? 'menu-item-single' :
'menu-item-container';
+ $aClasses[] = empty( $this->aChildren )
+ ? 'menu-item-single'
+ : 'menu-item-container'
+ ;
$aClasses[] = "level-$this->iLevel";
if( $this->bContainsActive) $aClasses[] = 'contains-active';
if( $this->bActive) $aClasses[] = 'active';
+ $sClasses = 'class="'.implode(' ', $aClasses).'"';
- $sTitle = $sText = empty($this->sDisplayTitle) ? $this->sName :
$this->sDisplayTitle;
+ $sTitle = $sText = empty( $this->sDisplayTitle )
+ ? $this->sName
+ : $this->sDisplayTitle
+ ;
if( wfMessage($sTitle)->exists() ) {
$sTitle = $sText = wfMessage($sTitle)->plain();
+ }
+ $sAnchorID = $this->sAnchorID;
+ if( !empty($sAnchorID) ) {
+ $sAnchorID = "id='$sAnchorID'";
}
global $wgExternalLinkTarget;
$sLinkTarget = '';
if( $this->bExternal && !empty($wgExternalLinkTarget) ) {
- $sLinkTarget = 'target="'.$wgExternalLinkTarget.'"';
+ $sLinkTarget = "target='$wgExternalLinkTarget'";
}
$sOut = '';
$sOut .= '<li>';
- $sOut .= "<a href='$this->sLink' class='".implode(' ',
$aClasses)."' $sLinkTarget>$sText</a>";
+ $sOut .= "<a href='$this->sLink' $sAnchorID $sClasses
$sLinkTarget>";
+ $sOut .= $sText;
+ $sOut .= "</a>";
if( !empty($this->aChildren) ) {
$sOut .= $this->rederChildItems();
}
@@ -171,9 +215,13 @@
$aOut[] ='<ul class="bs-apps-child
level-'.($this->iLevel+1).'">';
foreach( $this->aChildren as $aApp ) {
- $aApp =
array_merge(TopMenuBarCustomizer::$aNavigationSiteTemplate, $aApp);
+ $aApp = array_merge(
+ TopMenuBarCustomizer::$aNavigationSiteTemplate,
+ $aApp
+ );
$oItem = new ViewTopMenuItem();
+ $oItem->setId( $aApp['id'] );
$oItem->setLevel( $aApp['level'] );
$oItem->setName( $aApp['id'] );
$oItem->setLink( $aApp['href'] );
--
To view, visit https://gerrit.wikimedia.org/r/249383
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I99ed9e79242636cadce46550847bb62f1c82b501
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Pwirth <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits