Werdna has submitted this change and it was merged.
Change subject: Remove dependency on Bootstrap
......................................................................
Remove dependency on Bootstrap
Bug: T91610
Change-Id: I85ff69eef145496dd1e07e300cc36a5dc1450302
---
M LivingStyleGuide.php
D bower.json
M resources/master.less
M resources/menu.js
M src/SkinLivingStyleGuide.php
M templates/Skin.php
M templates/Skin.template
M templates/sidebar.template
8 files changed, 105 insertions(+), 124 deletions(-)
Approvals:
Werdna: Verified; Looks good to me, approved
diff --git a/LivingStyleGuide.php b/LivingStyleGuide.php
index 4ea16d0..7f70eb7 100644
--- a/LivingStyleGuide.php
+++ b/LivingStyleGuide.php
@@ -48,20 +48,12 @@
);
$wgResourceModules += array(
- 'ext.bootstrap' => array(
- 'localBasePath' => __DIR__ . "/bower_components/bootstrap/dist",
- 'remoteSkinPath' =>
'LivingStyleGuide/bower_components/bootstrap/dist',
- 'group' => 'skin.livingstyleguide',
- 'scripts' => 'js/bootstrap.min.js',
- 'styles' => 'css/bootstrap.min.css',
- ),
'skin.styleguide.styles' => array(
'styles' => 'master.less',
'position' => 'top',
) + $styleguideSkinResourceTemplate,
'skin.styleguide' => array(
'scripts' => 'menu.js',
- 'dependencies' => 'ext.bootstrap'
) + $styleguideSkinResourceTemplate,
);
diff --git a/bower.json b/bower.json
deleted file mode 100644
index 9bcfd56..0000000
--- a/bower.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "name": "LightNCandySkin",
- "version": "0.0.0",
- "authors": [
- "Andrew Garrett <[email protected]>"
- ],
- "description": "Demonstration of creating a skin using LightNCandy
templates.",
- "main": "LightNCandySkin.php",
- "license": "MIT",
- "private": true,
- "ignore": [
- "**/.*",
- "node_modules",
- "bower_components",
- "test",
- "tests"
- ],
- "dependencies": {
- "bootstrap": "~3.3.1"
- }
-}
diff --git a/resources/master.less b/resources/master.less
index c3bec48..5170f4c 100644
--- a/resources/master.less
+++ b/resources/master.less
@@ -1,11 +1,27 @@
/* Typography */
+html, body {
+ height: 100%;
+ margin: 0;
+ padding: 0;
+}
+
+
body {
color: #333;
-
- .container {
- font-size: 16px;
- }
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
+ font-size: 1em;
}
+
+a {
+ color: #2B5ECF;
+}
+
+.container {
+ width: 1140px;
+ margin: 0 auto;
+ margin-top: 50px;
+}
+
h1 {
font: 3em 'Georgia', 'Times', serif;
@@ -53,10 +69,6 @@
background: #f9f9f9;
}
/* Typography */
-
-html, body {
- height: 100%;
-}
/* Offscreen Navigation */
#site-wrap {
@@ -120,6 +132,10 @@
height: 50px;
transition: left 0.2s;
+ a {
+ text-decoration: none;
+ }
+
.search-input {
background: transparent;
border: none;
@@ -130,6 +146,8 @@
background-position: center left;
background-repeat: no-repeat;
padding-left: 30px;
+ height: 30px;
+ font: 0.8em 'Helvetica Neue', Helvetica, Arial, sans-serif;
&:focus {
background-image: url( 'search_active.svg' );
@@ -140,25 +158,39 @@
}
}
- .navbar-header {
+ form {
+ display: inline-block;
+ height: 100%;
+ margin: 0;
+ padding: 0;
+ }
+
+ ul {
+ display: inline-block;
+ float: right;
+
+ li {
+ margin-right: 30px;
+ display: inline-block;
+ }
+ }
+
+ a.navbar-brand {
background: #f9f9f9;
background-image: url( 'menu.svg' );
background-position: center left -10px;
background-repeat: no-repeat;
-
- a {
- color: #333;
- text-transform: uppercase;
- font-weight: bold;
- }
+ display: inline-block;
+ height: 100%;
+ line-height: 50px;
+ padding: 0 20px;
+ color: #333;
+ text-transform: uppercase;
+ font-weight: bold;
}
}
/* Navbar */
-.container {
- // Don't hide under the navbar.
- margin-top: 50px;
-}
/* MediaWiki Stuff */
@media screen {
diff --git a/resources/menu.js b/resources/menu.js
index 6ff8c82..316af0a 100644
--- a/resources/menu.js
+++ b/resources/menu.js
@@ -1,5 +1,5 @@
$( function () {
- $( '.navbar-header' ).click( function ( e ) {
+ $( '.navbar-brand' ).click( function ( e ) {
e.preventDefault();
$( '#site-wrap' ).toggleClass( 'site-shift' );
} );
diff --git a/src/SkinLivingStyleGuide.php b/src/SkinLivingStyleGuide.php
index 03c0ed7..6fc5a3d 100755
--- a/src/SkinLivingStyleGuide.php
+++ b/src/SkinLivingStyleGuide.php
@@ -12,6 +12,6 @@
public function setupSkinUserCss( OutputPage $out ) {
parent::setupSkinUserCss( $out );
- $out->addModuleStyles( array( 'skin.styleguide.styles',
'ext.bootstrap' ) );
+ $out->addModuleStyles( array( 'skin.styleguide.styles' ) );
}
}
diff --git a/templates/Skin.php b/templates/Skin.php
index bafa36d..09c18fb 100644
--- a/templates/Skin.php
+++ b/templates/Skin.php
@@ -3,10 +3,11 @@
'flags' => array(
'jstrue' => false,
'jsobj' => false,
- 'spvar' => true,
+ 'spvar' => false,
'prop' => false,
'method' => false,
'mustlok' => true,
+ 'mustsec' => true,
'echo' => false,
'debug' => $debugopt,
),
@@ -27,7 +28,7 @@
'blockhelpers' => array(),
'hbhelpers' => array(),
'partials' => array(),
- 'scopes' => array(),
+ 'scopes' => array($in),
'sp_vars' => array('root' => $in),
'funcs' => array(
'v' => function ($cx, $base, $path) {
@@ -59,14 +60,10 @@
return $v;
}
$count--;
- switch ($count) {
- case -1:
- $base = $cx['sp_vars']['root'];
- break;
- case -2;
- return null;
- default:
- $base = $cx['scopes'][$count];
+ if ($count >= 0) {
+ $base = $cx['scopes'][$count];
+ } else {
+ return null;
}
}
},
@@ -79,10 +76,7 @@
$isObj = false;
if ($isAry && $else !== null && count($v) === 0) {
- $cx['scopes'][] = $in;
- $ret = $else($cx, $in);
- array_pop($cx['scopes']);
- return $ret;
+ return $else($cx, $in);
}
// #var, detect input type is object or not
@@ -146,9 +140,13 @@
return '';
}
if ($isAry) {
- $cx['scopes'][] = $in;
+ if ($cx['flags']['mustsec']) {
+ $cx['scopes'][] = $v;
+ }
$ret = $cb($cx, $v);
- array_pop($cx['scopes']);
+ if ($cx['flags']['mustsec']) {
+ array_pop($cx['scopes']);
+ }
return $ret;
}
@@ -161,16 +159,13 @@
}
if ($else !== null) {
- $cx['scopes'][] = $in;
- $ret = $else($cx, $in);
- array_pop($cx['scopes']);
- return $ret;
+ return $else($cx, $in);
}
return '';
},
'ifvar' => function ($cx, $v) {
- return !is_null($v) && ($v !== false) && ($v !== 0) && ($v !== 0.0) &&
($v !== '') && (is_array($v) ? (count($v) > 0) : true);
+ return !is_null($v) && ($v !== false) && ($v !== 0) && ($v !== '') &&
(is_array($v) ? (count($v) > 0) : true);
},
'ch' => function ($cx, $ch, $vars, $op) {
return $cx['funcs']['chret'](call_user_func_array($cx['helpers'][$ch],
$vars), $op);
@@ -217,29 +212,22 @@
<div id="site-wrap">
<nav class="navbar">
- <div class="navbar-header">
- <a class="navbar-brand"
href="javascript:void(0)">'.htmlentities((string)$cx['funcs']['v']($cx, $in,
array('sitename')), ENT_QUOTES, 'UTF-8').'</a>
- </div>
+ <a class="navbar-brand"
href="javascript:void(0)">'.htmlentities((string)$cx['funcs']['v']($cx, $in,
array('sitename')), ENT_QUOTES, 'UTF-8').'</a>
- <div class="collapse navbar-collapse" id="topmenu">
- <form class="navbar-form navbar-left"
action="'.$cx['funcs']['v']($cx, $in, array('scriptpath')).'" role="search">
- <div class="form-group">
- <input
- type="text"
- id="searchInput"
- class="form-control
search-input"
- placeholder="Search"
- name="search"
- >
- <input type="hidden"
name="title" value="Special:Search">
- </div>
- </form>
+ <form class="navbar-form navbar-left"
action="'.$cx['funcs']['v']($cx, $in, array('scriptpath')).'" role="search">
+ <input
+ type="text"
+ id="searchInput"
+ class="form-control search-input"
+ placeholder="Search"
+ name="search"
+ >
+ </form>
- <ul class="nav navbar-nav navbar-right">
- <li><a href="#">Desktop</a></li>
- <li><a href="#">Mobile</a></li>
- </ul>
- </div>
+ <ul class="nav navbar-nav navbar-right">
+ <li><a href="#">Desktop</a></li>
+ <li><a href="#">Mobile</a></li>
+ </ul>
</nav>
<div class="container" id="content">
diff --git a/templates/Skin.template b/templates/Skin.template
index 5ea337c..3a13c54 100755
--- a/templates/Skin.template
+++ b/templates/Skin.template
@@ -6,29 +6,23 @@
<div id="site-wrap">
<nav class="navbar">
- <div class="navbar-header">
- <a class="navbar-brand"
href="javascript:void(0)">{{sitename}}</a>
- </div>
+ <a class="navbar-brand"
href="javascript:void(0)">{{sitename}}</a>
- <div class="collapse navbar-collapse" id="topmenu">
- <form class="navbar-form navbar-left"
action="{{{scriptpath}}}" role="search">
- <div class="form-group">
- <input
- type="text"
- id="searchInput"
- class="form-control
search-input"
- placeholder="Search"
- name="search"
- >
- <input type="hidden"
name="title" value="Special:Search">
- </div>
- </form>
+ <form class="navbar-form navbar-left"
action="{{{scriptpath}}}" role="search">
+ <input
+ type="text"
+ id="searchInput"
+ class="form-control search-input"
+ placeholder="Search"
+ name="search"
+ >
+ <input type="hidden" name="title"
value="Special:Search">
+ </form>
- <ul class="nav navbar-nav navbar-right">
- <li><a href="#">Desktop</a></li>
- <li><a href="#">Mobile</a></li>
- </ul>
- </div>
+ <ul class="nav navbar-nav navbar-right">
+ <li><a href="#">Desktop</a></li>
+ <li><a href="#">Mobile</a></li>
+ </ul>
</nav>
<div class="container" id="content">
diff --git a/templates/sidebar.template b/templates/sidebar.template
index 8be93f0..c62874d 100644
--- a/templates/sidebar.template
+++ b/templates/sidebar.template
@@ -1,14 +1,10 @@
-<div class="dropdown">
- <button class="btn btn-default dropdown-toggle" type="button"
id="account" data-toggle="dropdown" aria-expanded="true">
- <span class="glyphicon glyphicon-user"></span>
- <span class="caret"></span>
- </button>
- <ul class="dropdown-menu" role="menu" aria-labelledby="account">
- {{#each personal_urls}}
- <li><a href="{{href}}"
class="{{class}}">{{text}}</a></li>
- {{/each}}
- </ul>
-</div>
+<h2 id="account-header">Account</h2>
+<ul role="menu" aria-labelledby="account">
+ {{#each personal_urls}}
+ <li><a href="{{href}}" class="{{class}}">{{text}}</a></li>
+ {{/each}}
+</ul>
+
<h2 id="navigation-header">Navigation</h2>
<ul aria-labelledby="navigation-header">
{{#each sidebar.navigation}}
--
To view, visit https://gerrit.wikimedia.org/r/195511
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I85ff69eef145496dd1e07e300cc36a5dc1450302
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/skins/LivingStyleGuide
Gerrit-Branch: master
Gerrit-Owner: Prtksxna <[email protected]>
Gerrit-Reviewer: Prtksxna <[email protected]>
Gerrit-Reviewer: Werdna <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits