Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions BootstrapMediaWiki.skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
*
* @Version 1.0.0
* @Author Matthew Batchelder <[email protected]>
* @Author Creative Commons Corporation <[email protected]>
* @Copyright Matthew Batchelder 2012 - http://borkweb.com/
* @Copyright Creative Commons Corporation 2015 - https://github.com/creativecommons/bootstrap-mediawiki
* @License: GPLv2 (http://www.gnu.org/copyleft/gpl.html)
*/

Expand Down Expand Up @@ -64,7 +66,7 @@ class BootstrapMediaWikiTemplate extends QuickTemplate {
/**
* @var Cached skin object
*/
public $skin;
//public $skin;

/**
* Template filter callback for Bootstrap skin.
Expand All @@ -82,7 +84,7 @@ public function execute() {
global $wgNavBarClasses;
global $wgSubnavBarClasses;

$this->skin = $this->data['skin'];
//$this->skin = $this->data['skin'];
$action = $wgRequest->getText( 'action' );
$url_prefix = str_replace( '$1', '', $wgArticlePath );

Expand Down Expand Up @@ -125,8 +127,7 @@ public function execute() {
if ( $wgUser->isLoggedIn() ) {
if ( count( $this->data['personal_urls'] ) > 0 ) {
$user_icon = '<span class="user-icon"><img src="https://secure.gravatar.com/avatar/'.md5(strtolower( $wgUser->getEmail())).'.jpg?s=20&r=g"/></span>';
$name = strtolower( $wgUser->getName() );
$user_nav = $this->get_array_links( $this->data['personal_urls'], $user_icon . $name, 'user' );
$user_nav = $this->get_array_links( $this->data['personal_urls'], $user_icon . $wgUser->getName(), 'user' );
?>
<ul<?php $this->html('userlangattributes') ?> class="nav navbar-nav navbar-right">
<?php echo $user_nav; ?>
Expand All @@ -144,7 +145,7 @@ public function execute() {
?>
<ul class="nav navbar-nav navbar-right">
<li>
<?php echo Linker::linkKnown( SpecialPage::getTitleFor( 'Userlogin' ), wfMsg( 'login' ) ); ?>
<?php echo Linker::linkKnown( SpecialPage::getTitleFor( 'Userlogin' ), wfMessage( 'login' ), array(/*"title" => wfMessage( 'login' )*/), array("returnto" => trim($_GET['title']))); ?>
</li>
</ul>
<?php
Expand Down Expand Up @@ -241,12 +242,10 @@ public function execute() {
</div>
<div class="bottom">
<div class="container">
<?php $this->includePage('Bootstrap:Footer'); ?>
<footer>
<p>&copy; <?php echo date('Y'); ?> by <a href="<?php echo (isset($wgCopyrightLink) ? $wgCopyrightLink : 'http://borkweb.com'); ?>"><?php echo (isset($wgCopyright) ? $wgCopyright : 'BorkWeb'); ?></a>
&bull; Powered by <a href="http://mediawiki.org">MediaWiki</a>
</p>
</footer>
<footer>
<div class="row"><div class="col-md-6">This wiki is licensed to the public under a <a class="external" rel="nofollow" href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0</a> license.<br> Your use of this wiki is governed by the <a href="/CcWiki:Terms_of_Use">Terms of Use</a>.<br><a href="/wiki/CCWiki:Privacy_policy" title="CCWiki:Privacy policy">Privacy policy</a><br><a href="/wiki/CCWiki:About" title="CCWiki:About">About Creative Commons</a><br><a href="/wiki/CCWiki:General_disclaimer" title="CCWiki:General disclaimer">Disclaimers</a></div>
<div class="col-md-6"><?php echo $this->data['lastmod']; ?><br>Theme based on <a href="https://github.com/creativecommons/bootstrap-mediawiki">bootstrap-mediawiki</a> by BorkWeb.<br><br><a href="https://creativecommons.org/licenses/by/4.0/"><img src="https://licensebuttons.net/l/by/4.0/88x31.png" alt="Creative Commons Attribution 4.0" width="88" height="31"></a>&nbsp;<a href="//www.mediawiki.org/"><img src="/resources/assets/poweredby_mediawiki_88x31.png" alt="Powered by MediaWiki" srcset="/resources/assets/poweredby_mediawiki_132x47.png 1.5x, /resources/assets/poweredby_mediawiki_176x62.png 2x" width="88" height="31"></div></div>
</footer>
</div><!-- container -->
</div><!-- bottom -->

Expand Down
37 changes: 37 additions & 0 deletions NoUserLoginForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* Remove the standard user login form
*
* require_once($IP."/skins/bootstrap-mediawiki/NoUserLoginForm.php");
*
* @author Creative Commons Corporation
* @license GPLv2+
* @version 0.1
*/

if ( !defined( 'MEDIAWIKI' ) ) {
die( 'This file is a MediaWiki extension and not a valid entry point' );
}

$wgExtensionCredits['other'][] = array(
'name' => 'NoUserCreateForm',
'version' => '0.1',
'author' => 'Creative Commons Corporation',
'url' => 'https://github.com/creativecommons/bootstrap-mediawiki',
'description' => 'Removes the standard user creation form'
);

$wgHooks['UserLoginForm'][] = 'noUserLoginForm';

class NoUserLoginFormTemplate extends BaseTemplate {

function execute() {
// A link to log in/out would be confusing, text would require i18n
echo '<span style="font-size:24pt">&#10004;</span>';
}
}

function noUserLoginForm( &$template ) {
$template = new NoUserLoginFormTemplate();
return true ;
}
68 changes: 27 additions & 41 deletions js/behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $(function() {
$('#page-contents a').click(function(e){
e.preventDefault();
var $target = $(this).attr('href');
$(document).scrollTop( $($target).offset().top-100 );
$(document).scrollTop( $($target).offset().top-100 );
});

$( document ).on('change', '#subnav-select', function() {
Expand Down Expand Up @@ -53,53 +53,39 @@ $(function() {
});

$('.tip').tooltip();
$('[data-toggle="popover"]').popover();
//$('[data-toggle="popover"]').popover();

if ( $('.toc-sidebar').length > 0 ) {
if ( 0 === $('#toc').length ) {
$('.toc-sidebar').remove();
$('.wiki-body-section').removeClass('col-md-9').addClass('col-md-12');
} else {
$('.toc-sidebar').append('<h3>Contents</h3>');
$('#toc').each(function() {
$(this).find('ul:first').appendTo( '.toc-sidebar' );
$(this).remove();
});
$('.toc-sidebar').remove();
$('.wiki-body-section').removeClass('col-md-9').addClass('col-md-12');

$('.toc-sidebar').attr('id', 'toc');
}//end else
} else {
$('#toc').each(function() {
var $toc = $(this);
var $title = $toc.find('#toctitle');
var $links = $title.siblings('ul');
//$('.page-header').prepend('<ul class="nav nav-pills pull-right"></ul>');

$('.page-header').prepend('<ul class="nav nav-pills pull-right"><li class="dropdown" id="page-contents"><a class="dropdown-toggle" data-toggle="dropdown"><i class="icon-list"></i> Contents <span class="caret"></span></a> <ul class="dropdown-menu"></ul></li></ul>');
if( $('.page-header .nav').length === 0 ) {
$('.page-header').prepend('<ul class="nav nav-pills pull-right"></ul>');
}//end if

$('.page-header #page-contents').find('.dropdown-menu').html( $links.html() );
});
var $header = $('.page-header');
var $hero = $('.hero-unit');
var $edit = $('.navbar .content-actions .edit');
if( $edit.length > 0 ) {
if( $hero.length ) {
if( ! $hero.find('.nav-pills').length ) {
$hero.prepend('<ul class="nav nav-pills pull-right"></ul>');
}//end if

if( $('.page-header .nav').length === 0 ) {
$('.page-header').prepend('<ul class="nav nav-pills pull-right"></li></ul>');
}//end if

var $header = $('.page-header');
var $hero = $('.hero-unit');
var $edit = $('.navbar .content-actions .edit');
if( $edit.length > 0 ) {
if( $hero.length ) {
if( ! $hero.find('.nav-pills').length ) {
$hero.prepend('<ul class="nav nav-pills pull-right"></ul>');
}//end if

$edit.closest('li').clone().prependTo( $hero.find('.nav-pills') );
} else {
$edit.closest('li').clone().prependTo( $header.find('.nav-pills') );
}//end else
}//end if
$edit.closest('li').clone().prependTo( $hero.find('.nav-pills') );
} else {
$edit.closest('li').clone().prependTo( $header.find('.nav-pills') );
}//end else
}//end if
// }//end if

prettyPrint();

prettyPrint();
$('#toc').addClass('panel panel-default');
//$('#toc #toctitle').addClass('panel-heading');
$('#toc #toctitle h2').addClass('panel-title');
//$('#toc ul').addClass('panel-body');

$('#wiki-body .body a[title="Special:UserLogin"]').click();
$('.dropdown-toggle').dropdown();
Expand Down
60 changes: 12 additions & 48 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -174,51 +174,22 @@ option.unclickable {
height: auto !important;
}

#toc:not(.toc-sidebar) {
display: none;
float: right;
margin: 0 0 1em 1em;
}

#toc td {
background: #eee;
border: 1px solid #ddd;
border-radius: 0.5em;
display: block;
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
padding: 0 1em 1em 1em;

box-shadow: 0 0 5px 0 rgba( 0, 0, 0, 0.2 );
}

#toc.toc-sidebar td {
background: transparent;
border: none;
box-shadow: none;
display: table-cell;
padding: 0;
}

#toc.toc-sidebar li {
line-height: 20px;
list-style-type: none;
}

#toc.toc-sidebar li li {
margin-left: 20px;
#toc {
display: inline-block;
padding: 12px;
}

#toc.toc-sidebar h3 {
font-size: 1em;
@media (min-width: 481px) {
#toc {
min-width: 390px; /* Rough hack based on 480px */
}
}

.toc-sidebar .toctoggle {
display: none;
}

#toctitle h2 {
font-size: 16px;
#toc ul {
list-style-type: none;
list-style-image: none;
margin-left: 0;
padding: 0;
}

a.new {
Expand Down Expand Up @@ -475,11 +446,6 @@ pre.linenums ol {
@media (max-width: 979px) {
body { padding-top: 103px; }

.mw-headline {
margin-top: -103px;
padding-top: 103px;
}

.subnav #subnav-select {
margin-left: 20px;
display: inline-block;
Expand Down Expand Up @@ -511,9 +477,7 @@ pre.linenums ol {

/* responsive */
@media (max-width: 480px) {

#toc {
float: none;
width: 100%;
margin-left: 0;
}
Expand Down