sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

Sonata admin missing css file #4875

Closed AntonioCS closed 6 years ago

AntonioCS commented 6 years ago

Environment

Sonata packages

sonata-project/admin-bundle              3.30.0 3.30.1          The missing Symfony Admin Generator
sonata-project/block-bundle              3.9.0  3.9.0           Symfony SonataBlockBundle
sonata-project/cache                     1.0.7  1.0.7           Cache library
sonata-project/cache-bundle              2.4.0  2.4.0           This bundle provides caching services
sonata-project/core-bundle               3.8.0  3.8.0           Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.2.1  2.x-dev 826bb09 Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.0.2  1.0.2           Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.3.0  3.3.0           Symfony Sonata / Integrate Doctrine ...
sonata-project/easy-extends-bundle       2.3.0  2.3.0           Symfony SonataEasyExtendsBundle
sonata-project/exporter                  1.8.0  1.8.0           Lightweight Exporter library
sonata-project/notification-bundle       3.2.0  3.3.0           Symfony SonataNotificationBundle
sonata-project/page-bundle               3.7.0  3.7.0           This bundle provides a Site and Page...
sonata-project/seo-bundle                2.4.0  2.4.0           Symfony SonataSeoBundle

Symfony packages

symfony/assetic-bundle     v2.8.2  v2.8.2 Integrates Assetic into Symfony2
symfony/monolog-bundle     v3.1.2  v3.1.2 Symfony MonologBundle
symfony/phpunit-bridge     v3.4.2  v4.0.2 Symfony PHPUnit Bridge
symfony/polyfill-apcu      v1.6.0  v1.6.0 Symfony polyfill backporting apcu_* functions to lower PHP...
symfony/polyfill-intl-icu  v1.6.0  v1.6.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring  v1.6.0  v1.6.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php56     v1.6.0  v1.6.0 Symfony polyfill backporting some PHP 5.6+ features to low...
symfony/polyfill-php70     v1.6.0  v1.6.0 Symfony polyfill backporting some PHP 7.0+ features to low...
symfony/polyfill-util      v1.6.0  v1.6.0 Symfony utilities for portability of PHP codes
symfony/security-acl       v3.0.0  v3.0.0 Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.6.7  v3.0.3 Symfony SwiftmailerBundle
symfony/symfony            v3.3.14 v3.4.2 The Symfony PHP framework

PHP version

PHP 5.6.31-pl0-gentoo

Subject

Css for admin page does not load

I have installed sonata and ran

php app/console assets:install

All resources seems to install correctly but when I go to:

domain/app_dev.php/admin/dashboard

I am presented with this:

screen shot 2018-01-02 at 15 05 20

As you can see from the image all requests load except the one for font-awesome.min.css but the file does not exist anywhere in Sonata.

I also ran

bower install ./vendor/sonata-project/admin-bundle/bower.json

but that didn't fix anything.

What am I missing???

NOTE: In the AdminLTE github project there is no font-awesome.min.css file. You can view the project here: https://github.com/almasaeed2010/AdminLTE/tree/master/dist/css

OskarStark commented 6 years ago

can you please post your sonata_admin: config?

This is how it looks like in my project (using Sonata Admin 3.30.1) and they are located in the core bundle now:

screenshot 2018-01-03 07 18 11

screenshot 2018-01-03 07 19 25

AntonioCS commented 6 years ago

Ok this is a configuration issue. Here is my config:

sonata_admin:
    assets:
        javascripts:
            - bundles/sonataadmin/vendor/jquery/dist/jquery.min.js
            - bundles/sonataadmin/vendor/jquery.scrollTo/jquery.scrollTo.js
            - bundles/sonataadmin/vendor/jqueryui/ui/minified/jquery-ui.min.js
            - bundles/sonataadmin/vendor/jqueryui/ui/minified/i18n/jquery-ui-i18n.min.js
            - bundles/sonatapage/sonata-page.back.min.js
        stylesheets:
            - bundles/sonataadmin/vendor/AdminLTE/css/font-awesome.min.css
            - bundles/sonataadmin/vendor/jqueryui/themes/flick/jquery-ui.min.css
            - bundles/sonatapage/sonata-page.back.min.css

I didn't think to look at the config because I just copied everything from the docs and that piece of config is here: https://sonata-project.org/bundles/page/3-x/doc/reference/installation.html

So can someone please take a look at the docs for Sonata page as this is having implications on other sonata bundles.

OskarStark commented 6 years ago

can you please provide a docs PR? You can finde the file here: https://github.com/sonata-project/SonataPageBundle/blob/3.x/docs/reference/installation.rst

the other files are working fine?

jordisala1991 commented 6 years ago

We should probably use there the new feature from admin bundle where you can add custom js css without overriding all files

AntonioCS commented 6 years ago

As soon as I removed that configuration everything started to work.

What am I suppose to do with the documentation? It's my first time using sonata page, how am I suppose to know what should be there instead of this?

OskarStark commented 6 years ago

Did you removed the whole config part or just this line? And do you still have font awesome icons in your browser?

As is found out it looks like the asset was moved from admin to core bundle, so the path needs to be changed like this:

- bundles/sonataadmin/vendor/AdminLTE/css/font-awesome.min.css
+ bundles/sonatacore/vendor/components-font-awesome/css/font-awesome.min.css

does the config works when you only change this line?

AntonioCS commented 6 years ago

No, I get back the same layout. I have no errors in the Network tab but I see a page without css.

AntonioCS commented 6 years ago

I can leave the javascripts section but I had to remove all of the stylesheets section for the page to work.

OskarStark commented 6 years ago

I have no errors in the Network tab but I see a page without css.

ok, so you need to put that config back and execute bin/console assets:install

to add the assets for the page bundle, please try this out:

sonata_admin:
     assets:
         extra_stylesheets:
            - bundles/sonatapage/sonata-page.back.min.css
         extra_javascripts:
            - bundles/sonatapage/sonata-page.back.min.js   

the other assets from the docs should be loaded and merged automatically

AntonioCS commented 6 years ago

I did the assets:install and still the page does not load right. Here is what I have now:

sonata_admin:
    assets:
        javascripts:
            - bundles/sonataadmin/vendor/jquery/dist/jquery.min.js
            - bundles/sonataadmin/vendor/jquery.scrollTo/jquery.scrollTo.js
            - bundles/sonataadmin/vendor/jqueryui/ui/minified/jquery-ui.min.js
            - bundles/sonataadmin/vendor/jqueryui/ui/minified/i18n/jquery-ui-i18n.min.js
            - bundles/sonatapage/sonata-page.back.min.js
        stylesheets:
            - bundles/sonatacore/vendor/components-font-awesome/css/font-awesome.min.css
            - bundles/sonataadmin/vendor/jqueryui/themes/flick/jquery-ui.min.css
            - bundles/sonatapage/sonata-page.back.min.css
        extra_stylesheets:
            - bundles/sonatapage/sonata-page.back.min.css
        extra_javascripts:
            - bundles/sonatapage/sonata-page.back.min.js
jordisala1991 commented 6 years ago

remove all this:

        javascripts:
            - bundles/sonataadmin/vendor/jquery/dist/jquery.min.js
            - bundles/sonataadmin/vendor/jquery.scrollTo/jquery.scrollTo.js
            - bundles/sonataadmin/vendor/jqueryui/ui/minified/jquery-ui.min.js
            - bundles/sonataadmin/vendor/jqueryui/ui/minified/i18n/jquery-ui-i18n.min.js
            - bundles/sonatapage/sonata-page.back.min.js
        stylesheets:
            - bundles/sonatacore/vendor/components-font-awesome/css/font-awesome.min.css
            - bundles/sonataadmin/vendor/jqueryui/themes/flick/jquery-ui.min.css
            - bundles/sonatapage/sonata-page.back.min.css
AntonioCS commented 6 years ago

Yes! That seems to work out great. Now I am seeing the pages page with the proper css being loaded (like in the sonata demo).

Thanks!

OskarStark commented 6 years ago

Great, can you replace that part of the docs with your part? This is everything you need to do for sonata page 👍

OskarStark commented 6 years ago

Please don't close this, as we first need to fix the docs

AntonioCS commented 6 years ago

Right, sorry. Fixing the docs will have to be delegated :)

OskarStark commented 6 years ago

Fixing the docs will have to be delegated :)

what do you mean by that?

AntonioCS commented 6 years ago

Great, can you replace that part of the docs with your part? This is everything you need to do for sonata page 👍

This will have to be delegated to someone.

OskarStark commented 6 years ago

This will have to be delegated to someone.

Ah that means you won't do it? Or do I missunderstood sth.?

AntonioCS commented 6 years ago

You are correct. I am on my work machine I don't have my github key credentials and now that I have finally fixed this issue I have to make up for the day I lost yesterday trying to fix this.

OskarStark commented 6 years ago

This could be done via the github.com website and the "edit" button 😆 🤣

Anyway you said "Thanks" at least and this is much more than in your last issue ☝️ 👏

silasjoisten commented 6 years ago

🤦‍♂️ Done in 1 min https://github.com/sonata-project/SonataPageBundle/pull/939

OskarStark commented 6 years ago

Great, thank you @silasjoisten 🎉

AntonioCS commented 6 years ago

I didn't know that.

AntonioCS commented 6 years ago

Thought I had to fork, clone to my machine, change, create PR

OskarStark commented 6 years ago

Thought I had to fork, clone to my machine, change, create PR

Next time you could ask and we are here for helping you out, with your issue, creating PR's and so on, but saying "No" is a bad attitude

AntonioCS commented 6 years ago

Right 👍