Bartosz Dziewoński has uploaded a new change for review.

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

Change subject: PHP demo: Add Vector/Raster and MediaWiki/Apex controls
......................................................................

PHP demo: Add Vector/Raster and MediaWiki/Apex controls

Change-Id: Ic3f0027ed87de12622ba6400ff73ef6db5400d1f
---
M demos/widgets.php
1 file changed, 40 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/45/189345/1

diff --git a/demos/widgets.php b/demos/widgets.php
index 4024f20..e353148 100644
--- a/demos/widgets.php
+++ b/demos/widgets.php
@@ -6,18 +6,29 @@
        }
        require_once $autoload;
 
-       OOUI\Theme::setSingleton( new OOUI\MediaWikiTheme() );
+       $theme = ( isset( $_GET['theme'] ) && $_GET['theme'] === 'apex' ) ? 
'apex' : 'mediawiki';
+       $themeClass = 'OOUI\\' . ( $theme === 'apex' ? 'Apex' : 'MediaWiki' ) . 
'Theme';
+       OOUI\Theme::setSingleton( new $themeClass() );
 
-       $direction = ( isset( $_GET['dir'] ) && $_GET['dir'] === 'rtl' ) ? 
'rtl' : 'ltr';
+       $graphic = ( isset( $_GET['graphic'] ) && $_GET['graphic'] === 'raster' 
) ? 'raster' : 'vector';
+       $graphicSuffix = $graphic === 'vector' ? '.svg' : '';
+
+       $direction = ( isset( $_GET['direction'] ) && $_GET['direction'] === 
'rtl' ) ? 'rtl' : 'ltr';
        $directionSuffix = $direction === 'rtl' ? '.rtl' : '';
        OOUI\Element::setDefaultDir( $direction );
+
+       $query = array(
+               'theme' => $theme,
+               'graphic' => $graphic,
+               'direction' => $direction,
+       )
 ?>
 <!DOCTYPE html>
 <html lang="en" dir="ltr">
 <head>
        <meta charset="UTF-8">
        <title>OOjs UI Widget Demo</title>
-       <link rel="stylesheet" href="../dist/oojs-ui-mediawiki.svg<?php echo 
$directionSuffix; ?>.css">
+       <link rel="stylesheet" href="../dist/oojs-ui-<?php echo $theme . 
$graphicSuffix . $directionSuffix; ?>.css">
        <link rel="stylesheet" href="styles/demo<?php echo $directionSuffix; 
?>.css">
 </head>
 <body class="oo-ui-<?php echo $direction; ?>">
@@ -27,12 +38,36 @@
                                echo new OOUI\ButtonGroupWidget( array(
                                        'items' => array(
                                                new OOUI\ButtonWidget( array(
+                                                       'label' => 'MediaWiki',
+                                                       'href' => '?' . 
http_build_query( array_merge( $query, array( 'theme' => 'mediawiki' ) ) ),
+                                               ) ),
+                                               new OOUI\ButtonWidget( array(
+                                                       'label' => 'Apex',
+                                                       'href' => '?' . 
http_build_query( array_merge( $query, array( 'theme' => 'apex' ) ) ),
+                                               ) ),
+                                       )
+                               ) );
+                               echo new OOUI\ButtonGroupWidget( array(
+                                       'items' => array(
+                                               new OOUI\ButtonWidget( array(
+                                                       'label' => 'Vector',
+                                                       'href' => '?' . 
http_build_query( array_merge( $query, array( 'graphic' => 'vector' ) ) ),
+                                               ) ),
+                                               new OOUI\ButtonWidget( array(
+                                                       'label' => 'Raster',
+                                                       'href' => '?' . 
http_build_query( array_merge( $query, array( 'graphic' => 'raster' ) ) ),
+                                               ) ),
+                                       )
+                               ) );
+                               echo new OOUI\ButtonGroupWidget( array(
+                                       'items' => array(
+                                               new OOUI\ButtonWidget( array(
                                                        'label' => 'LTR',
-                                                       'href' => '?dir=ltr',
+                                                       'href' => '?' . 
http_build_query( array_merge( $query, array( 'direction' => 'ltr' ) ) ),
                                                ) ),
                                                new OOUI\ButtonWidget( array(
                                                        'label' => 'RTL',
-                                                       'href' => '?dir=rtl',
+                                                       'href' => '?' . 
http_build_query( array_merge( $query, array( 'direction' => 'rtl' ) ) ),
                                                ) ),
                                        )
                                ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic3f0027ed87de12622ba6400ff73ef6db5400d1f
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>

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

Reply via email to