Gottwik / enduro_admin

Admin interface for Enduro.js

Home Page:http://www.endurojs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Separating content files

karneaud opened this issue · comments

I'm developing a one page website using enduro was wondering. Can you have multiple content files for one page?

You can put content files in the cms/global directory and it will be accessible to your page and provide separation for enduro admin.

Does it make sense?

No. Was hoping to break a single page's contents into smaller files instead of having one long content file

Yea, I understood that. It's a smart idea to structure the content. You can put as many files in whichever folder structure you like into cms/global and all of the files(regardless of the actual folder structure) will be merged and provided as context under global.

The context files will extend onto each other, so you can even have two files that will define the same object:

/cms/global/car/steering.js
{
    car: {
        has_steering_wheel: true
    }
}

/cms/global/car/wheels.js
{
    car: {
        number_of_wheels: 4
    }
}

In your template you will just be able to do: {{car.has_steering_wheel}} and also {{car.number_of_wheels}}

Don't forget that the folder structure only affects how it's displayed in the admin interface. It doesn't affect the context passed into the templates.