#
itamar82
I have an idea for improving the ability to configure the settings of a section.
Currently, Cuyahoga checks if the type is a string, int, boolean, or enum and creates a webcontrol accordingly. This limits the configuration capabilities of a given section.
Take the following example: (I will use the Polls Module as the basis of this example.)
I would like to show the same poll in multiple sections across the site. As of now, the way to do this would be to attach the section directly into a template that is used on all the pages. For me this doesn't seem like a scalable solution. If some of the pages use different templates then this is becomes a point of friction and basically a pain in the butt.
I propose the following solution:
In Cuyahoga.Core there is a class called SettingControlHelper which renders the controls. As mentioned above, this class renders simple types... which do not satisfy my requirements. I would add a new interface definition to Cuyahoga.Core called ISectionCustomSettings. This interface would look like the following.
interface ISectionCustomSettings
{
IDictionary CustomSettings { get; }
}
The SettingControlHelper would then check if the type implements this interface, if it does, it will instantiate the type, call the CustomSettings property and populate a drop down list with the name value pairs in the Dictionary.
Every module could them implement such a interface and allow dynamic setting population.
In the Polls example, I would send a dictionary with PollId, PollName pairs.
Furthermore, if the type implements INhibernateModule, then Cuyahoga would inject the appropriate dao into the class.
I believe this feature would be very practical and would help many Cuyahoga developers.
Do you agree?
Currently, Cuyahoga checks if the type is a string, int, boolean, or enum and creates a webcontrol accordingly. This limits the configuration capabilities of a given section.
Take the following example: (I will use the Polls Module as the basis of this example.)
I would like to show the same poll in multiple sections across the site. As of now, the way to do this would be to attach the section directly into a template that is used on all the pages. For me this doesn't seem like a scalable solution. If some of the pages use different templates then this is becomes a point of friction and basically a pain in the butt.
I propose the following solution:
In Cuyahoga.Core there is a class called SettingControlHelper which renders the controls. As mentioned above, this class renders simple types... which do not satisfy my requirements. I would add a new interface definition to Cuyahoga.Core called ISectionCustomSettings. This interface would look like the following.
interface ISectionCustomSettings
{
IDictionary CustomSettings { get; }
}
The SettingControlHelper would then check if the type implements this interface, if it does, it will instantiate the type, call the CustomSettings property and populate a drop down list with the name value pairs in the Dictionary.
Every module could them implement such a interface and allow dynamic setting population.
In the Polls example, I would send a dictionary with PollId, PollName pairs.
Furthermore, if the type implements INhibernateModule, then Cuyahoga would inject the appropriate dao into the class.
I believe this feature would be very practical and would help many Cuyahoga developers.
Do you agree?