avanzu/admin-theme-bundle

基于AdminLTE模板的Admin主题,方便集成到symfony

安装次数: 243,984

依赖者: 9

建议者: 0

安全: 0

星级: 280

关注者: 33

分支: 148

公开问题: 31

类型:symfony-bundle

2.0.0-beta.10 2017-11-14 18:45 UTC

README

欢迎提交Pull Requests PRs Welcome 支持 Symfony 2.x & 3.x Symfony 2.x & 3.x 构建状态 Build Status 最新稳定版本 Latest Stable Version 最新不稳定版本 Latest Unstable Version 许可证 License

总下载量 Total Downloads 每月下载量 Monthly Downloads 每日下载量 Daily Downloads

Throughput Graph

基于AdminLTE模板的Admin主题,方便集成到symfony。此包集成了多个常用javascripts和出色的AdminLTE模板

安装

使用composer安装非常简单:此命令将"avanzu/admin-theme-bundle": "~1.3"添加到您的composer.json中,并下载包

   php composer.phar require avanzu/admin-theme-bundle

注意:如果您希望保持AdminLTE主题v1.x,请在composer.json的"require"部分手动引用"avanzu/admin-theme-bundle": "~1.1"并运行php composer.phar update

对于不稳定版本(基于master分支)使用

   php composer.phar avanzu/admin-theme-bundle dev-master

在您的kernel中启用此包

<?php
// app/AppKernel.php

public function registerBundles()
{
	$bundles = array(
		// ...
		new Avanzu\AdminThemeBundle\AvanzuAdminThemeBundle(),
	);
}

如果您使用此包的2.x分支或dev-master版本,还需要

php bin/console avanzu:admin:initialize

安装资源(最好使用符号链接方法,但硬拷贝也可以工作)...

	php app/console assets:install --symlink

或symfony 3.x/4.x版本

	php bin/console assets:install --symlink

...并获取供应商...

	php app/console avanzu:admin:fetch-vendor

或symfony 3.x/4.x版本

	php bin/console avanzu:admin:fetch-vendor

另外,您可以在安装或更新此包时触发获取供应商,为此编辑您的composer.json存档并添加

    "scripts": {
        "post-install-cmd": [
            "Avanzu\\AdminThemeBundle\\Composer\\ScriptHandler::fetchThemeVendors"
        ],
        "post-update-cmd": [
            "Avanzu\\AdminThemeBundle\\Composer\\ScriptHandler::fetchThemeVendors"
        ]
    } 

Symfony 2.8注意

此包需要assetic,但自2.8版本起,它不再随symfony一起分发。从版本2.8开始。要安装assetic,请按照以下步骤操作。

php composer.phar require symfony/assetic-bundle

在您的kernel中启用此包

<?php
// app/AppKernel.php

public function registerBundles()
{
	$bundles = array(
		// ...
		new Symfony\Bundle\AsseticBundle\AsseticBundle(),
	);
}

app/config/config_dev.yml中添加以下行:

assetic:
    use_controller: false

更改模板的默认值

如果您想更改任何默认值,例如admin_skin,您只需要在app/config/config.yml中的[twig]部分定义相同的值。下面是示例:

# Twig Configuration
twig:
    debug:            "%kernel.debug%"
    strict_variables: "%kernel.debug%"
    globals:
        admin_skin: skin-blue

您还可以在app/config/parameters.yml中定义这些值

admin_skin: skin-blue

然后在app/config/config.yml中按以下方式使用:

# Twig Configuration
twig:
    debug:            "%kernel.debug%"
    strict_variables: "%kernel.debug%"
    globals:
        admin_skin: "%admin_skin%"

AdminLTE皮肤有:skin-blue(此包的默认值)、skin-blue-light、skin-yellow、skin-yellow-light、skin-green、skin-green-light、skin-purple、skin-purple-light、skin-red、skin-red-light、skin-black和skin-black-light。如果您想了解更多信息,请查看AdminLTE的文档此处

有几个值您可以在不修改任何包的情况下更改,只需查看Resources/views下的内容即可。这就足够了。

升级通知

版本>=1.3包含位于Resources/public/static/[prod|dev]下的预包装资源文件。因此,不再有严格的bowyer和/或assetic需求。然而,assetic组仍然存在,并且应该像往常一样工作。

如果已安装assetic包,但您不希望AdminThemeBundle使用它,可以将以下行添加到config.yml中:

    avanzu_admin_theme:
        use_assetic: false

下一步