Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide default_page and layout properties in content GET #411

Open
buchi opened this issue Oct 21, 2017 · 15 comments
Open

Provide default_page and layout properties in content GET #411

buchi opened this issue Oct 21, 2017 · 15 comments

Comments

@buchi
Copy link
Member

buchi commented Oct 21, 2017

Needed to be able to render the default page or the correct view in the frontend.

Example:

{
    "@id": "http://localhost:8080/Plone",
    "@type": "Plone Site",
    "default_page": "http://localhost:8080/Plone/front-page",
    ...
}

or make it an expandable component?

{
    "@id": "http://localhost:8080/Plone",
    "@type": "Plone Site",
    "@components": {
        "properties": {
            "@id": "http://localhost:8080/Plone/@properties",
            "items": [
                 "default_page": "http://localhost:8080/Plone/front-page"
            ]
        },
    ...
}

See also #126

@tisto @sneridagh @ebrehault opinions?

@robgietema
Copy link
Member

I really dislike the whole default_page method it confuses end users. I suggest we will go for collective.folderishtypes which makes a lot more sense. see also #427

@davisagli
Copy link
Member

Personally I think that while default pages are a bit confusing, they have their uses. In a world with default pages, an editor can prepare a major edit of a section landing page as a separate page, and then easily activate it. In a world without default pages they would need to move the entire subtree into the new landing page, delete the old one, and rename the new one. The 1st and 3rd operations would take a lot of time with a big subtree, and there would be some time in between where the landing page is missing.

Anyway, this probably isn't the best place to have that argument. In our current world where default pages exist, it would be useful to have that info in the API.

@datakurre
Copy link
Member

How about portal root?

@zopyx
Copy link
Member

zopyx commented Jun 19, 2018

Like default pages or dislike them..they are a core feature of Plone and in some case you need to use them and therefore they should have some support in the REST API - meanwhile I wrote my own endpoint inside my provisioning API.

@wobsta
Copy link

wobsta commented Jul 24, 2018

@zopyx Could you share some code you created to access the default_page property of a folder? I'm in need to set this property once per folder (nothing else at the moment) in some import code I'm working on ...

@wobsta
Copy link

wobsta commented Jul 27, 2018

While trying to implement something to get my work done, I unintentionally found a way to "set" the default page when uploading a new document with the REST API without needing to patch anything at all. It is rather easy: You can upload (by POST) a new document and use the name index_html (which must not be in use already). Due to this name it becomes the default view of the folder automatically. You can than immediately rename the document (by PATCH) and it still remains flagged as the default page. Works fine for me and is all I need. Maybe others might want to use that solution as well.

@tisto
Copy link
Member

tisto commented Jul 29, 2018

@wobsta right. This is Plone standard behavior. Good to know this solves your problem. Thanks for sharing it! I'd still be ok with implementing the default_page and layout in plone.restapi. Especially in plone-react it would be handy to being able to set the layout of a particular object. We use that a lot at kitconcept...So if anybody is willing to implement this, I'd be more than happy to help with pointers and reviewing...

@tisto
Copy link
Member

tisto commented Jul 29, 2018

@buchi making default_page and layout an expandable might be overkill IMHO. Maybe just get/post them as regular attributes? As always, we would have to live with possible name collisions. Though, I guess I'd be ok with that. Opinions?

@robgietema
Copy link
Member

@davisagli that seems to be a versioning workflow (can be done with plone.app.iterate?), using the default page for that is just a convenient hack.

@datakurre the portal_root issue is fixed with this PLIP plone/Products.CMFPlone#2454

@sauzher
Copy link
Contributor

sauzher commented Aug 24, 2020

Hi all.
I worked on this and I've implemented the serialization needed. I'm not enabled here to push my branch, though.

@tisto
Copy link
Member

tisto commented Aug 24, 2020

@sauzher didn't you signed the Plone contributor agreement or what's the reason you can not push your branch here? You can always create a PR from a fork.

sauzher added a commit to sauzher/plone.restapi that referenced this issue Aug 24, 2020
…ike `"default_page": {"@id": "http://localhost:8080/Plone/front-page"}`
@sauzher
Copy link
Contributor

sauzher commented Aug 24, 2020

@tisto

@sauzher didn't you signed the Plone contributor agreement or what's the reason you can not push your branch here.

I think I've done (ages ago actually). Will do again. Tnx!

@thomasmassmann
Copy link
Member

@sauzher , can you please create a PR so we can integrate this. Also, we should add the same functionality for the deserializer.

@sauzher
Copy link
Contributor

sauzher commented Oct 22, 2020

@thomasmassmann
is this ok?
#983

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants