Skip to content

Commit

Permalink
Add option to specify the name of Backstage to appear on the top left…
Browse files Browse the repository at this point in the history
… hand corner of the global nav menu.
  • Loading branch information
kahwee committed Mar 5, 2012
1 parent 7b667b8 commit 3a44048
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -37,6 +37,7 @@ return array(
'backstage' => array( 'backstage' => array(
'class' => 'application.modules.backstage.BackstageModule', 'class' => 'application.modules.backstage.BackstageModule',
#'autoloadModels' => false, #'autoloadModels' => false,
'name' => 'Backstage',
'models' => array( 'models' => array(
'Tag' => array( 'Tag' => array(
'id' => array( 'id' => array(
Expand Down Expand Up @@ -66,4 +67,4 @@ return array(
Issues? Issues?
------- -------


If you have any issues, please highlight them in [Backstage's GitHub issues](https://github.com/kahwee/backstage/issues). If you have any issues, please highlight them in [Backstage's GitHub issues](https://github.com/kahwee/backstage/issues).
1 change: 1 addition & 0 deletions protected/config/main.php
Expand Up @@ -29,6 +29,7 @@
'backstage' => array( 'backstage' => array(
'class' => 'application.modules.backstage.BackstageModule', 'class' => 'application.modules.backstage.BackstageModule',
#'autoloadModels' => false, #'autoloadModels' => false,
'name' => 'Backstage 2',
'models' => array( 'models' => array(
'Tag' => array( 'Tag' => array(
'id' => array( 'id' => array(
Expand Down
5 changes: 5 additions & 0 deletions protected/modules/backstage/BackstageModule.php
Expand Up @@ -3,6 +3,7 @@
class BackstageModule extends CWebModule { class BackstageModule extends CWebModule {


public $models = array(); public $models = array();
public $name = null;


/** /**
* @var models that are present in the ./protected/models directory * @var models that are present in the ./protected/models directory
Expand All @@ -17,6 +18,10 @@ public function init() {
'application.models.*', 'application.models.*',
'backstage.components.*', 'backstage.components.*',
)); ));
#Set the name of Backstage, defaults the name of the Yii application.
if (is_null($this->name)) {
$this->name = Yii::app()->name;
}
#Init models. #Init models.
$this->buildModelsOptions(); $this->buildModelsOptions();
try { try {
Expand Down
2 changes: 1 addition & 1 deletion protected/modules/backstage/views/layouts/backstage.php
Expand Up @@ -19,7 +19,7 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="nav-collapse row-fluid"> <div class="nav-collapse row-fluid">
<div class="span2" style='position:fixed'> <div class="span2" style='position:fixed'>
<?php echo CHtml::link(Yii::app()->name, array('default/index'), array('class' => 'brand')); ?> <?php echo CHtml::link($this->module->name, array('default/index'), array('class' => 'brand')); ?>
</div><!-- span2 --> </div><!-- span2 -->
<div class='span10' style='padding-left: 14.89361702%; margin-left:-14px'> <div class='span10' style='padding-left: 14.89361702%; margin-left:-14px'>
<?php <?php
Expand Down

0 comments on commit 3a44048

Please sign in to comment.