registerAssetFiles() public method

Registers the CSS and JS files with the given view.
public registerAssetFiles ( View $view )
$view View the view that the asset files are to be registered with.
    /**
     * @inheritdoc
     */
    public function registerAssetFiles($view)
    {
        if ($this->language !== null) {
            $this->js[] = 'select2_locale_' . $this->language . '.js';
        }
        $view->registerJs(<<<JS
\t\t\tfunction formatResult(item) {
\t\t\t\t      if(!item.id) {
\t\t\t\t        // return `text` for optgroup
\t\t\t\t        return item.text;
\t\t\t\t      }
\t\t\t\t      // return item template
\t\t\t\t      return '<i>' + item.text + '</i>';
\t\t\t\t    };
\t\t
\t\t    function formatSelection(repo) {
\t\t\t\t\t//repo.selected =true;
\t\t      // return selection template
\t\t      //return '<b>' + item.text + '</b>';
\t\t        return repo.full_name || repo.text;
    \t\t};
JS
, \yii\web\View::POS_READY);
        parent::registerAssetFiles($view);
    }
    /**
     * Registers the CSS and JS files with the given view.
     * @param View $view the view that the asset files are to be registered with.
     */
    public function registerAssetFiles($view)
    {
        if ($this->page_loading) {
            $view->registerJs('NProgress.start();', View::POS_BEGIN);
            $view->registerJs('NProgress.done();', View::POS_LOAD);
            $this->jsOptions['position'] = View::POS_HEAD;
        }
        if ($this->configuration !== null) {
            $view->registerJs('NProgress.configure(' . Json::encode($this->configuration) . ');', $this->jsOptions['position']);
        }
        if ($this->pjax_events) {
            $jsPjax = <<<PJAX
jQuery(document).on('pjax:start', function() { NProgress.start(); });
jQuery(document).on('pjax:end',   function() { NProgress.done();  });                    
PJAX;
            $view->registerJs($jsPjax, View::POS_END);
            $this->depends[] = 'yii\\widgets\\PjaxAsset';
        }
        if ($this->jquery_ajax_events) {
            $jsAjax = <<<AJAX
jQuery(document).on('ajaxStart',    function() { NProgress.start(); });
jQuery(document).on('ajaxComplete', function() { NProgress.done();  });                    
AJAX;
            $view->registerJs($jsAjax, View::POS_END);
            $this->depends[] = 'yii\\widgets\\JqueryAsset';
        }
        parent::registerAssetFiles($view);
    }
 /**
  * @inheritdoc
  * Register css files as per the request
  * @param \yii\web\View $view
  */
 public function registerAssetFiles($view)
 {
     if ($this->theme && in_array($this->theme, $this->themes)) {
         $this->css[] = 'themes/' . $this->theme . '/' . $this->theme . '.css';
     }
     parent::registerAssetFiles($view);
 }
 /**
  * @inheritdoc
  */
 public function registerAssetFiles($view)
 {
     foreach ($this->plugins as $plugin) {
         $this->js[] = 'summernote-ext-' . $plugin . '.js';
     }
     parent::registerAssetFiles($view);
 }
 /**
  * @inheritdoc
  * Register css files as per the request
  * @param \yii\web\View $view
  */
 public function registerAssetFiles($view)
 {
     if (!$this->themeDir) {
         $this->css = ['css/themes/' . $this->theme . '.css'];
     }
     parent::registerAssetFiles($view);
 }
 public function registerAssetFiles($view)
 {
     if ($this->useLocalStorage) {
         $this->js[] = 'store-js/store.min.js';
     }
     parent::registerAssetFiles($view);
 }
 /**
  * @inheritdoc
  */
 public function registerAssetFiles($view)
 {
     if ($this->language !== null) {
         $this->js[] = 'js/i18n/' . $this->language . '.js';
     }
     parent::registerAssetFiles($view);
 }
Beispiel #8
0
 /**
  * @param \yii\web\View $view
  */
 public function registerAssetFiles($view)
 {
     list($this->basePath, $this->baseUrl) = $this->getAssetsUrl();
     $this->css = ['css' . DIRECTORY_SEPARATOR . 'dev.css', 'highslide' . DIRECTORY_SEPARATOR . 'highslide.css'];
     $this->js = ['js' . DIRECTORY_SEPARATOR . 'dev.js', 'highslide' . DIRECTORY_SEPARATOR . 'highslide.packed.js'];
     parent::registerAssetFiles($view);
 }
Beispiel #9
0
 public function registerAssetFiles($view)
 {
     $language = strtolower(Yii::$app->language);
     $language = in_array($language, $this->languageFiles) ? $language : 'en';
     $this->js[] = "lang/{$language}/{$language}.js";
     parent::registerAssetFiles($view);
 }
 /**
  * @inheritdoc
  */
 public function registerAssetFiles($view)
 {
     if ($this->googleCalendar) {
         $this->js[] = 'gcal.js';
     }
     parent::registerAssetFiles($view);
 }
Beispiel #11
0
 /**
  * Register css file based on theme.
  * @param \yii\web\View $view the view that the asset files are to be registered with.
  */
 public function registerAssetFiles($view)
 {
     if (in_array($this->theme, ['base', 'snow'])) {
         $this->css[] = 'quill.' . $this->theme . '.css';
     }
     parent::registerAssetFiles($view);
 }
 /**
  * Register language script.
  */
 public function registerAssetFiles($view)
 {
     if ($this->language) {
         $this->js[] = 'locale/bootstrap-markdown.' . $this->language . '.js';
     }
     parent::registerAssetFiles($view);
 }
 /**
  * 注册FileAPI默认设置
  * @inheritdoc
  */
 public function registerAssetFiles($view)
 {
     $view = Yii::$app->controller->getView();
     $settings = array_merge(['debug' => YII_DEBUG ? 1 : 0, 'staticPath' => Yii::getAlias($this->baseUrl)], $this->settings);
     $view->registerJs('window.FileAPI=' . Json::encode($settings) . ';', View::POS_HEAD);
     parent::registerAssetFiles($view);
 }
Beispiel #14
0
 /**
  * @inheritdoc
  * @param \yii\web\View $view
  */
 public function registerAssetFiles($view)
 {
     parent::registerAssetFiles($view);
     $view->registerJs('moment.createFromInputFallback = function(config) {
         config._d = new Date(config._i);
     };');
 }
 public function registerAssetFiles($view)
 {
     $nodigitLib = preg_replace('/[0-9]+/', '', $this->library);
     $this->js[] = $this->library . '-editable/js/' . $nodigitLib . '-editable' . (YII_DEBUG ? '.js' : '.min.js');
     $this->css[] = $this->library . '-editable/css/' . $nodigitLib . '-editable.css';
     parent::registerAssetFiles($view);
 }
 /**
  * @inheritdoc
  */
 public function registerAssetFiles($view)
 {
     if ($this->language !== null) {
         $this->js[] = "locale/{$this->language}.js";
     }
     parent::registerAssetFiles($view);
 }
Beispiel #17
0
 /**
  * @inheritdoc
  */
 public function registerAssetFiles($view)
 {
     if ($this->language !== null) {
         $this->js[] = 'select2-3.5.0/select2_locale_' . $this->language . '.js';
     }
     parent::registerAssetFiles($view);
 }
    /**
     * Registers the CSS and JS files with the given view.
     * @param \yii\web\View $view the view that the asset files are to be registered with.
     */
    public function registerAssetFiles($view)
    {
        if ($this->configuration !== null) {
            $view->registerJs('NProgress.configure(' . Json::encode($this->configuration) . ');');
        }
        $view->registerJs(<<<JS
jQuery(document).on('pjax:start', function() { NProgress.start(); });
jQuery(document).on('pjax:end',   function() { NProgress.done();  });
JS
);
        $view->registerJs(<<<JS
var exceptUrls = [

];

jQuery(document).on('ajaxSend',    function(e, xhr, options) {
    if( \$.inArray( options.url, exceptUrls ) == -1)
        NProgress.start();
});
jQuery(document).on('ajaxComplete', function(e, xhr, options) {
    if( \$.inArray( options.url, exceptUrls ) == -1 )
        NProgress.done();
});
JS
);
        parent::registerAssetFiles($view);
    }
 /**
  * Register language script.
  */
 public function registerAssetFiles($view)
 {
     if ($this->language) {
         $this->js[] = "i18n/{$this->language}.js";
     }
     parent::registerAssetFiles($view);
 }
Beispiel #20
0
 public function registerAssetFiles($view)
 {
     parent::registerAssetFiles($view);
     $manager = $view->getAssetManager();
     foreach ($this->href as $href) {
         $view->registerLinkTag(['rel' => 'import', 'href' => $manager->getAssetUrl($this, $href)]);
     }
 }
Beispiel #21
0
 /**
  * @inheritdoc
  */
 public function registerAssetFiles($view)
 {
     $this->js[] = defined('YII_DEBUG') && YII_DEBUG ? 'jstree.js' : 'jstree.min.js';
     if ($this->theme != false) {
         $this->css[] = "themes/{$this->theme}/" . (defined('YII_DEBUG') && YII_DEBUG ? 'style.css' : 'style.min.css');
     }
     parent::registerAssetFiles($view);
 }
 public function registerAssetFiles($view)
 {
     parent::registerAssetFiles($view);
     $inlineScript = "conditionizr.config({\n\t\t\tassets: 'conditionizr/resources/',\n\t\t        tests: {\n\t\t        ie6: [ 'script', 'style', 'class' ],\n\t\t        ie7: [ 'script', 'style', 'class' ],\n\t\t        ie8: [ 'script', 'style', 'class' ]\n\t\t        }\n\t\t    });\n\n    \t\tconditionizr.polyfill( 'scripts/vendor/html5shiv.min.js', [ 'ie6', 'ie7', 'ie8' ] );\n    \t\tconditionizr.polyfill( 'scripts/vendor/respond.min.js', [ 'ie6', 'ie7', 'ie8' ] );";
     $siteUrl = "var siteUrl = '" . Yii::$app->homeUrl . "';\n\t\t\t\t\tvar fileUploadUrl = '" . Yii::$app->homeUrl . "apix/file/file-handler';";
     $view->registerJs($inlineScript, View::POS_READY);
     $view->registerJs($siteUrl, View::POS_END);
 }
Beispiel #23
0
 public function registerAssetFiles($view)
 {
     if ($this->version) {
         $version = is_string($this->version) ? $this->version : Fotorama::VERSION;
         $this->baseUrl = self::CDN_SOURCE_PATH . $version;
     }
     parent::registerAssetFiles($view);
 }
Beispiel #24
0
 /**
  * @inheritdoc
  */
 public function registerAssetFiles($view)
 {
     $language = \Yii::$app->language;
     if (is_file(\Yii::getAlias("{$this->sourcePath}/js/i18n/{$language}.js"))) {
         $this->js[] = "js/i18n/{$language}.js";
     }
     parent::registerAssetFiles($view);
 }
 public function registerAssetFiles($view)
 {
     parent::registerAssetFiles($view);
     // Копируем картинки
     $manager = $view->getAssetManager();
     $dst = $manager->getAssetUrl($this, 'bootstrap/css/images');
     $src = __DIR__ . '/assets/bootstrap/css/images';
     FileHelper::copyDirectory($src, $dst);
 }
Beispiel #26
0
    public function registerAssetFiles($view)
    {
        parent::registerAssetFiles($view);
        $url = Json::encode(Url::to(['/admin/general/route-to-url'], true));
        $js = <<<JS
yii.yz.admin.settings.routeToUrl = {$url};
JS;
        $view->registerJs($js);
    }
 /**
  * @inheritdoc
  */
 public function registerAssetFiles($view)
 {
     $this->css[] = 'jquery-ui-timepicker-addon' . (YII_DEBUG ? '' : '.min') . '.css';
     $this->js[] = 'jquery-ui-timepicker-addon' . (YII_DEBUG ? '' : '.min') . '.js';
     if ($this->language !== null) {
         $this->js[] = 'i18n/jquery-ui-timepicker-' . $this->language . '.js';
     }
     parent::registerAssetFiles($view);
 }
Beispiel #28
0
 public function registerAssetFiles($view)
 {
     //if multiple resolutions enabled, init it's plugin
     if ($this->multipleResolutions) {
         $this->js[] = 'plugins/videojs-resolution-selector/video-quality-selector.js';
         $this->css[] = 'plugins/videojs-resolution-selector/button-styles.css';
     }
     parent::registerAssetFiles($view);
 }
 /**
  * @inheridoc
  */
 public function registerAssetFiles($view)
 {
     $css = '/styles/' . self::$style . '.css';
     if (!file_exists($filename = $this->sourcePath . $css)) {
         throw new InvalidConfigException('Unknown style ' . self::$style);
     }
     $this->css = [$this->baseUrl . $css];
     parent::registerAssetFiles($view);
 }
Beispiel #30
0
 public function registerAssetFiles($view)
 {
     if (YII_DEBUG) {
         $this->js = ['pace.js'];
     } else {
         $this->js = ['pace.min.js'];
     }
     parent::registerAssetFiles($view);
 }