Browse Source

Merge pull request #62 from ardiman/master

Make skin configurable
Jamie Thingelstad 11 years ago
parent
commit
d01708db31
3 changed files with 32 additions and 2 deletions
  1. 14 2
      Foreground.skin.php
  2. 14 0
      README.md
  3. 4 0
      assets/scripts/foreground.js

+ 14 - 2
Foreground.skin.php

@@ -6,6 +6,7 @@
  * @file
  * @file
  * @ingroup Skins
  * @ingroup Skins
  */
  */
+ 
 
 
 class Skinforeground extends SkinTemplate {
 class Skinforeground extends SkinTemplate {
 	public $skinname = 'foreground', $stylename = 'foreground', $template = 'foregroundTemplate', $useHeadElement = true;
 	public $skinname = 'foreground', $stylename = 'foreground', $template = 'foregroundTemplate', $useHeadElement = true;
@@ -30,8 +31,19 @@ class Skinforeground extends SkinTemplate {
 class foregroundTemplate extends BaseTemplate {
 class foregroundTemplate extends BaseTemplate {
 	public function execute() {
 	public function execute() {
 		global $wgUser;
 		global $wgUser;
+		global $wgForegroundFeatures;
 		wfSuppressWarnings();
 		wfSuppressWarnings();
 		$this->html('headelement');
 		$this->html('headelement');
+		$wgForegroundFeaturesDefaults = array(
+			'showActionsForAnon' => true,
+			'makeNavFixed' => false,
+		);
+		foreach ($wgForegroundFeaturesDefaults as $fgOption => $fgOptionValue) {
+			if ( !isset($wgForegroundFeatures[$fgOption]) ) {
+				$wgForegroundFeatures[$fgOption] = $fgOptionValue;
+			}
+		}
+		if ($wgForegroundFeatures['makeNavFixed']) echo "<div class='fixed'>";
 ?>
 ?>
 <!-- START FOREGROUNDTEMPLATE -->
 <!-- START FOREGROUNDTEMPLATE -->
 		<nav class="top-bar">
 		<nav class="top-bar">
@@ -103,7 +115,7 @@ class foregroundTemplate extends BaseTemplate {
 		       </ul>
 		       </ul>
 		     </section>
 		     </section>
 		</nav>
 		</nav>
-
+		<?php if ($wgForegroundFeatures['makeNavFixed']) echo "</div>"; ?>
 		<div class="row">
 		<div class="row">
 				<div class="large-12 columns">
 				<div class="large-12 columns">
 				<!--[if lt IE 9]>
 				<!--[if lt IE 9]>
@@ -119,7 +131,7 @@ class foregroundTemplate extends BaseTemplate {
 
 
 		<div class="row">
 		<div class="row">
 				<div id="p-cactions" class="large-12 columns">
 				<div id="p-cactions" class="large-12 columns">
-					<?php if ($wgUser->isLoggedIn()): ?>
+					<?php if ($wgUser->isLoggedIn() || $wgForegroundFeatures['showActionsForAnon']): ?>
 						<a href="#" data-dropdown="drop1" class="button dropdown small secondary radius"><i class="icon-cog"><span class="show-for-medium-up">&nbsp;<?php echo wfMessage( 'actions' )->text() ?></span></i></a>
 						<a href="#" data-dropdown="drop1" class="button dropdown small secondary radius"><i class="icon-cog"><span class="show-for-medium-up">&nbsp;<?php echo wfMessage( 'actions' )->text() ?></span></i></a>
 						<ul id="drop1" class="views large-12 columns f-dropdown">
 						<ul id="drop1" class="views large-12 columns f-dropdown">
 							<?php foreach( $this->data['content_actions'] as $key => $item ) { echo $this->makeListItem($key, $item); } ?>
 							<?php foreach( $this->data['content_actions'] as $key => $item ) { echo $this->makeListItem($key, $item); } ?>

+ 14 - 0
README.md

@@ -28,6 +28,20 @@ To activate Foreground for all users and anonymous visitors, you need to set the
 
 
     $wgDefaultSkin = "foreground";
     $wgDefaultSkin = "foreground";
 
 
+## Configuration
+
+Use following features in `LocalSettings.php` to change the behavior. 
+
+- `showActionsForAnon => true` displays page actions for non-logged-in visitors.
+- `makeNavFixed => true` menu will be fixed on top. 
+
+These are the default values:
+
+    $wgForegroundFeatures = array(
+      'showActionsForAnon' => true,
+      'makeNavFixed' => false,
+    );
+
 ### Notes on other skins
 ### Notes on other skins
 
 
 As you build a wiki out with Foreground you will likely use the responsive grid from Foundation. This is key to making a responsive wiki, and is one of the largest _migration_ requirements when you want to move a wiki that ppreviously used Vector (and likely a lot of tables for layout) to Foreground. Once you do this, the ability of a user to select whatever skin will be removed. If you take full advantage of Foreground in your templates the lack of the Foundation grid will make viewing the wiki using [Vector](http://wikiapiary.com/wiki/Skin:Vector) or [MonoBook](http://wikiapiary.com/wiki/Skin:MonoBook) very difficult.
 As you build a wiki out with Foreground you will likely use the responsive grid from Foundation. This is key to making a responsive wiki, and is one of the largest _migration_ requirements when you want to move a wiki that ppreviously used Vector (and likely a lot of tables for layout) to Foreground. Once you do this, the ability of a user to select whatever skin will be removed. If you take full advantage of Foreground in your templates the lack of the Foundation grid will make viewing the wiki using [Vector](http://wikiapiary.com/wiki/Skin:Vector) or [MonoBook](http://wikiapiary.com/wiki/Skin:MonoBook) very difficult.

+ 4 - 0
assets/scripts/foreground.js

@@ -22,6 +22,10 @@ jQuery(document).ready(function() {
   jQuery('li#ca-unwatch a').addClass('icon-star').text(' ' + jQuery('li#ca-unwatch a').text());
   jQuery('li#ca-unwatch a').addClass('icon-star').text(' ' + jQuery('li#ca-unwatch a').text());
   jQuery('li#ca-purge a').addClass('icon-refresh').text(' ' + jQuery('li#ca-purge a').text());
   jQuery('li#ca-purge a').addClass('icon-refresh').text(' ' + jQuery('li#ca-purge a').text());
   jQuery('li#t-smwbrowselink a').addClass('icon-eye-open').text(' ' + jQuery('li#t-smwbrowselink a').text());
   jQuery('li#t-smwbrowselink a').addClass('icon-eye-open').text(' ' + jQuery('li#t-smwbrowselink a').text());
+  jQuery('li#ca-ask_delete_permanently a').addClass('icon-cut').text(' ' + jQuery('li#ca-ask_delete_permanently a').text());
+  if ( jQuery( '#ca-addsection' ).length ) {
+        jQuery('li#ca-addsection a').addClass('icon-plus-sign').text(' ' + jQuery('li#ca-addsection a').attr('title').replace(/\[.+/g,""));
+  }
 
 
 
 
   // Turn categories into labels
   // Turn categories into labels