Example #1
0
 public function init()
 {
     parent::init();
     $view = $this->view;
     //        $view->registerAssetBundle('app\assets\FancyBoxAsset');
     //        if($this->model && $this->attribute) {
     //            $model = $this->model;
     //            $this->modelClass = StringHelper::basename($model::className());
     //            $this->inputId = strtolower($this->modelClass).'-'.$this->attribute;
     //        }
     //        if(empty($this->label) && $this->attribute) {
     //            $this->label = $model->getAttributeLabel($this->attribute);
     //        }
     FancyBoxAsset::register($view);
     $this->htmlOptions['class'] = 'form-control';
     $view->registerJs('
     $(".fancybox").fancybox({
         autoSize : false,
         width : 900,
         height : 600,
         type : \'iframe\',
         autoScale : false,
         helpers: {
             overlay: {
                 locked: false
             }
         }
     });', $view::POS_READY);
     if ($this->preview) {
         $view->registerJs('
         function responsive_filemanager_callback(attribute_id){
             console.log(attribute_id);
             var url=jQuery(\'#\'+attribute_id).val();
             if(jQuery(\'#' . $this->previewID . '_\'+attribute_id).length == 0) {
                 jQuery(\'#\'+attribute_id).after(\'<div id="' . $this->previewID . '_\'+attribute_id+\'"></div>\');
             }
             jQuery(\'#' . $this->previewID . '_\'+attribute_id).html(\'<img src="' . \Yii::$app->homeUrl . 'resources/thumbs/\'+url+\'">\');
         }', $view::POS_HEAD);
     }
 }
Example #2
0
 /**
  * Registers required script for the plugin to work as DatePicker
  */
 public function registerClientScript()
 {
     $view = $this->getView();
     \app\assets\FancyBoxAsset::register($view);
 }