Skip to content

Commit

Permalink
Forked project. Tweaked styles. Made it compatible with NSM Bootstrap.
Browse files Browse the repository at this point in the history
  • Loading branch information
siffring committed Nov 20, 2012
1 parent abe1cc9 commit 8f21702
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 27 deletions.
22 changes: 5 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
Display which environment you are on **at all times** in the CP so you don't accidentally do something bad on the production environment. In your config.php, set an ENV variable like so:
This is a fork from https://github.com/davist11/Environment-EE-Addon

<pre>if(!defined('ENV')) {
switch ($_SERVER['SERVER_NAME']) {
case 'site.com':
define('ENV', 'prod');
break;

case 'stage.site.com':
define('ENV', 'staging');
break;

default:
define('ENV', 'local');
break;
}
}</pre>
We modified it to pull the NSM_ENV variable from Config Bootstrap.

The value of ENV will be injected into the header of the CP and fixed to the screen as you scroll.
Display which environment you are on **at all times** in the CP so you don't accidentally do something bad on the production environment.

The value of NSM_ENV will be injected into the header of the CP and fixed to the screen as you scroll.

*Note: only shown to Super Admins.*
26 changes: 16 additions & 10 deletions third_party/environment/acc.environment.php → sh_environment/acc.sh_environment.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
* @package ExpressionEngine
* @subpackage Addons
* @category Accessory
* @author Trevor Davis
* @link http://trevordavis.net
* @author Jason Siffring
* @link http://surprisehighway.com
*/

class Environment_acc {
class Sh_environment_acc {

public $name = 'Environment';
public $id = 'environment';
public $name = 'SH Environment';
public $id = 'sh_environment';
public $version = '1.0';
public $description = 'Display which environment you are on at all times in the CP.';
public $description = 'Display which environment you are on at all times in the CP. Fork from https://github.com/davist11/Environment-EE-Addon';
public $sections = array();

/**
Expand All @@ -40,13 +40,13 @@ public function set_sections()
$EE =& get_instance();
$js = '';

if ($EE->session->userdata('group_id') == 1 && defined('ENV')) {
if ($EE->session->userdata('group_id') == 1 && defined('NSM_ENV')) {
$js = 'var $body = $("body");
var $siteName = $("#navigationTabs").find(".msm_sites");
var siteNameOffset = $siteName.offset();
var rightPos = $body.width() - siteNameOffset.left + 20;
$body.append("<div class=\"environment-label\" style=\"right: " + rightPos + "px;\">' . ENV . '</div>");';
$body.append("<div class=\"environment-label\" style=\"right: " + rightPos + "px;\">' . NSM_ENV . ' <small>environment</small></div>");';

$css = '<style type="text/css" media="screen">
.environment-label {
Expand All @@ -57,14 +57,20 @@ public function set_sections()
-moz-border-radius-bottomright: 3px;
-webkit-border-bottom-right-radius: 3px;
border-bottom-right-radius: 3px;
color: #fff;
color: #8F9A9C;
font-size: 150%;
padding: 20px 20px 10px;
padding: 12px 20px 6px;
position: fixed;
text-transform: uppercase;
text-align: center;
top: 0;
z-index: 100;
}
.environment-label small {
display: block;
font-size: 10px;
text-transform: uppercase;
}
</style>';

$EE->cp->add_to_head($css);
Expand Down

0 comments on commit 8f21702

Please sign in to comment.