4teamwork / ftw.inflator

Plone site setup wizard with content creation and bundle system for predefined configurations.
3 stars 6 forks source link

More documentation about creating an add-on and adding a News Item, Collection and Image #4

Closed pigeonflight closed 11 years ago

pigeonflight commented 11 years ago

Could you include examples of adding a News Item, Collection and Image in your documentation. I see reference to the idea of a File. I've created my first bundle, but it would help to get some of these examples, perhaps a more thorough example of a bundle, it doesn't explicitly say that you need to create your own Plone add-on.

I'm willing to write this, if you point me in the right direction.

jone commented 11 years ago

It would be awesome if you could help us out with some examples. I think we should add an "Examples" section in the readme.

I think creating an image should just work the same way as adding a file. Something like this should work:

    {
        "_path": "path/to/image",
        "_type": "Image",
        "title": "image title",
        "image:file": "files/examplefile.txt"
    }

I've not yet added news items nor collections. The inflator already includes the criterion adder section of plone.app.transmogrifier, so adding collections should already work.

I'm gonna add some tests for images, news items and collections for making sure that it really works :wink:

Recently we've started to develop a policy package (onegov.policy) with the inflator. It is not yet production ready so there are still some issues but it uses bundles and content creation, so you could take a look at it for having some more examples.

jone commented 11 years ago

I've added tests with an Image and a News Item.

I couldn't create a Collection (plone.app.collection) because there is a problem with collections and transmogrifier. I've created an issue » mjpieters/plone.app.transmogrifier#3

pigeonflight commented 11 years ago

Nice!.... will do some testing and see how it goes. Is there a way to add a News Item that includes an image?

jone commented 11 years ago

The News Item has an image field, so you could do something like this:

[
    {"_path": "foo/news-item",
     "_type": "News Item",
     "title": "the title",
     "text": "news item text",
     "image:file": "images/news.jpg"}
]

The path to the image file images/news.jpg is relative to the location of the json file.

pigeonflight commented 11 years ago

This is extremely useful. Beyond sweet!