Laravel-Backpack/PageManager

Unique predefined pages

OliverZiegler opened this issue ยท 12 comments

I'm currently in need of unique pages (one page per template) which can only be edited but neither deleted nor a second one created.

Think of something like the imprint or privacy page, a contact page, some describing text and image for landing... (I think you get the idea)

I have currently implemented this functionality in a project of mine based on page manager and wonder if this should be integrated in this package.

If you find this useful I would prepare a PR to add this functionality here, otherwise I will create an extra package for this (as this is quite useful in many client projects).

I wonder if there should be examples of what could be done and how prescriptive this package should be?

That said, I've never quite figured out what this package actually does so it's possible I can't even envision the use case at all ๐Ÿ˜บ

@lloy0076 well currently you can "only" create pages with templates, which seems like some "catch all" crud (you could have almost the same functionality if you create one crud model per template). I think of this package as some kind of "wordpress style backend partial" (in wordpress you can also create different pages (based on templates) and get a list of all these...)

Here, in my understanding the template example "about_us" should only exist as one instance (or who has multiple "About us" pages ๐Ÿค”). This is the point where my changes would drop in, allowing only editing (of some) information on the About us page. As I always assume my endusers to have no idea what they are doing, you can prevent them messing around ๐Ÿ˜‰

So my "unique predefined pages" can be fixed parts of the frontend, not able to delete but just to edit basic information. (No one can or wants to pay a Dev to edit some spelling mistakes these days ๐Ÿ˜… )

PR #61 is ready. Would anyone review it? :)

I kinda think you went a bit too far on that, by assuming that every project will require that 'unique page (services/portfolio/about/contact/team/etc)'. I would personally go for a page template select that would contain two groups of templates (unique and not-unique, checking for the presence of any unique template name in the pages table).

@AurelDragut I understand your concerns but I think as soon as people make use of the PageManager package they will also be be needing some kind of unique pages I think.
Your suggestion will make users able to switch templates and also create/delete unique pages (which should not be supported in my opinion or as I understand the concept of unique pages). I think we could improve the package by adding upper and lower bounds per template to achieve what you suggested (Eg. services template should always have at least 3 and at max 10 entries) but this is another feature ;)

@OliverZiegler, unique is something, required is something else. I would rather go for the option to add/delete those pages (not their templates) whenever i feel it's necessary instead of having all of them created (at least here we should have an option for each page to choose whether the page is published or not)...

@AurelDragut I think we have different ideas of this feature. And perhaps my naming isn't as clear as it should be...

In my understanding this pages are required as they will be linked in the frontend.

Think of some homepage, managed with backpack and say we have a structure like this:

  • Landing
  • About us
  • Projects
    • Project 1
    • Project 2
  • Contact

So Landing, About us and Contact should be unique (required) pages, cause when they get deleted, the homepage would be destroyed.
Projects could be pages (defined via PageManager) or even basic Backpack/CRUDs.

Could you come up with an example where these Pages should be deletable?

@AurelDragut I think we have different ideas of this feature. And perhaps my naming isn't as clear as it should be...

yeah i got the same feeling about this

In my understanding this pages are required as they will be linked in the frontend.

yes but the frontend should be dynamic and display just what is available and not some 'static' content.

Could you come up with an example where these Pages should be deletable?

No, if we get to talk only about landing and contact... these pages should be mandatory, but about/projects/services/portfolio pages are subject to choose based on each company/person's activity (maybe they have a fresh start without projects/portfolio).

@AurelDragut well if they have a fresh start the developer should remove the options. PageManager (in my opinion) is no "build your own page"-like tool, but gives users flexibility in editing their page.

When my customer wants a homepage structured like above, there won't be an option to remove about us without contacting me and me doing the works. If they want full flexibility for their homepage the should use something similar to Wordpress and just pay for the Templates/Designs.

The goal I want to achieve here is a "as defined" backend for Frontpages which is easy to use even for non IT-affine user. (and they should not mess around with page structure I think)

Now i understand better what you say, but i am not quite sure this is the way we should go, maybe some other opinions would be useful.

any more opinions on this?

See #61 for my implementation which is ready for merge (if changes pass the review ๐Ÿ˜‰ )

@OliverZiegler I completely agree with this feature, and what you said here:

AurelDragut well if they have a fresh start the developer should remove the options. PageManager (in my opinion) is no "build your own page"-like tool, but gives users flexibility in editing their page.

When my customer wants a homepage structured like above, there won't be an option to remove about us without contacting me and me doing the works. If they want full flexibility for their homepage the should use something similar to Wordpress and just pay for the Templates/Designs.

The goal I want to achieve here is a "as defined" backend for Frontpages which is easy to use even for non IT-affine user. (and they should not mess around with page structure I think)

I think unique and mandatory pages are a hard reality of using Backpack to manage page content. The most obvious example, to me, is the homepage template:

  • there can only be one home page
  • you can't let your clients delete the homepage

So I totally agree with the feature. I'll reply more about the implementation in your PR #61 - this one looks a little bit complicated to me.

Thank you @OliverZiegler and @AurelDragut !