Is \resources\views\asgard\user\ structured tied in any way to a Theme?



  • I was wondering if those resources are theme-dependant or not.

    I mean, in order to modify Login views, can I modify directly those views? Or my changes will be lost in the next composer-update ?

    I'm a bit confused about which part of the views are the Theme itself, and which part is Asgard views, which stuff will be lost if I update and which won't...

    Can someone shed some light? thanks!


  • Global Moderator

    @zedee

    Everything in resources/views/asgard/user will not be overwritten on composer update, php artisan module:publish, php artisan vendor:publish --provider="Modules\User\Providers\UserServiceProvider".
    Actually everytime you do composer update it will run php artisan module:publish which is pingpong modules way of publishing Assets folder.

    It's pretty safe based on current implementation to edit resources/views/asgard/users folder. Well if you do vendor:publish --force then it will override :D



  • @armababy

    Fantastic, so this brings me another battery of questions:

    • Why do this views are here, and not on the theme?
    • Can be those views be overriden by the new theme instead of touching them directly?
    • Are these views part of the core CMS and meant to be there?

    Sorry if I seem fool and sloppy about this...


  • Global Moderator

    @zedee

    Out of the box there is no way to override those views in your theme.
    Well i guess it's because nWidart created Users service provider like so:

            $this->publishes([
                __DIR__ . '/../Resources/views' => base_path('resources/views/asgard/user'),
            ]);
            $this->loadViewsFrom(base_path('resources/views/asgard/user'), 'user');
            $this->loadViewsFrom(__DIR__ . '/../Resources/views', 'user');
    

    It's most likely like that because frontend theme is stored in database and so on.
    Theoretically you could go and get theme name from database and use that to know what's current active theme and add theme path to ->loadViewsFrom.

    Might be potential pull request for User module.



  • @armababy

    Yep, that would be a potential pull request.

    If I'm able to find my way through this, I'll try to do so!

    Basically, the core of my question was something like: if the CMS is theme based, what are those views functionality/meaning outside of the theme? Shouldn't be absolutely all the views into a theme?

    But I get the point! I'll try to update the results of my inquiries


  • Global Moderator

    @zedee

    Yeah i guess you would change it something like this:

        public function boot(Setting $setting)
        {
            $this->registerMiddleware($this->app['router']);
    
            $this->publishes([
                __DIR__ . '/../Resources/views' => base_path('resources/views/asgard/user'),
            ]);
    
            $this->loadViewsFrom(base_path('Themes/'.$setting->get('core::template').'/views/modules/user'), 'user');
            $this->loadViewsFrom(base_path('resources/views/asgard/user'), 'user');
            $this->loadViewsFrom(__DIR__ . '/../Resources/views', 'user');
         }
    

    Maybe do some more checks if theme exists or something. Also it would be non BC. And improve any future personal module view styling, so you can ship theme in 1 go.


Log in to reply
 

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.