austintoddj / canvas

Publishing on your own terms
http://trycanvas.app
MIT License
3.26k stars 521 forks source link

Views, and Controller Overrides #290

Closed dlopez closed 7 years ago

dlopez commented 7 years ago

I've installed canvas, and wanted to customize certain views and add functionality to the posting. But after running the php artisan canvas:install command, and setting everything up. I didn't see the library clone over the built in views, controllers, etc. Was this supposed to happen? If not, then I have some questions.

PatrickJoannisse commented 7 years ago

If I understand your question properly, when you install canvas using the command line, you are simply running an install wizard that will get some inputs (it'll ask you for an email, a password and some other details) and configure your blog. It creates the config/blog.php file, and adds the info to the database. To autoload will simply refer to the vendor files without needing to clone anything.

On how to customize the built-in views and create a theme, however, I'm still trying to figure it out. I noticed that for creating your own theme and having it picked up automatically, it needs to be located in the vendor/cnvs folder and be prefixed canvas-theme. I'm really not sure about this. I'd like to see this handled differently to be honest.

austintoddj commented 7 years ago

Good questions @dlopez @PatrickJoannisse. You're pretty spot-on with the description of what is going on in the backend during the installation.

As far as themes are concerned, right now they are kept in the cnvs organization repo, added to Packagist from there by me, and then you'd be able to require them and start using one. Definitely open to other ways of doing it if you guys want to suggest some.

reliq commented 7 years ago

@dlopez Canvas views and controllers are loaded from the core package (Easel) [/vendor/cnvs/easel/], this is the correct behavior.

reliq commented 7 years ago

@PatrickJoannisse anyone can create a canvas theme. Its composer.json needs 2 special properties to be picked up automatically as a canvas theme:

Example composer.json:

{
    "name": "someone/mytheme",
    "description": "Theme for Canvas.",
    "keywords": ["canvas", "theme"],
    "type": "canvas-theme",
    "license": "MIT",
    "authors": [
        {
            "name": "Someone",
            "email": "someone@some.site"
        }
    ],
    "extra": {
        "canvas-theme": {
            "title": "MyTheme",
            "directories": {
                "public": "public",
                "views": "resources/views"
            }
        }
    }
}

You may use the following repository as a starting point to create your theme: https://github.com/cnvs/canvas-theme-paper

Official theme documentation is coming soon...

PatrickJoannisse commented 7 years ago

@reliq Thanks for the quick breakdown of how to create a theme. Definitely, the documentation would help. We all hate writing it but I guess somebody has to ;)

reliq commented 7 years ago

You're welcome @PatrickJoannisse. It's coming soon 😸


See: https://cnvs.readme.io/v3.0/docs/theme-development