123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <?php
- use yii\helpers\Html;
- use yii\widgets\ActiveForm;
- use app\widgets\CropperjsWidget;
- use yii\web\View;
- /** @var yii\web\View $this */
- /** @var app\models\Authors $model */
- /** @var yii\widgets\ActiveForm $form */
- $this->title='Редактировать карточку';
- $photo = $model->getPhoto('_cuthd','jpg');
- if( $photo ){
- $imageSrc = $photo."?r=".rand();
- }else{
- $imageSrc = '/img/e.gif';
- }
- ?>
- <style>
- #image {
- width: 420px;
- background: URL(/img/image.svg) no-repeat 50% 50%;
- background-size: contain;
- background-color: #fff;
- cursor: pointer;
- aspect-ratio: 1/1;
- background-size: 70%;
- }
- </style>
- <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]) ?>
- <div class="container-fluid authors-form">
- <div class="row">
- <div class="col-6 col-sm-6">
- <div class="input-group mb-3">
- <img id="image" class="img-circle elevation-2" src="<?=$imageSrc?>" onClick="$('#modal').modal('show');document.getElementById('inputImage').click();" >
- <? echo CropperjsWidget::widget(['image' => 'image', 'file' => 'Authors[photo]', 'post' => 'cropping', 'aspectRatio' => '1/1']); ?>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col">
- <?= $form->field($model, 'uid')->textInput(['maxlength' => true]) ?>
- <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
- <?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?>
- <?= $form->field($model, 'jobTitle')->textInput(['maxlength' => true]) ?>
- <?= $form->field($model, 'description')->textarea(['maxlength' => true]) ?>
- <?= $form->field($model, 'text')->textarea(['maxlength' => true, 'id' => 'text_embed']) ?>
- <?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
- <?= $form->field($model, 'active')->dropDownList([ 'Y' => 'Y', 'N' => 'N', ], ['prompt' => '']) ?>
- <?= $form->field($model, 'show')->dropDownList([ '0' => '0', '1' => '1', ], ['prompt' => '']) ?>
- <div class="form-group">
- <?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
- </div>
- </div>
- </div>
- </div>
- <?php ActiveForm::end(); ?>
- <?php
- $uuid='authors_page';
- ?>
- <?
- $this->registerJs(
- <<<JS
- $(function () {
- console.log($('#text_embed').length);
- if($('#text_embed').length != 0){
- CKEDITOR.replace('text_embed', {
- 'filebrowserBrowseUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=files&uid=$uuid',
- 'filebrowserImageBrowseUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=images&uid=$uuid',
- 'filebrowserFlashBrowseUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=flash&uid=$uuid',
- 'filebrowserUploadUrl': '/components/admin/ckeditor/kcfinder/upload.php?type=files&uid=$uuid',
- 'filebrowserImageUploadUrl': '/components/admin/ckeditor/kcfinder/upload.php?type=images&uid=$uuid',
- 'filebrowserFlashUploadUrl': '/components/admin/ckeditor/kcfinder/upload.php?type=flash&uid=$uuid',
- 'filebrowserAudioBrowseUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=files&uid=$uuid',
- 'filebrowserlightboxUploadUrl': '/components/admin/ckeditor/kcfinder/browse.php?type=files&uid=$uuid',
- 'height': 400
- });
- CKEDITOR.on('instanceReady', function(ev) {
- ev.editor.on('paste', function(evt) {
- evt.data.dataValue = evt.data.dataValue.replace(/[«»]/g,'"');
- console.log(evt.data.dataValue);
- }, null, null, 9);
- });
- }
- });
- JS
- ,
- View::POS_READY,
- 'ck_editor'
- );
|