Hi!
Anyone got the imageUpload from the Yii-Redactor-extension to work?
I have a few questions regarding it, first off: What is the ‘attribute’=>$attribute supposed to be? I just dont understand what string it would need there.
Secondly, when i just define ‘attribute’ => ‘text’ (that is the attribute for the entry in the table im using redactor for) it loads allright, but when i try to upload the image, it thinks for a short while, but no image is uploaded.
The Controller:
public function actions()
{
return array(
'imageUpload'=>array(
'class'=>'ext.redactor.actions.ImageUpload',
'uploadCreate'=>true,
),
'imageList'=>array(
'class'=>'ext.redactor.actions.ImageList',
),
);
}
The view:
$this->widget('bootstrap.widgets.TbBox', array(
'title' => 'Opprett nyhet',
'headerIcon' => 'icon-home',
'content' => $this->renderPartial('_form', array('model'=>$model), true) // $this->renderPartial('_view')
));
The _form:
<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',array(
'id'=>'news-form',
'enableAjaxValidation'=>false,
)); ?>
<?php echo $form->errorSummary($model); ?>
<?php echo $form->textFieldRow($model,'headline',array('class'=>'span5','maxlength'=>255,'labelOptions' => array('label' => false), 'placeholder' => 'Overskrift')); ?>
<?php
$this->widget('ext.redactor.ERedactorWidget',array(
'model'=>$model,
'attribute'=>$attribute,
'options'=>array(
'imageUpload'=>Yii::app()->createUrl('news/imageUpload',array(
'attr'=>$attribute
)),
'imageGetJson'=>Yii::app()->createUrl('news/imageList',array(
'attr'=>$attribute
)),
'imageUploadErrorCallback'=>new CJavaScriptExpression(
'function(obj,json) { alert(json.error); }'
),
'lang'=>'no_NB',
),
));
?>
<p><?php echo $form->textFieldRow($model,'author',array('prepend'=>'Av', 'class'=>'small','maxlength'=>255,'labelOptions' => array('label' => false), 'value'=> Yii::app()->user->name)); ?>
<?php echo $form->checkBox($model,'published'); ?>
<?php $this->widget('bootstrap.widgets.TbButton', array(
'buttonType'=>'submit',
'type'=>'primary',
'label'=>'Lagre',
)); ?>
<?php $this->endWidget(); ?>
Could it be the bootstrap fudging with it?
Appriciate all help thx