Merge branch 'develop' into ui-improvements

This commit is contained in:
alekseybobkov 2014-06-26 21:48:50 +11:00
commit 25f02c33cd
21 changed files with 248 additions and 119 deletions

View File

@ -54,7 +54,7 @@ return array(
|
*/
'from' => array('address' => null, 'name' => null),
'from' => array('address' => 'noreply@site.com', 'name' => 'October'),
/*
|--------------------------------------------------------------------------

View File

@ -74,7 +74,7 @@ AssetManager = function() {
callback && callback()
return
}
o.loadJavaScript(jsList, function(){
jsLoaded = true
checkLoaded()
@ -99,7 +99,7 @@ AssetManager = function() {
if (!jsLoaded)
return false
if (cssCounter < cssList.length)
if (cssCounter < cssList.length)
return false
callback && callback()

View File

@ -27,11 +27,11 @@ class BackendHelper
/**
* Returns a URL in context of the active Backend skin
*/
public function skinUrl($path = null)
public function skinAsset($path = null)
{
$path = RouterHelper::normalizeUrl($path);
$skinPath = Skin::getActive()->skinPath;
return URL::to($skinPath . $path);
return URL::asset($skinPath . $path);
}
/**

View File

@ -16,7 +16,7 @@
data-show-gutter="<?= $showGutter ? 'true' : 'false' ?>"
data-language="<?= $language ?>"
data-margin="<?= $margin ?>"
data-vendor-path="<?= URL::to('/modules/backend/formwidgets/codeeditor/assets/vendor/ace') ?>/">
data-vendor-path="<?= URL::asset('/modules/backend/formwidgets/codeeditor/assets/vendor/ace') ?>/">
<div class="editor-toolbar">
<ul>
<li class="fullscreen-enable">

View File

@ -152,8 +152,8 @@ return [
'extension' => 'The PHP extension :name is not installed. Please install this library and activate the extension.'
],
'editor' => [
'menu_label' => 'Editor Configuration',
'menu_description' => 'Manage editor configuration.',
'menu_label' => 'Editor Preferences',
'menu_description' => 'Manage code editor preferences.',
'font_size' => 'Font size',
'tab_size' => 'Tab size',
'use_hard_tabs' => 'Indent using tabs',

View File

@ -156,8 +156,8 @@ return [
'extension' => 'The PHP extension :name is not installed. Please install this library and activate the extension.'
],
'editor' => [
'menu_label' => 'Editor Configuration',
'menu_description' => 'Manage editor configuration.',
'menu_label' => 'Editor Preferences',
'menu_description' => 'Manage code editor preferences.',
'font_size' => 'Font size',
'tab_size' => 'Tab size',
'use_hard_tabs' => 'Indent using tabs',

View File

@ -152,8 +152,8 @@ return [
'extension' => 'The PHP extension :name is not installed. Please install this library and activate the extension.'
],
'editor' => [
'menu_label' => 'Editor Configuration',
'menu_description' => 'Manage editor configuration.',
'menu_label' => 'Editor Preferences',
'menu_description' => 'Manage code editor preferences.',
'font_size' => 'Font size',
'tab_size' => 'Tab size',
'use_hard_tabs' => 'Indent using tabs',

View File

@ -152,8 +152,8 @@ return [
'extension' => 'The PHP extension :name is not installed. Please install this library and activate the extension.'
],
'editor' => [
'menu_label' => 'Editor Configuration',
'menu_description' => 'Manage editor configuration.',
'menu_label' => 'Editor Preferences',
'menu_description' => 'Manage code editor preferences.',
'font_size' => 'Font size',
'tab_size' => 'Tab size',
'use_hard_tabs' => 'Indent using tabs',

View File

@ -12,9 +12,9 @@ return [
'page' => [
'untitled' => "Без названия",
'access_denied' => [
'label' => "доступ запрещен",
'help' => "Вы не должны необходимые разрешения для просмотра этой страницы.",
'cms_link' => "К CMS серверной",
'label' => "Доступ запрещен",
'help' => "У вас нет необходимых прав для просмотра этой страницы.",
'cms_link' => "Перейти к CMS",
],
],
'partial' => [
@ -89,7 +89,7 @@ return [
'missing_columns' => 'Список используемый в :class не имеет никаких столбцов.',
'missing_definition' => "Поведение списка не содержит столбец для ':field'.",
'behavior_not_ready' => 'Поведение списка не было инициализировано, проверьте вызов makeLists() в вашем контроллере.',
'invalid_column_datetime' => "Column value ':column' is not a DateTime object, are you missing a \$dates reference in the Model?",
'invalid_column_datetime' => "Значение столбца ':column' не является объектом DateTime. Отсутствует \$dates ссылка в модели?",
],
'form' => [
'create_title' => "Создание :name",
@ -120,7 +120,10 @@ return [
'or' => 'или',
'confirm_tab_close' => 'Закрыть вкладку? Несохраненные изменения будут потеряны.',
'behavior_not_ready' => 'Поведение формы не было инициализировано, проверьте вызов initForm() в вашем контроллере.',
'preview_no_files_message' => 'Файлы не загружены'
'preview_no_files_message' => 'Файлы не загружены',
'select' => 'Выбрать',
'select_all' => 'все',
'select_none' => 'ничего',
],
'relation' => [
'missing_definition' => "Поведение отношения не содержит определения для ':field'.",
@ -144,7 +147,7 @@ return [
'missing_id' => "Нет идентификатора для поиска модели записи.",
'missing_relation' => "Модель ':class' не содержит определения для ':relation'",
'invalid_class' => "Модель :model используемая в :class не допустима, она должна наследовать класс \Model.",
'mass_assignment_failed' => "Mass assignment failed for Model attribute ':attribute'.",
'mass_assignment_failed' => "Массовое заполнение недоступно для атрибута модели ':attribute'.",
],
'warnings' => [
'tips' => 'Подсказки по конфигурации системы',
@ -153,16 +156,16 @@ return [
'extension' => 'Расширение PHP :name не установлено. Установите эту библиотеку и активируйте расширение.'
],
'editor' => [
'menu_label' => 'Editor Configuration',
'menu_description' => 'Manage editor configuration.',
'font_size' => 'Font size',
'tab_size' => 'Tab size',
'use_hard_tabs' => 'Indent using tabs',
'code_folding' => 'Code folding',
'word_wrap' => 'Word wrap',
'highlight_active_line' => 'Highlight active line',
'show_invisibles' => 'Show invisible characters',
'show_gutter' => 'Show gutter',
'theme' => 'Color scheme',
'menu_label' => 'Настройки редактора',
'menu_description' => 'Управление настройками редактора кода.',
'font_size' => 'Размер шрифта',
'tab_size' => 'Размер табуляции',
'use_hard_tabs' => 'Использовать табуляцию для индентации',
'code_folding' => 'Свертывание кода',
'word_wrap' => 'Перенос слов',
'highlight_active_line' => 'Подсвечивать активную строку',
'show_invisibles' => 'Показывать невидимые символы',
'show_gutter' => 'Показывать нумерацию строк',
'theme' => 'Цветовая схема',
],
];

View File

@ -4,69 +4,69 @@
<?= $this->pageTitle ?> | October CMS
</title>
<link href="<?= URL::to('modules/backend/assets/vendor/select2/select2.css') ?>" rel="stylesheet">
<link href="<?= URL::to('modules/backend/assets/css/october.css') ?>?v<?= System\Models\Parameters::get('system::core.build', 1) ?>" rel="stylesheet">
<link href="<?= URL::asset('modules/backend/assets/vendor/select2/select2.css') ?>" rel="stylesheet">
<link href="<?= URL::asset('modules/backend/assets/css/october.css') ?>?v<?= System\Models\Parameters::get('system::core.build', 1) ?>" rel="stylesheet">
<script src="<?= URL::to('modules/backend/assets/js/vendor/jquery-2.0.3.min.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/vendor/jquery.ui.widget.js') ?>"></script>
<script src="<?= URL::to('modules/system/assets/js/framework.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/vendor/modernizr.min.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/vendor/mousewheel.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/vendor/jquery.touchwipe.min.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/vendor/moment.min.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/vendor/raphael-min.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/vendor/jquery.autoellipsis.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/vendor/jquery.waterfall.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/vendor/select2/select2.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/vendor/mustache/mustache.min.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/vendor/fileupload/jquery.fileupload.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/vendor/fileupload/jquery.iframe-transport.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/vendor/jquery-2.0.3.min.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/vendor/jquery.ui.widget.js') ?>"></script>
<script src="<?= URL::asset('modules/system/assets/js/framework.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/vendor/modernizr.min.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/vendor/mousewheel.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/vendor/jquery.touchwipe.min.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/vendor/moment.min.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/vendor/raphael-min.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/vendor/jquery.autoellipsis.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/vendor/jquery.waterfall.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/vendor/select2/select2.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/vendor/mustache/mustache.min.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/vendor/fileupload/jquery.fileupload.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/vendor/fileupload/jquery.iframe-transport.js') ?>"></script>
<script src="<?= URL::to('modules/system/assets/vendor/bootstrap/js/tooltip.js') ?>"></script>
<script src="<?= URL::to('modules/system/assets/vendor/bootstrap/js/modal.js') ?>"></script>
<script src="<?= URL::to('modules/system/assets/vendor/bootstrap/js/tab.js') ?>"></script>
<script src="<?= URL::to('modules/system/assets/vendor/bootstrap/js/transition.js') ?>"></script>
<script src="<?= URL::to('modules/system/assets/vendor/bootstrap/js/dropdown.js') ?>"></script>
<script src="<?= URL::asset('modules/system/assets/vendor/bootstrap/js/tooltip.js') ?>"></script>
<script src="<?= URL::asset('modules/system/assets/vendor/bootstrap/js/modal.js') ?>"></script>
<script src="<?= URL::asset('modules/system/assets/vendor/bootstrap/js/tab.js') ?>"></script>
<script src="<?= URL::asset('modules/system/assets/vendor/bootstrap/js/transition.js') ?>"></script>
<script src="<?= URL::asset('modules/system/assets/vendor/bootstrap/js/dropdown.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/vendor/flot/jquery.flot.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/vendor/flot/jquery.flot.tooltip.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/vendor/flot/jquery.flot.resize.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/vendor/flot/jquery.flot.time.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/vendor/flot/jquery.flot.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/vendor/flot/jquery.flot.tooltip.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/vendor/flot/jquery.flot.resize.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/vendor/flot/jquery.flot.time.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.controls.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.utils.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.triggerapi.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.dragscroll.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.toolbar.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.verticalmenu.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.navbar.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.sidenav.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.tab.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.popover.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.popup.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.goalmeter.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.scrollbar.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.filelist.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.hotkey.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.loadindicator.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.stripeloadindicator.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.flashmessage.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.inputpreset.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.layout.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.sidepaneltab.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.simplelist.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.sortable.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.inspector.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.dropdown.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.changemonitor.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.chartutils.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.chartpie.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.chartbar.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.chartline.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.balloonselector.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.rowlink.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.treelist.js') ?>"></script>
<script src="<?= URL::to('modules/backend/assets/js/october.autocomplete.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.controls.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.utils.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.triggerapi.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.dragscroll.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.toolbar.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.verticalmenu.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.navbar.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.sidenav.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.tab.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.popover.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.popup.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.goalmeter.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.scrollbar.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.filelist.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.hotkey.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.loadindicator.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.stripeloadindicator.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.flashmessage.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.inputpreset.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.layout.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.sidepaneltab.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.simplelist.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.sortable.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.inspector.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.dropdown.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.changemonitor.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.chartutils.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.chartpie.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.chartbar.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.chartline.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.balloonselector.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.rowlink.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.treelist.js') ?>"></script>
<script src="<?= URL::asset('modules/backend/assets/js/october.autocomplete.js') ?>"></script>
<script>

View File

@ -5,6 +5,7 @@ use File;
use Lang;
use Cache;
use Config;
use Request;
use Response;
use Assetic\Asset\AssetCollection;
use Assetic\Asset\FileAsset;
@ -238,7 +239,7 @@ class CombineAssets
$cache = new FilesystemCache($this->storagePath);
$collection = new AssetCollection($files, [], $filesSalt);
$collection->setTargetPath('combine/');
$collection->setTargetPath($this->getTargetPath());
// @todo - Remove, this cache step is too hardcore.
// if (!$this->useCache)
@ -248,6 +249,27 @@ class CombineAssets
return $cachedCollection;
}
/**
* Returns the target path for use with the combiner. The target
* path helps generate relative links within CSS.
*
* /combine returns combine/
* /index.php/combine returns index-php/combine/
*
* @return string The new target path
*/
protected function getTargetPath($path = null)
{
if ($path === null)
$path = Request::getBaseUrl().'/combine';
if (strpos($path, '/') === 0)
$path = substr($path, 1);
$path = str_replace('.', '-', $path).'/';
return $path;
}
/**
* Stores information about a asset collection against
* a cache identifier.

View File

@ -14,7 +14,8 @@ use Exception;
use Twig_Environment;
use Controller as BaseController;
use Cms\Twig\Loader as TwigLoader;
use Cms\Twig\Extension as TwigExtension;
use Cms\Twig\Extension as CmsTwigExtension;
use System\Twig\Extension as SystemTwigExtension;
use Cms\Classes\FileHelper as CmsFileHelper;
use System\Classes\ErrorHandler;
use October\Rain\Support\Markdown;
@ -229,7 +230,8 @@ class Controller extends BaseController
$options['cache'] = storage_path().'/twig';
$this->twig = new Twig_Environment($this->loader, $options);
$this->twig->addExtension(new TwigExtension($this));
$this->twig->addExtension(new CmsTwigExtension($this));
$this->twig->addExtension(new SystemTwigExtension);
}
/**
@ -686,14 +688,15 @@ class Controller extends BaseController
public function themeUrl($url = null)
{
$themePath = Config::get('cms.themesDir').'/'.$this->getTheme()->getDirName();
$_url = Request::getBaseUrl();
if ($url === null)
$_url .= $themePath;
elseif (is_array($url))
if (is_array($url)) {
$_url = Request::getBaseUrl();
$_url .= CombineAssets::combine($url, $themePath);
else
$_url .= $themePath.'/'.$url;
}
else {
$_url = Request::getBasePath().$themePath;
if ($url !== null) $_url .= '/'.$url;
}
return $_url;
}

View File

@ -86,7 +86,6 @@ class Extension extends Twig_Extension
public function getFilters()
{
$filters = [
new Twig_SimpleFilter('app', [$this, 'appFilter'], ['is_safe' => ['html']]),
new Twig_SimpleFilter('page', [$this, 'pageFilter'], ['is_safe' => ['html']]),
new Twig_SimpleFilter('theme', [$this, 'themeFilter'], ['is_safe' => ['html']]),
];
@ -211,16 +210,6 @@ class Extension extends Twig_Extension
return $this->controller->themeUrl($url);
}
/**
* Converts supplied URL to one relative to the website root.
* @param mixed $url Specifies the application-relative URL
* @return string
*/
public function appFilter($url)
{
return URL::to($url);
}
/**
* Looks up the URL for a supplied page and returns it relative to the website root.
* @param mixed $name Specifies the Cms Page file name.

View File

@ -28,13 +28,13 @@ class FrameworkNode extends Twig_Node
$compiler
->addDebugInfo($this)
->write("echo '<script src=\"'. Request::getBaseUrl() .'/modules/system/assets/js/framework.js\"></script>'.PHP_EOL;" . PHP_EOL)
->write("echo '<script src=\"'. Request::getBasePath() .'/modules/system/assets/js/framework.js\"></script>'.PHP_EOL;" . PHP_EOL)
;
if ($includeExtras) {
$compiler
->write("echo '<script src=\"'. Request::getBaseUrl() .'/modules/system/assets/js/framework.extras.js\"></script>'.PHP_EOL;" . PHP_EOL)
->write("echo '<link href=\"'. Request::getBaseUrl() .'/modules/system/assets/css/framework.extras.css\" rel=\"stylesheet\">'.PHP_EOL;" . PHP_EOL)
->write("echo '<script src=\"'. Request::getBasePath() .'/modules/system/assets/js/framework.extras.js\"></script>'.PHP_EOL;" . PHP_EOL)
->write("echo '<link href=\"'. Request::getBasePath() .'/modules/system/assets/css/framework.extras.css\" rel=\"stylesheet\">'.PHP_EOL;" . PHP_EOL)
;
}
}

View File

@ -13,6 +13,7 @@ use System\Classes\PluginManager;
use System\Classes\SettingsManager;
use System\Twig\Engine as TwigEngine;
use System\Twig\Loader as TwigLoader;
use System\Twig\Extension as TwigExtension;
use System\Models\EmailSettings;
use System\Models\EmailTemplate;
use Backend\Classes\WidgetManager;
@ -74,7 +75,9 @@ class ServiceProvider extends ModuleServiceProvider
* Register basic twig
*/
App::bindShared('twig', function($app) {
return new Twig_Environment(new TwigLoader(), ['auto_reload' => true]);
$twig = new Twig_Environment(new TwigLoader(), ['auto_reload' => true]);
$twig->addExtension(new TwigExtension);
return $twig;
});
/*

View File

@ -11,7 +11,7 @@
<div class="form-group">
<span class="help-block pull-right">
<a target="_blank" href="http://octobercms.com/docs/help/projects#project-id"><?= e(trans('system::lang.project.id.help')) ?></a>
<a target="_blank" href="http://octobercms.com/help/site/projects#project-id"><?= e(trans('system::lang.project.id.help')) ?></a>
</span>
<label for="projectId"><?= e(trans('system::lang.project.id.label')) ?></label>
<input

View File

@ -40,8 +40,8 @@ class File extends FileBase
{
$uploadsDir = Config::get('cms.uploadsDir');
if ($this->isPublic())
return Request::getBaseUrl() . $uploadsDir . '/public/';
return Request::getBasePath() . $uploadsDir . '/public/';
else
return Request::getBaseUrl() . $uploadsDir . '/protected/';
return Request::getBasePath() . $uploadsDir . '/protected/';
}
}

View File

@ -240,7 +240,7 @@ trait AssetMaker
return $asset;
if (substr($asset, 0, 1) == '/')
$asset = Request::getBaseUrl() . $asset;
$asset = Request::getBasePath() . $asset;
return $asset;
}

View File

@ -0,0 +1,76 @@
<?php namespace System\Twig;
use URL;
use Twig_Extension;
use Twig_TokenParser;
use Twig_SimpleFilter;
use Twig_SimpleFunction;
use System\Classes\ApplicationException;
/**
* The System Twig extension class implements common Twig functions and filters.
*
* @package october\system
* @author Alexey Bobkov, Samuel Georges
*/
class Extension extends Twig_Extension
{
/**
* Creates the extension instance.
*/
public function __construct(){}
/**
* Returns the name of the extension.
*
* @return string The extension name
*/
public function getName()
{
return 'System';
}
/**
* Returns a list of functions to add to the existing list.
*
* @return array An array of functions
*/
public function getFunctions()
{
return [];
}
/**
* Returns a list of filters this extensions provides.
*
* @return array An array of filters
*/
public function getFilters()
{
$filters = [
new Twig_SimpleFilter('app', [$this, 'appFilter'], ['is_safe' => ['html']]),
];
return $filters;
}
/**
* Returns a list of token parsers this extensions provides.
*
* @return array An array of token parsers
*/
public function getTokenParsers()
{
return [];
}
/**
* Converts supplied URL to one relative to the website root.
* @param mixed $url Specifies the application-relative URL
* @return string
*/
public function appFilter($url)
{
return URL::to($url);
}
}

View File

@ -114,6 +114,17 @@ class CombineAssetsTest extends TestCase
$this->markTestIncomplete('TODO');
}
public function testGetTargetPath()
{
$combiner = new CombineAssets;
$value = self::callProtectedMethod($combiner, 'getTargetPath', ['/combine']);
$this->assertEquals('combine/', $value);
$value = self::callProtectedMethod($combiner, 'getTargetPath', ['/index.php/combine']);
$this->assertEquals('index-php/combine/', $value);
}
public function testMakeCacheId()
{
$sampleResources = ['assets/css/style1.css', 'assets/css/style2.css'];

View File

@ -350,4 +350,26 @@ ESC;
$this->assertArrayHasKey('ajax-result', $content);
$this->assertEquals('page', $content['ajax-result']);
}
}
public function testThemeUrl()
{
$theme = new Theme();
$theme->load('test');
$controller = new Controller($theme);
$url = $controller->themeUrl();
$this->assertEquals('/tests/fixtures/cms/themes/test', $url);
$url = $controller->themeUrl('foo/bar.css');
$this->assertEquals('/tests/fixtures/cms/themes/test/foo/bar.css', $url);
$url = $controller->themeUrl(['assets/css/style1.css', 'assets/css/style2.css']);
$url = substr($url, 0, strpos($url, '-'));
$this->assertEquals('/combine/88634b8fa6f4f6442ce830d38296640a', $url);
$url = $controller->themeUrl(['assets/js/script1.js', 'assets/js/script2.js']);
$url = substr($url, 0, strpos($url, '-'));
$this->assertEquals('/combine/860afc990164a60a8e90682d04da27ee', $url);
}
}