/** * @return \Phoenix\Container\ContainerInterface */ public function buildContainer() { $container = new Container(); $i = 0; $sections = array(); foreach ($this->files as $file) { $jsPackageName = $this->getJsPackageName($file); if ($jsPackageName && !$this->config['debug']) { $file = 'packages/' . $jsPackageName . '.js'; $asset = new Asset($this->getFinalPath($file)); $asset->setIsPackage(true); $container->add($asset); continue; } if (!$this->useBatches()) { $container->add(new Asset($this->getFinalPath($file))); } else { $sections[intval($i++ / $this->getBatchSize())][] = $file; } } if (count($sections)) { foreach ($sections as $aSection) { $container->add(new Asset($this->config['batchController'] . base64_encode(implode(',', $aSection)) . '.js')); } } return $container; }
public function testSetIspackage() { $asset = new Asset('myfile.js'); $this->assertFalse($asset->isPackage()); $asset->setIsPackage(true); $this->assertTrue($asset->isPackage()); $asset->setIsPackage(false); $this->assertFalse($asset->isPackage()); $asset->setIsPackage(0); $this->assertFalse($asset->isPackage()); $asset->setIsPackage(1); $this->assertTrue($asset->isPackage()); }
/** * prepareExecute * * @return void */ protected function prepareExecute() { $this->checkAccess(); // Assets BootstrapScript::css(); BootstrapScript::script(); Asset::addStyle('admin/css/admin.css'); Asset::addStyle('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css'); // Language TranslatorHelper::loadAll($this, 'ini'); }
{{-- Part of natika project. --}} <?php \Natika\Script\EditorScript::codeMirror('editor', '#input-body'); \Phoenix\Script\JQueryScript::core(); \Phoenix\Asset\Asset::addScript('js/inline-uploader/inline-uploader.js'); \Phoenix\Asset\Asset::addScript('js/inline-uploader/adapter/codemirror-adapter.js'); \Phoenix\Asset\Asset::addScript('js/markdown/js-markdown-extra.min.js'); ?> <div id="editor" class="panel panel-default"> <div class="panel-heading clearfix"> <div class="pull-left"> Editor </div> <div class="pull-right"> </div> </div> <div class="panel-body"> @if (!empty($title_field)) <div class="form-group"> <label for="input-title" class="sr-only">Title</label> <input type="text" class="form-control input-lg" id="input-title" name="item[title]" placeholder="Title" value="{{ $post->title }}"> </div> @endif <div class="toolbar"> <div class="btn-group"> <button id="button-h1" class="btn btn-default btn-sm">H1</button> <button id="button-h2" class="btn btn-default btn-sm">H2</button>
{{-- Part of phoenix project. --}} <?php use Phoenix\Asset\Asset; use Phoenix\Script\PhoenixScript; PhoenixScript::core(); Asset::addScript('js/category.js'); ?> @extends('_global.html') @if ($currentCategory->id != 1) @section('banner_inner') <h1 class="category-page-title"> <span class="{{ isset($currentCategory->params->image_icon) ? $currentCategory->params->image_icon : 'fa fa-folder-open' }}"></span> {{ \Phoenix\Html\HtmlHeader::getTitle() }} </h1> <ol class="breadcrumb"> @foreach ($breadcrumbs as $breadcrumb) <li> <a href="{{ $breadcrumb->link }}"> {{ $breadcrumb->title }} </a> </li> @endforeach </ol> @if (\Natika\User\UserHelper::isLogin()) <a class="tool-button btn btn-default btn-lg pull-right create-topic-button" href="{{ $router->html('topic_new', array('category' => $currentCategory->id)) }}"> <span class="fa fa-comment"></span>
/** * prepareScript * * @return void */ protected function prepareScript() { static $inited = false; if ($inited) { return; } JQueryScript::ui(array('effect')); $js = <<<JS // Phoenix.Field.Modal var Natika; (function(Natika, \$) { (function() { Natika.Field.Modal = { select: function(selector, id, title) { var ele = \$(selector); ele.find('.input-group input').attr('value', title).delay(250).effect('highlight'); ele.find('input[data-value-store]').attr('value', id); ele.find('.icon-preview > span').attr('class', id); \$('#phoenix-iframe-modal').modal('hide'); } }; })(Natika.Field || (Natika.Field = {})); })(Natika || (Natika = {}), jQuery); jQuery(document).ready(function(\$) { var inputs = \$('.icon-input-field'); inputs.each(function(i) { var \$this = \$(this); var value = \$this.val(); var icon = '<span class="' + value + '"></span>'; \t\t\$this.parent('.input-group').prepend('<span class="input-group-addon icon-preview">' + icon + '</span>'); }); }); JS; Asset::internalScript($js); $inited = true; }
{{-- Part of Windwalker project. --}} <?php use Phoenix\Asset\Asset; use Phoenix\Script\BootstrapScript; BootstrapScript::css(); BootstrapScript::script(); Asset::addStyle('css/main.css'); Asset::addStyle('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css'); Asset::addStyle('css/github-markdown-css.min.css'); if (is_file(WINDWALKER_PUBLIC . '/media/css/custom.css')) { Asset::addStyle('css/custom.css'); } ?> <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>{{ \Phoenix\Html\Document::getPageTitle() }}</title> <link rel="shortcut icon" type="image/x-icon" href="{{ $uri['media.path'] }}images/favicon.ico" /> <meta name="generator" content="Windwalker Framework" /> {!! \Phoenix\Html\HtmlHeader::renderMetadata() !!} @yield('meta') {!! \Phoenix\Asset\Asset::renderStyles(true) !!} @yield('style') {!! \Phoenix\Html\HtmlHeader::renderCustomTags() !!} </head> <body class="natika-body {{ $package->getName() }}-body view-{{ $view->name }} layout-{{ $view->layout }} category-{{ isset($currentCategory) ? $currentCategory->get('alias', 'root') : null }}">