Isarra has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/298048

Change subject: Styles!
......................................................................

Styles!

Change-Id: I4042110574590e07312dadd55dceb0a61862ffa9
---
M includes/content/CollaborationHubContent.php
M modules/ext.CollaborationKitMainHubViewFile.less
2 files changed, 83 insertions(+), 28 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CollaborationKit 
refs/changes/48/298048/1

diff --git a/includes/content/CollaborationHubContent.php 
b/includes/content/CollaborationHubContent.php
index 0e24ccd..11aa341 100644
--- a/includes/content/CollaborationHubContent.php
+++ b/includes/content/CollaborationHubContent.php
@@ -276,7 +276,7 @@
 
                                $prependiture .= Html::openElement(
                                        'div',
-                                       array( 'id' => 'wp-header-members', 
'class' => 'toc wp-junk' )
+                                       array( 'id' => 'wp-header-members', 
'class' => 'wp-junk' )
                                );
                                $prependiture .= Html::element(
                                        'h2',
@@ -465,6 +465,10 @@
                                        }
                                        $sectionLinksHtml = '';
                                        foreach ( $sectionLinks as $link => 
$linkString ) {
+                                               $sectionLinksHtml .= 
Html::openElement(
+                                                       'span',
+                                                       [ 'class' => 
'mw-editsection' ]
+                                               );
                                                $sectionLinksHtml .= 
Html::element(
                                                        'span',
                                                        [ 'class' => 
'mw-editsection-bracket' ],
@@ -472,7 +476,7 @@
                                                );
                                                $sectionLinksHtml .= 
Html::rawElement(
                                                        'span',
-                                                       [ 'class' => 
'mw-editsection' ],
+                                                       [],
                                                        $linkString
                                                );
                                                $sectionLinksHtml .= 
Html::element(
@@ -480,6 +484,7 @@
                                                        [ 'class' => 
'mw-editsection-bracket' ],
                                                        ']'
                                                );
+                                               $sectionLinksHtml .= 
Html::closeElement( 'span' );
                                        }
 
                                        Html::rawElement(
@@ -575,6 +580,16 @@
 
                        if ( $rev->getContentModel() == 
'CollaborationHubContent' ) {
                                $ToCItems = array();
+
+                               // Add project mainpage to toc for subpages
+                               if ( $type != 'main' ) {
+
+                                       $display = Html::element( 'span', [], 
$sourceContent->getPageName() );
+                                       $display = $sourceContent->getImage( 
'puzzlepiece', 40 ) . $display;
+
+                                       
$ToCItems[$sourceContent->getPageName()] = Linker::Link( $title, $display );
+                               }
+
                                foreach ( $sourceContent->getContent() as $item 
) {
                                        $spTitle = Title::newFromText( 
$item['item'] );
                                        $spRev = Revision::newFromTitle( 
$spTitle );
@@ -614,14 +629,7 @@
                                        $ToCItems[$item] = Linker::Link( $link, 
$display );
                                }
                                $html .= Html::openElement( 'div', array( 
'class' => 'wp-toc' ) );
-                               if ( $type != 'main' ) {
-                                       // TODO Make this proper
-                                       $html .= Html::rawElement(
-                                               'h3',
-                                               array(),
-                                               Linker::Link( $title, 
$sourceContent->getPageName() )
-                                       );
-                               }
+
                                $html .= Html::openElement( 'ul' );
 
                                foreach ( $ToCItems as $item => $linkTitle ) {
@@ -736,7 +744,7 @@
 
        /**
         * Helper function for fillParserOutput to actually generate an image 
out of the icon value
-        * @param string $fallback for what to do for no icons
+        * @param string $fallback for what to do for no icons - nothing, 
random, specific icon...
         * @param int $size image size in px
         * @param string $seed fallback seed for non-chc pages called from 
another ch
         * @return string html|HORRIBLE GAPING VOID
@@ -748,12 +756,19 @@
                        if ( $icon == '' || $icon == '-' ) {
                                if ( $fallback == 'none' ) {
                                        return '';
-                               } else {
+                               } elseif ( $fallback == 'random' ) {
                                        return $this->makeIcon( 
$this->getPageName(), $size );
+                               } else {
+                                       // Maybe they want a specific one?
+                                       return $this->makeIcon( $fallback, 
$size );
                                }
                        }
                        if ( wfFindFile( $icon ) ) {
-                               return wfFindFile( $icon )->transform( array( 
'width' => $size ) )->toHtml();
+                               return Html::rawElement(
+                                       'div',
+                                       [ 'class' => 'file-image' ],
+                                       wfFindFile( $icon )->transform( array( 
'width' => $size ) )->toHtml()
+                               );
                        } else {
                                return $this->makeIcon( $icon, $size );
                        }
diff --git a/modules/ext.CollaborationKitMainHubViewFile.less 
b/modules/ext.CollaborationKitMainHubViewFile.less
index a5a850b..b0f254e 100644
--- a/modules/ext.CollaborationKitMainHubViewFile.less
+++ b/modules/ext.CollaborationKitMainHubViewFile.less
@@ -120,8 +120,40 @@
 
 // WTF THERE HAS TO BE A BETTER WAY TO DO THIS
 
+.wp-toc {
+       clear: both;
+       margin: 1em 0;
+
+       ul {
+               padding: 0;
+               margin: 0;
+               list-style: none;
+       }
+       li {
+               float: left;
+               margin: .5em 1.25em .5em 0;
+       }
+       div,
+       img {
+               display: block;
+               margin: auto;
+       }
+
+       .file-image {
+               height: 40px;
+               overflow: hidden;
+
+               img {
+                       vertical-align: middle;
+               }
+       }
+}
+
 // Mainpage hub layout
 .wp-mainpage {
+       border-top: solid 8px #7af;
+       padding-top: 1em;
+
        #wp-header-icon {
                float: left;
                padding: 0 2em 2em 0;
@@ -129,25 +161,33 @@
        #wp-header-members {
                float: right;
                margin: 0 0 2em 2em;
-       }
-       .wp-toc {
-               clear: both;
-               margin: 1em 0;
+               border: solid 1px #ddd;
+               background: #f9f9f9;
+               border-radius: 3px;
+               padding: 1.5em;
+               max-width: 25%;
 
-               ul {
+               h2 {
+                       margin: 0 0 .5em;
                        padding: 0;
-                       margin: 0;
-                       list-style: none;
-               }
-               li {
-                       float: left;
-                       margin: .5em 1.25em .5em 0;
-               }
-               div {
-                       margin: auto;
+                       border: none;
+                       font-size: 1.5em;
                }
        }
-       .wp-intro{
+       .wp-intro {
                font-size: 115%;
        }
+       #wp-members-buttons {
+               margin-top: 1em;
+       }
+       h2 {
+               border: solid 5px #7af;
+               border-style: solid none none;
+               padding: .5em 0 .25em;
+       }
+}
+
+// Subpage hub stuff
+.wp-subpage {
+
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/298048
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4042110574590e07312dadd55dceb0a61862ffa9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CollaborationKit
Gerrit-Branch: master
Gerrit-Owner: Isarra <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to