1
0
www.mikescher.com/www/protected/views/log/_form.php

57 lines
1.9 KiB
PHP
Raw Permalink Normal View History

2014-06-06 19:31:05 +02:00
<?php
/* @var $this LogController */
/* @var $model Log */
/* @var $form TbActiveForm */
?>
<div class="form">
<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(
'id'=>'log-form',
// Please note: When you enable ajax validation, make sure the corresponding
// controller action is handling ajax validation correctly.
// There is a call to performAjaxValidation() commented in generated controller code.
// See class documentation of CActiveForm for details on this.
'enableAjaxValidation'=>false,
)); ?>
<p class="help-block">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($model); ?>
<?php
if ($model->isNewRecord)
echo $form->textFieldControlGroup($model,'date',array('span'=>5, 'value' => date('Y-m-d')));
else
echo $form->textFieldControlGroup($model,'date',array('span'=>5, ));
?>
2014-06-06 19:31:05 +02:00
<?php echo $form->textAreaControlGroup($model,'title',array('rows'=>6,'span'=>8)); ?>
<?php echo $form->textAreaControlGroup($model,'content',array('rows'=>6,'span'=>8)); ?>
<?php echo MsHtml::ajaxButton ("Preview", CController::createUrl('log/ajaxMarkdownPreview'),
[
'type'=>'POST',
'data' => ['content'=> 'js: $("#Log_content").val()'],
'update' => '#markdownAjaxContent',
2014-07-11 19:29:19 +02:00
'error'=>'function(msg){alert("An error has happened" + JSON.stringify(msg));}',
2014-06-06 19:31:05 +02:00
]); ?>
<br>
<br>
<div class="well markdownOwner" id="markdownAjaxContent">
<?php $this->renderPartial('_ajaxMarkdownPreview', ['content' => $model->content, ], false, true); ?>
</div>
<div class="form-actions">
<?php echo MsHtml::submitButton($model->isNewRecord ? 'Create' : 'Save',array(
'color'=>MsHtml::BUTTON_COLOR_PRIMARY,
'size'=>MsHtml::BUTTON_SIZE_LARGE,
)); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->