Giter Site home page Giter Site logo

yii2-adminlte-asset's Introduction

AdminLTE Asset Bundle

Latest Stable Version Total Downloads License

Backend UI for Yii2 Framework, based on AdminLTE

"Yii2 AdminLTE Presentation"

This package contains an Asset Bundle for Yii 2.0 Framework which registers the CSS files for the AdminLTE user-interface.

The CSS files are installed via Yii's recommended usage of the fxp/composer-asset-plugin v1.1.1 or later.

Installation

The preferred way to install this extension is through composer.

To install AdminLTE v2 run:

composer require dmstr/yii2-adminlte-asset "^2.1"

To install AdminLTE v1 run:

composer require dmstr/yii2-adminlte-asset "^1"

FAQ

Web-font usage

AdminLTE dropped web-font inclusion in 2.4.0, so you need to include your desired font manually, ie.

<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">

Inclusion via CDN is not recommended for production, please adjust this to your project's asset-bundling workflow.

For details see #140.

Upgrading

When upgrading please see the AdminLTE upgrade guide for adjustments you need to make in your views.

Composer installation

  • For issues with DmitryBaranovskiy/eve.git, please see #128 and #113.

Compatibility matrix

yii2-adminlte-asset AdminLTE Font Awesome
2.4 2.0 - 2.3 required
2.5 2.4 required
3.0 2.4 -

For other issues, please search GitHub first.

Quick Start

Once the extension is installed, you can have a preview by reconfiguring the path mappings of the view component:

For Yii 2 Advanced Application Template or Basic Application Template

'components' => [
    'view' => [
         'theme' => [
             'pathMap' => [
                '@app/views' => '@vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app'
             ],
         ],
    ],
],

For phd5 application

'components' => [
    'view' => [
        'theme' => [
            'pathMap' => [
                '@app/views' => '@vendor/dmstr/yii2-adminlte-asset/example-views/testing/app'
            ],
        ],
    ],
],

This asset bundle provides sample files for layout and view (see folder examples/), they are not meant to be customized directly in the vendor/ folder.

Therefore it is recommended to copy the views into your application and adjust them to your needs.

Customization

  • Copy files from vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app (or other theme) to @app/views.
  • Remove the custom view configuration from your application by deleting the path mappings, if you have made them before.
  • Edit your views adhering to html markup vendor/almasaeed2010/adminlte/pages

AdminLTE Plugins

Assets for AdminLTE plugins are not included in our AdminLteAsset but you can find these files in your vendor directory under vendor/almasaeed2010/adminlte/plugins. So if you want to use any of them we recommend to create a custom bundle where you list the plugin files you need:

use yii\web\AssetBundle;
class AdminLtePluginAsset extends AssetBundle
{
    public $sourcePath = '@vendor/almasaeed2010/adminlte/plugins';
    public $css = [
        'chart.js/Chart.min.css',
        // more plugin CSS here
    ];
    public $js = [
        'chart.js/Chart.bundle.min.js'
        // more plugin Js here
    ];
    public $depends = [
        'dmstr\adminlte\web\AdminLteAsset',
    ];
}

As this asset depends on our AdminLteAsset it's the only asset you have to register, for example in your main.php layout file.

Custom content header

If you want to use native DOM of headers AdminLTE

<h1>
    About <small>static page</small>
</h1>

then you can follow the code:

/* @var yii\web\View $this */

$this->params['breadcrumbs'][] = 'About';

$this->beginBlock('content-header'); ?>
About <small>static page</small>
<?php $this->endBlock(); ?>

<div class="site-about">
    <p> This is the About page. You may modify the following file to customize its content: </p>
    <code><?= __FILE__ ?></code>
</div>

Left sidebar menu - Widget Menu

If you need to separate sections of the menu then just add the header option to item in items

    'items' => [
        ['label' => 'Gii', 'iconType' => 'far' 'icon' => 'file-code', 'url' => ['/gii']],
        ['label' => 'Debug', 'icon' => 'dashboard-alt', 'url' => ['/debug']],
        ['label' => 'MAIN NAVIGATION', 'header' => true], // here
        // ... a group items
        ['label' => '', 'header' => true],
        // ... a group items
        ['label' => '', 'header' => true],
        // ... a group items

To add a badge for a item:

'items' => [
    [
        'label' => 'Mailbox',
        'iconType' => 'far',
        'icon' => 'envelope',
        'url' => ['/mailbox'],
        'badge' => '<span class="badge badge-info right">123</span>'
    ],
]

By default to icons will be added prefix of Font Awesome

Template for Gii CRUD generator

Tell Gii about our template. The setting is made in the config file:

if (YII_ENV_DEV) {
    $config['modules']['gii'] = [
        'class' => 'yii\gii\Module',
        'generators' => [ // HERE
            'crud' => [
                'class' => 'yii\gii\generators\crud\Generator',
                'templates' => [
                    'adminlte' => '@vendor/dmstr/yii2-adminlte-asset/gii/templates/crud/simple',
                ]
            ]
        ],
    ];
}

Testing

Go to the tests folder and start the testing stack

cd tests
docker-compose up -d

Install yii2-adminlte-asset in the testing application

docker-compose exec php composer install

Open testing URLs in your browser

http://docker.local:20580/test
http://docker.local:20580/test/login    

Further Information

For AdminLTE documentation, please read https://almsaeedstudio.com/themes/AdminLTE/documentation/index.html

Namespacing rules follow the Yii 2.0 framework structure, eg. dmstr\adminlte\web for the Asset Bundle.

yii2-adminlte-asset's People

Contributors

bscheshirwork avatar chofoteddy avatar dependabot[bot] avatar derekisbusy avatar faryshta avatar freezy-sk avatar githubjeka avatar kongoon avatar konrad90 avatar kvush avatar marc7000 avatar mazurva avatar mikehaertl avatar pa3py6aka avatar ramzyvirani avatar robwent avatar sashsvamir avatar schmunk42 avatar scops avatar sonoradoddb avatar tarinu avatar turbo8p avatar yuyangame avatar zertex avatar zzzaaa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2-adminlte-asset's Issues

Depend on BootstrapAsset

Perhaps we need to register 'yii\bootstrap\BootstrapAsset', in out AdminLteAsset.php ?

Related #59 login page problem

Error when installing with composer

When starting with a complete fresh installation (Yii2 framework), composer gives me the following error when I install adminlte (an error which I don't understand, so I have no idea how to fix it).

Error in composer:
[InvalidArgumentException]
No driver found to handle Asset VCS repository http://omnipotent.net/jquery.sparkline/2.1.2/jquery.sparkline.min.js

The install command I issue is: composer require --prefer-dist dmstr/yii2-adminlte-asset "*"

I hope that you can shed some light on this issue.

kind regards,
Rob Mies

Error when install via composer

Problem 1
- Installation request for dmstr/yii2-adminlte-asset * -> satisfiable by dmstr/yii2-adminlte-asset[0.1.0].
- dmstr/yii2-adminlte-asset 0.1.0 requires bower-asset/admin-lte * -> no matching package found.

It work on mac. but not in server ubuntu @@

plugins assets

adminlte include several plugins and those are not included on the dmstr\web\AdminLteAsset asset class.

the best way to load those plugins is to make an asset for each of them, for example

class ICheckAsset extends AssetBundle
{
    public $sourcePath = '@bower/admin-lte/plugins/iCheck';
    public $css = [
        'all.css'       
    ];
    public $js = [
        'icheck.min.js'
    ];
    public $depends = [
        'dmstr\web\AdminLteAsset',
    ];
}

getting error

getting Undefined index: appName error

in C:\wamp\www\yii2-advanced-api\vendor\dmstr\yii2-adminlte-asset\phundament4\layouts\main.php
error

Composer

when i tried to intall im getting this message

[UnexpectedValueException]
Could not parse version constraint <=2.: Invalid version string "2."

i'v already updated composer "selfupdate"

login page problem

Hello,

The dashboard is ok in my yii2 app but i have a problem with the login page. I think they can load the necessary asset css or js because i can see the icon or the style of the normal login page.
Could you explain me the procedure to have a correct login page ?
Do i use the $this->layout = '//main-login' ? i dont understant where i put it ...

BR,
Thank you

Yii1 ??

Do you have the way to make the same for yii1?

adminlt v2

Hello.

I've just tried to install the v2 version of adminlte but the default page doesn't seems to be fine.

Double scroll bar

Using current stable version.

All pages display a double scroll bar on the right. There appears to be an element with overflow:auto.

How can this be removed?

Problems with IE 11, Yii2 and AdminLTE

Dear all

First and foremost, good work on the template! I just have one issue, which I cannot seem to resolve: my layout gets all messed up in IE 11. Do you have the same problems?

Kind regards

Plugins in admilte charts

Hi!.. I have trouble in integrating the plugins here under vendor\almasaeed2010\adminlte\plugins like charts.. Im ok about using the adminLTE skins co'z of this Yii::$app->assetManager->getPublishedUrl('@vendor/almasaeed2010/adminlte/dist'); now how to declare the plugins under the @vendor/almasaeed2010/adminlte/plugins?

Get fonts.googleapis.com TIME_OUT

I can't connect to fonts.googleapis.com

so I want to know how I remove

  @import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic);

from adminLTE.min.css

Need to create universal example for yii-app.

@schmunk42
basic example is same as advanced example, except

backend\assets\AppAsset::register($this); //advanced
app\assets\AppAsset::register($this); //basic

it can be replace to

if (class_exists('backend\assets\AppAsset')) {
    backend\assets\AppAsset::register($this);
    } else {
      app\assets\AppAsset::register($this);
      }

Now basic use vesion 1.x admin-lte. I try to used for basic app

'view' => [
             'theme' => [
                 'pathMap' => [
                    '@app/views' => '@vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-advanced-app'
                 ],
             ],
        ],
 "dmstr/yii2-adminlte-asset": "2.*"

It works.

Therefore we can delete basic and advanced expamples and create a universal.
But how to be with backward compatible? Need a new version :)

Class 'dmstr\web\AdminLteAsset' not found

On windows XAMPP I got this. On Debian works fine the same code
Any ideas?

My code:
`
use yii\helpers\Html;
use dmstr\web\AdminLteAsset as AdminLteAsset;

/* @var $this \yii\web\View /
/
@var $content string */

if (Yii::$app->controller->action->id === 'login') {
/**

  • Do not use this code in your template. Remove it.

  • Instead, use the code $this->layout = '//main-login'; in your controller.
    */
    echo $this->render(
    'main-login',
    ['content' => $content]
    );
    } else {

    if (class_exists('backend\assets\AppAsset')) {
    backend\assets\AppAsset::register($this);
    } else {
    app\assets\AppAsset::register($this);
    }
    AdminLteAsset::register($this);`

Menu widget - isItemActive buggy

Hello.

I've two url :
/frontend/web/index.php/individual/manage
/frontend/web/index.php/individual/upload

$items [] = ['label' => Yii::t('app','Register Car'), 'url' => ['individual/upload']];
$items [] = ['label' => Yii::t('app','Manage Cars'), 'url' => ['individual/manage']];

echo  dmstr\widgets\Menu::widget(
            [
                'options' => ['class' => 'sidebar-menu'],
                'items' => $items,
            ]
);

No matter which one i click both of them 'li' has the active tag on. I've deleted the complete isItemActive method, now its working fine.
#61

double vertical scrollbar

I use yii2 basic application and adminlte theme.
As soon as the page became longer a double vertical scroolbar appear.
One is from the windows container (which is correct), but another seem from the body container.
The one from the body prevent you to use the mouse wheel to scroll efficiently.
In plus when the body scroll the header get detached from the left menu.
I think is some problem with the javascrpt assets.

AdminLte Ver 1 - Links are brocken

Thanks for the nice theme
I have tried to install version 1 but all the links are broken and and the layout is a bit messed up.
It seems the required files are not generated in the assets folder. I have tried to run the command composer global require "fxp/composer-asset-plugin:1.0.0" and re-install again theme still there are brocken links.

Menu docs

Could we get some additional docs on the menu widget?

It is usable, but it would be nice to get a better idea of what can be done with it.

For example, i would like to put some horizontal bars in the menu to seperate sections of the menu.

Thanks! Great work!
-John

namespace

I am working on a PR right now and i noticed there is an issue with the namespace.

Right now the namespace for the AdminLteAsset class is dmstr\web and the PSR 2 specifies that the namespace should start with vendor\package

So I think we need to change it to

namespace dmstr\adminlte\assets;

For the assets and

namespace dmstr\adminlte\widgets;

For widgets. Specially since the dmstrvendor has already many packages and most of them contains assets or widgets.

Some newbie issues with AdminLTE Asset Bundle

I recently (a couple of days ago) downloaded the AdminLTE Asset Bundle for usage with Yii2 Advanced, by adding the following line to composer.json: "dmstr/yii2-adminlte-asset": "2.*@beta"

After it was done downloading and installing, I copied the layout files from vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-advanced-app/layouts/ into my frontend/views/layouts/ folder (and modified the main.php layout file to point to frontend instead of backend).

I then created a new, blank index.php view page and setup a controller action for it.

When loading up the new page, I see the adminLte layout (with "blue skin"), but I have some issues that I have been unable to solve, and could use some assistance with.

Issue 1: The "left.php" layout file contains a basic menu setup through a Nav widget. When I tried to add a submenu to one of the entries in this basic menu, they were added to the page as a "dropdown" toggle, and not as an "accordion" as seen in the example/demo pages included with adminLTE. I tried manually adding classes "treeview" and "treeview-menu" to the menu entries, but that just resulted in the submenu items no longer showing up at all. Is there an example of a simple Nav widget menu setup with submenus? Here's how I tried to do it:

        Nav::widget(
            [
                'encodeLabels' => false,
                'options' => ['class' => 'sidebar-menu'],
                'items' => [
                    [
                        'label' => 'Menu Header',
                        'url' => '#',
                        'options'=>['class'=>'header']
                    ],
                    ['label' => '<span class="fa fa-circle-o"></span> Menu Entry', 'url' => ['/contacts']],
                    ['label' => '<span class="fa fa-circle-o"></span> Menu Entry', 'url' => ['/projects']],
                    ['label' => '<span class="fa fa-circle-o"></span> Menu With Submenu',
                        'options' => ['class' => 'treeview'],
                        'items' => [
                            ['label' => '<span class="fa fa-file-code-o"></span> SubMenu Entry', 'linkOptions' => ['class' => 'treeview-menu'], 'url' => ['/news']],
                            ['label' => '<span class="fa fa-file-code-o"></span> SubMenu Entry', 'linkOptions' => ['class' => 'treeview-menu'], 'url' => ['/articles']],
                        ]],
                    ['label' => '<span class="fa fa-file-code-o"></span> Gii', 'url' => ['/gii']],
                    ['label' => '<span class="fa fa-dashboard"></span> Debug', 'url' => ['/debug']],
                ],
            ]
        );

See attached image adminlte-01.jpg to see how it looks.

Issue 1b: Not sure if this is related to issue 1, but when I hover over menu items that have class "header", the hover effect doesn't extend to the complete width of the sidebar menu like it does with the other menu items. See attached image adminlte-02.jpg.

Issue 2: The footer on my new, blank page, doesn't extend across the entire page, but leaves a gap between the footer and the collapsable sidebar on the left. If I collapse the menu, the footer extends all the way as it should, but if I toggle it back open, the footer is pushed so far to the right there would be enough space for a second sidebar inbetween it and the existing sidebar. No idea what's causing this. :/ See attached image adminlte-03.jpg

Issue 3: The example images (like profile image) that come with the demo-setup aren't showing up. Checked source, and they seem to point to a web/assets/ folder that doesn't exist. I tried to preview the quick example by modifying theme view path in main config, too, but the images still don't show up. All the images currently reside in the vendor/bower/admin-lte/dist/img/ folder.

I'm including some images to illustrate the problems, and hope someone can help me out :/
adminlte-01
adminlte-02
adminlte-03

Wrong package namespace

Hi
What about changing this package to follow best practice in package namespacing and following rule VendorName\PackageName\ClassName?
Of course this will be a breaking change, so package version should be bumped to 3.0.
I you agree, I can make PR.

Break css of body class

return $bundle->skin;

 public static function skinClass()
    {
        /** @var \dmstr\web\AdminLteAsset $bundle */
        $bundle = Yii::$app->assetManager->getBundle('dmstr\web\AdminLteAsset');
        return $bundle->skin;
    }

When $bundle->skin is _all-skins by default then skinClass() return wrong css of body class.

Need return correct css class, e.g. skin-black

Unable to install version2 through composer. Getting rmrevin/yii2-fontawesome Invalid version string "v4.1.*"

Hi,

I'm trying to install version 2 through composer but getting this error

g:\projects\WebApp>composer require dmstr/yii2-adminlte-asset "2.*"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)



  [RuntimeException]
  Could not load package rmrevin/yii2-fontawesome in http://packagist.org: [UnexpectedValueException] Could not parse version constraint v4.1.*:
   Invalid version string "v4.1.*"

  [UnexpectedValueException]
  Could not parse version constraint v4.1.*: Invalid version string "v4.1.*"
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [packages1] ... [packagesN]

How to get yii2-adminlte-asset installed?

Add {linkOptions} to template

public $linkTemplate = '<a href="{url}"{linkOptions}>{icon} {label}</a>';

so that it could be possible to add target="_blank"

Composer install Error

[RuntimeException]
Could not load package rmrevin/yii2-fontawesome in http://packagist.org: [UnexpectedValueException] Could not parse version constraint v4.1.: Invalid version string "v4.1.
"

[UnexpectedValueException]
Could not parse version constraint v4.1.: Invalid version string "v4.1."

Array to string conversion

I've been using your excellent extension for quite a while with no problems at all. Suddenly, I'm getting an array to string notice
adminlte_arrary2string
Any ideas on how I can get rid of this? I don't need to worry about translations and such because this is in a purely administrative area of my Web site.

Accidently updated to v2

I previously installed v1 with composer. and yesterday i executed composer update. now its updated to v2 and the template is messed up (screenshot below). Can you please tell me the steps how to fix it?

image

RTL support

I want to know if your template supports right to left layout ?

Version 1.* not working

when installing version 1.* in composer i get the following error:

Your requirements could not be resolved to an installable set of packages.

Problem 1
- dmstr/yii2-adminlte-asset 1.0.x-dev requires bower-asset/admin-lte ~1.3 -> no matching package found.
- dmstr/yii2-adminlte-asset 1.0.0 requires bower-asset/admin-lte ~1.3 -> no matching package found.
- Installation request for dmstr/yii2-adminlte-asset 1.* -> satisfiable by dmstr/yii2-adminlte-asset[1.0.0, 1.0.x-dev].

Is there any way to fix this?

skin config not working

Following the documention, the code to change skin:

'components' => [
    'assetManager' => [
        'bundles' => [
            'dmstr\web\AdminLteAsset' => [
                'skin' => 'skin-black',
            ],
        ],
    ],
],

Returns the following error:

Unknown Property โ€“ yii\base\UnknownPropertyException

Setting unknown property: dmstr\web\AdminLteAsset::skin

Can't resolve the dependency

Excuse me, when will be a release ready? I seem to not be able to install it through composer due to the lack of one.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.