cofoundry icon indicating copy to clipboard operation
cofoundry copied to clipboard

Customization of site settings

Open dumboster opened this issue 7 years ago • 9 comments

Hello, Is there a way to customize Site settings ? Currently there are "Application name" and "Allow automatic updates", but I would like to add my own settings via the admin interface. Thanks a lot

dumboster avatar Sep 17 '18 13:09 dumboster

Not yet I'm afraid, not that's documented anyway. The settings functionality needs reworking and will be changed at some point in the next few releases to make it extensible in the way custom entities are.

HeyJoel avatar Sep 17 '18 13:09 HeyJoel

Thanks for your response. I look forward to this enhancement. Bravo for the incredible work that you do!

dumboster avatar Sep 17 '18 15:09 dumboster

This functionality related to the idea of having singular custom entities e.g. having a "Menu" custom entity that will only ever have one entry. This is similar to the way customizable settings would work.

The idea is that you would create a "SettingsDefinition" (naming tbd) that would have the following properties:

  • DefinitionCode (unique and used for lookups via queries)
  • Name (for the admin panel -no need for pluralisation)
  • Description (for the admin panel)
  • AutoPublish (the settings would be optionally versioned as with custom entities)

Questions

  • Would we need an option to localize as with custom entities? If so, would this appear as a version per supported locale and would there be an optional inheritance model to the settings e.g. en-gb locale inherits from the root if nothing is specified?
  • We'd need some way of expressing default state since the entity would need to be created at startup after it's been defined and if there are required settings then you'd expect some default values to be applied
  • Where would these sit in the admin panel menu? Some examples are clearly settings, others are entities? There's a job to make the admin menu more configurable, but that development might happen after this so we may need to make an interim decision.

Example settings/singular entities

  • Main Menu
  • General Settings
  • Contact Page (e.g. simple scenarios where you just want simple data for a specific page without a template)
  • Footer (i.e. layout level content)
  • Vimeo Account Config (i.e. plugin settings)

HeyJoel avatar Jun 07 '19 11:06 HeyJoel

I definitely need this ability for my menus.

Looking through your questions...

  • Although I'm not using Cofoundry for anything that supports different locales at the moment, In the past I have worked on large multi-locale sites and I can see that the option to localize custom entities would be advantageous. I would say that a version per supported locale would be the way forward, with it defaulting to a root or default.
  • Default state: Certainly there would have to be a default state option, whereby either the value can be set, or nulled if appropriate.
  • I was thinking settings: For my top menu (and possibly footer menu) I would want to pick a single menu from a list of existing menu custom entities. A singular entity is surely just a related group of settings?

Hopefully this is helpful.

I've been really impressed with Cofoundry so far. Currently redeveloping a site which was using Umbraco - which I would never use again with all the hassle it's been.

purplepiranha avatar Aug 09 '19 13:08 purplepiranha

Many of my ideas/scenarios could be solved with classes like this:

[Description("My group of admin settings")]
class MyAdminSettings : IAdministrationSetting
{
  // Decorate with attributes like [Required] as needed.
  public string SettingA { get; set; }
}

Storage could simply be in a table like this:

Group: varchar
Description: varchar
Name: varchar
Value: varchar

Group could be the class name, description come from the Description attribute and Name be take from the property name.

Add to this meta data like created-date or even versioning/change-history.

With a table like this it would not be necessary to think in terms of singleton entities. On the other hand you may already have so much built-in utility stuff for entities so adding a new data table like this would be silly. I'll leave it to you guys - this is just some ideas for inspiration.

JornWildt avatar Mar 05 '21 09:03 JornWildt