avanzu / AdminThemeBundle

Admin Theme based on the AdminLTE Template for easy integration into symfony
MIT License
281 stars 149 forks source link

Unable to find template "AvanzuAdminThemeBundle::layout::default-layout.html.twig" (looked into... #192

Closed lukasz-yasecure closed 6 years ago

lukasz-yasecure commented 6 years ago

Hi there. I tried to install AdminThemeBundle, I have Win10 OS. When I want to start using Bundle using command from: https://github.com/avanzu/AdminThemeBundle/blob/master/Resources/docs/layout.md {% extends 'AvanzuAdminThemeBundle:layout:default-layout.html.twig' %}

I get

Unable to find template "AvanzuAdminThemeBundle:layout:default-layout.html.twig" (looked into: C:\xampp\htdocs\s3pg\app/Resources/views, C:\xampp\htdocs\s3pg\vendor\symfony\symfony\src\Symfony\Bridge\Twig/Resources/views/Form) in ltest\ltest.html.twig at line 1.

I tried to call template in other way but with no result. I was looking for file default-layout.html.twig in directory of vendor AvanzuAdminThemeBundle but there is no such file.

I did installation by steps from https://github.com/avanzu/AdminThemeBundle

Kind regards, Lukasz

Debug info

Component Version
Symfony version 3.3.10
AdminThemeBundle the newest
lukasz-yasecure commented 6 years ago

OK, the problem is in instruction. There is no "default-layout.html.twig", the right name is "base-layout.html.twig". Now I can see rendered something:

image

I try to bin/console avanzu:admin:build-assets but every line starts with "/usr/bin/env" so of course System couldn't find files (I use Windows). Where can I set proper path?

lukasz-yasecure commented 6 years ago

I found hard coded unix paths here: BuildAssetsCommand.php

->addOption('uglifyjs-bin',false, InputOption::VALUE_OPTIONAL, 'uglifyjs binary', '/usr/bin/env uglifyjs') ->addOption('uglifycss-bin', false, InputOption::VALUE_OPTIONAL, 'uglifycss binary', '/usr/bin/env uglifycss')

So I modified that to:

->addOption('uglifyjs-bin',false, InputOption::VALUE_OPTIONAL, 'uglifyjs binary', 'uglifyjs') ->addOption('uglifycss-bin', false, InputOption::VALUE_OPTIONAL, 'uglifycss binary', 'uglifycss')

and then I can build assets without errors, but still screen is the same as on the image up.

shakaran commented 6 years ago

@lukasz-yasecure The default-layout file is present in the repo

https://github.com/avanzu/AdminThemeBundle/blob/master/Resources/views/layout/default-layout.html.twig

Same as other layouts files:

https://github.com/avanzu/AdminThemeBundle/tree/master/Resources/views/layout

The command allow as parameter "uglifyjs-bin" and "uglifycss-bin" that you can use in windows. For example:

php bin/console avanzu:admin:build-assets --uglifyjs-bin="your_path" --uglifycss-bin="your_path"

lukasz-yasecure commented 6 years ago

Right... I see this file in repo so why composer didn't copy the file to my project? I did installation three times looking for solution and that's weird. I will probably diff the repo with files installed via composer or do clone this repo instead of installing via composer.

shakaran commented 6 years ago

@lukasz-yasecure take in mind that probably this bundle doesn't have full support under windows, I recommend you use Linux instead. But I push a change, to detect the OS version, so you will not have to change the binary if it is uglifyjs.exe or uglifycss.exe.

About the missing files when you fetch via composer, I don't know, probably you should debug the composer installation, not sure if composer has the support fully in windows.

shakaran commented 6 years ago

@lukasz-yasecure any update about this? Did my answers resolve your issue? Let me know for help you again or close the issue if totally fixed. Thanks

dekamaru commented 6 years ago

Can't find default-layout in my project, after installation by your tutorial. Symfony - last version Bundle - last version

shakaran commented 6 years ago

@dekamaru please check your repository cloned in your local, the file is present in the github repository https://github.com/avanzu/AdminThemeBundle/blob/master/Resources/views/layout/default-layout.html.twig

dekamaru commented 6 years ago

@shakaran Do php composer.phar require avanzu/admin-theme-bundle in any directory, and you will see default-layout file does not exist in vendor/avazu/admin-theme-bundle/Resources/views.

shakaran commented 6 years ago

@dekamaru if you use that:

composer require avanzu/admin-theme-bundle

Or

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

You are requesting the stable version, which is 1.3, see in composer output that says:

Using version ^1.3 for avanzu/admin-theme-bundle

For install dev-master with default-layout.html.twig file, you need:

composer require avanzu/admin-theme-bundle dev-master

Or

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

dekamaru commented 6 years ago

@shakaran i think it's solve my problem but fix section Using the layout and append warning with default-layout only in dev-master branch

shakaran commented 6 years ago

@dekamaru ok, thanks for point the real problem in docs, I just update with a note in https://github.com/avanzu/AdminThemeBundle/commit/a599caaa30709089509ed151c7ff7d3058964b46 I will close this issue then, since original reporter should also be fixed with his issue. Please reopen or comment if anyone has the same problem. Thanks!

dekamaru commented 6 years ago

@shakaran i found few miss info about installation process. If you using default-layout in dev-master branch, you must init assets with command admin:initialize to create theme directory with assets in web. All points about assets install in tutorial not working, command hard copy assets to web/theme directory. admin:initialize --symlink not working because it can't create directory with this message:

Trying to install theme assets as absolute symbolic links.
 installing bootstrap

  [Symfony\Component\Filesystem\Exception\IOException]  
  Failed to create "web/theme/bootstrap"           

Mini-tutorial for new users of Admin-theme-bundle:

  1. composer require with dev-branch
  2. avanzu:admin:initialize to copy assets
  3. extend the default-layout.twig to go
lukasz-yasecure commented 6 years ago

@shakaran My problems were about installing ^1.3, the same issues described by @dekamaru I tried one more time and I rendered layout with success. Thanks! Big thanks for @dekamaru - your mini-tutorial helps me a lot.

saamorim commented 6 years ago

Hi @shakaran . In symfony 3.4.3 I've tried using the theme and I'm encountering the same problem. Tried with both dev-master and stable. Event tried changing to the new reference format @Bundle/view/layout.html.twig but without success. It just doesn't seem to try finding in the bundle directory.

Can you help? Thank you

With the old style

Unable to find template "AvanzuAdminThemeBundle:layout:default-layout.html.twig" (looked into: /home/saamorim/Development/barcodereader/webportal/app/Resources/views, /home/saamorim/Development/barcodereader/webportal/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form) in base.html.twig at line 1

With the new style

There are no registered paths for namespace "AvanzuAdminThemeBundle" in base.html.twig at line 1.

etelyatn commented 6 years ago

Hi @saamorim @shakaran I have the same issue with 3.4.3 version. Helps only registration my own namespace, and change all partials to my namespacing: https://symfony.com/doc/current/templating/namespaced_paths.html