1. NordLabs
  2. NordCms

Commits

Christoffer Niska  committed 6a75e5a

Fixed a bug when rendering inline-nodes and improved the Bootstrap theme.

  • Participants
  • Parent commits 053527c
  • Branches default

Comments (0)

Files changed (12)

File assets/css/cms.css

View file
  • Ignore whitespace
 
 .cms .update-link {
 	margin: 10px 0;
+	padding: 3px 5px;
 }
 
 .cms .markItUp {

File components/Cms.php

View file
  • Ignore whitespace
 	public function createUrl($name, $params=array())
 	{
 		$node = $this->loadNode($name);
-
-		if ($node === null)
-		{
-			$this->createNode($name);
-			$node = $this->loadNode($name);
-		}
-
 		return $node->getUrl($params);
 	}
 
 	 */
 	public function loadNode($name)
 	{
-		return CmsNode::model()->findByAttributes(array('name'=>$name));
+		$node = CmsNode::model()->findByAttributes(array('name'=>$name));
+
+		if (!$node instanceof CmsNode)
+		{
+			$this->createNode($name);
+			$node = $this->loadNode($name);
+		}
+
+		return $node;
 	}
 
 	/**

File components/CmsBaseRenderer.php

View file
  • Ignore whitespace
 		{
 			/** @var CmsNode $node */
 			$node = Yii::app()->cms->loadNode($name);
-			if ($node instanceof CmsNode)
-				$nodes[$index] = $node->renderWidget();
+			$nodes[$index] = $node instanceof CmsNode ? $node->renderWidget() : '';
 		}
 
 		if (!empty($nodes))
 
 				/** @var CmsNode $node */
 				$node = $cms->loadNode($target);
-				if (!$node instanceof CmsNode)
-				{
-					$cms->createNode($target);
-					$node = $cms->loadNode($target);
-				}
-
-				$target = $node->getUrl();
+				$target = $node instanceof CmsNode ? $node->getUrl() : '#';
 			}
 
 			$text = $matches[3][$index];

File themes/bootstrap/views/CmsBlock/block.php

View file
  • Ignore whitespace
 	<div class="node-content"><?php echo $content ?></div>
 
 	<?php if (Yii::app()->cms->checkAccess()): ?>
-		<?php echo CHtml::link(Yii::t('CmsModule.core', 'Update'),
-				array('/cms/node/update', 'id'=>$model->id), array('class'=>'btn small update-link')) ?>
+		<?php echo CHtml::link('<i class="icon-pencil"></i>',
+				array('/cms/node/update', 'id'=>$model->id), array('class'=>'btn small update-link', 'title'=>Yii::t('CmsModule.core', 'Update'))) ?>
 	<?php endif ?>
 
 </div>

File themes/bootstrap/views/cms/layouts/cms-column1.php

View file
  • Ignore whitespace
 
 	<div class="row">
 
-		<div class="span16">
+		<div class="span12">
 
 			<div class="cms-content">
 

File themes/bootstrap/views/cms/layouts/cms-column2.php

View file
  • Ignore whitespace
 
 	<div class="row">
 
-		<div class="span12">
+		<div class="span9">
 
 			<div class="cms-content">
 
 
 		</div>
 
-		<div class="span4">
+		<div class="span3">
 
 			<div class="cms-sidebar">
 
 				
 				<?php echo CmsNode::model()->renderTree() ?>
 
-				<p><?php echo CHtml::link(Yii::t('CmsModule.core','Create a new node'),array('node/create'),array('class'=>'btn small')) ?></p>
+				<p><?php echo CHtml::link(Yii::t('CmsModule.core','Create a new node'),array('node/create'),array('class'=>'btn btn-small')) ?></p>
 
 			</div>
 

File themes/bootstrap/views/cms/node/_form.php

View file
  • Ignore whitespace
 		</div>
     </div>
 
-	<?php echo $form->textAreaRow($model,'['.$model->locale.']css',array('class'=>'span11','rows'=>6)) ?>
+	<?php echo $form->textAreaRow($model,'['.$model->locale.']css',array('class'=>'span8','rows'=>6)) ?>
 
 </fieldset>
 
 				'sortable'=>false,
 			),
             array(
-                'class'=>'CButtonColumn',
+                'class'=>'bootstrap.widgets.BootButtonColumn',
                 'template'=>'{delete}',
                 'buttons'=>array(
                     'delete'=>array(

File themes/bootstrap/views/cms/node/create.php

View file
  • Ignore whitespace
 
 	<?php $form = $this->beginWidget('BootActiveForm',array(
 		'id'=>'cmsCreateNodeForm',
-		'stacked'=>true,
 		'htmlOptions'=>array('enctype'=>'multipart/form-data'),
 	)) ?>
 
 
 		</fieldset>
 
-		<div class="actions">
-			<?php echo CHtml::submitButton(Yii::t('CmsModule.core','Create'),array('class'=>'btn primary')) ?>
+		<div class="form-actions">
+			<?php echo CHtml::submitButton(Yii::t('CmsModule.core','Create'),array('class'=>'btn btn-primary')) ?>
 		</div>
 
 	<?php $this->endWidget() ?>

File themes/bootstrap/views/cms/node/update.php

View file
  • Ignore whitespace
 	<?php $form = $this->beginWidget('BootActiveForm',array(
 		'id'=>'cmsUpdateNodeForm',
 		//'enableAjaxValidation'=>true,
-		'stacked'=>true,
 		'htmlOptions'=>array('enctype'=>'multipart/form-data'),
 	)) ?>
 
 			'tabs'=>$tabs,
 		)); ?>
 
-		<div class="actions row">
+		<div class="form-actions row">
 			<div class="pull-left">
-				<?php echo CHtml::submitButton(Yii::t('CmsModule.core','Save'),array('class'=>'btn primary')) ?>
+				<?php echo CHtml::submitButton(Yii::t('CmsModule.core','Save'),array('class'=>'btn btn-primary')) ?>
 			</div>
 			<div class="pull-right">
 				<?php echo CHtml::link(Yii::t('CmsModule.core','Delete'),array('delete','id'=>$model->id),array(

File views/node/index.php

View file
  • Ignore whitespace
 				'value'=>'$data->parent !== null ? $data->parent->name : ""',
 			),
 			array(
-				'class'=>'CButtonColumn',
+				'class'=>'BootButtonColumn',
 				'viewButtonUrl'=>'Yii::app()->cms->createUrl($data->name)',
 			),
 		),

File views/node/page.php

View file
  • Ignore whitespace
 
 		<?php if (Yii::app()->cms->checkAccess()): ?>
 			<?php echo CHtml::link(Yii::t('CmsModule.core', 'Update'),
-					array('node/update', 'id'=>$model->id), array('class'=>'btn small update-link')) ?>
+					array('node/update', 'id'=>$model->id), array('class'=>'btn btn-small update-link')) ?>
 		<?php endif ?>
 
 	</div>

File widgets/views/block.php

View file
  • Ignore whitespace
 
 	<?php if (Yii::app()->cms->checkAccess()): ?>
 		<?php echo CHtml::link(Yii::t('CmsModule.core', 'Update'),
-				array('/cms/node/update', 'id'=>$model->id), array('class'=>'update-link')) ?>
+				array('/cms/node/update', 'id'=>$model->id), array('class'=>'btn btn-small update-link')) ?>
 	<?php endif ?>
 
 </div>