You can find the origins of this in the discussion about ubiquo_settings
initiated in
http://groups.google.com/group/ubiquo-gnuine/browse_thread/thread/ccbba5de4963d01d?hl=ca
the proposal takes into account the ideas from Carlos and Ramon.
Cheers,
Bernat
El dc 02 de 03 de 2011 a les 08:37 -0800, en/na David Lozano va
escriure:
Some feedback on some points:
- I'm not sure about moving Ubiquo::Config ("static" configuration) also
in this plugin. For now I'd start just with the dynamic part (calling it
ubiquo_settings)
- How to access: I'd create an API in the Setting class, pretty much
like redmine's one.
- Initialization: For now I'd go with migrations, but mainly because I
don't see a clear way of doing it automatically.
- Setting types: text and integer are pretty much not distinguishable
Cheers,
Bernat
El dc 02 de 03 de 2011 a les 08:57 -0800, en/na David Lozano va
escriure:
> Hi,
>
> Sorry for the format. I created a ticket with a pdf file here:
> http://ubiquo.lighthouseapp.com/projects/27683-ubiquo/tickets/484-ubiquo_config-proposal
>
>
> Regards,
> David
>
> Bernat Foj Capell ha escrito:
> > Side note:
> >
> > You can find the origins of this in the discussion about ubiquo_settings
> > initiated in
> > http://groups.google.com/group/ubiquo-gnuine/browse_thread/thread/ccbba5de4963d01d?hl=ca
> >
> > the proposal takes into account the ideas from Carlos and Ramon.
> >
> > Cheers,
> > Bernat
> >
> > El dc 02 de 03 de 2011 a les 08:37 -0800, en/na David Lozano va
> > escriure:
> > > I would like to ask feedback about the possibility to add a new plugin
> > > to the family. We would love to have any information/suggestion/need/
> > > requirement you can provide.
>
--
Bernat Foj Capell
bf...@gnuine.com
gnuine
www.gnuine.com
C/ Pamplona, 96
Local 17
22@ - 08018 Barcelona
Tel: +34.93.567.94.94
Fax: +34.93.567.94.95
--
Heu rebut aquest missatge perquè esteu subscrit al grup "ubiquo" de Grups de Google.
Per publicar a aquest grup, envieu un correu electrònic a ubiquo...@googlegroups.com.
Per anul·lar la subscripció a aquest grup, envieu un correu electrònic a ubiquo-gnuin...@googlegroups.com.
Per obtenir més opcions, visiteu aquest grup a http://groups.google.com/group/ubiquo-gnuine?hl=ca.
The most important thing missing is the functional specification
(how things would work from the user point of view) we need to work on
it and add it to the current document.
There are other things I want to comment but they are minor. I will
come back to them later.
Regards
Ramon
2011/3/17 David Lozano <dlo...@gnuine.com>:
About the screenshot, usually what we have done with settings is to have
an unique screen with all the settings directly editable there.
Now if we add tabs, this would be another level (I don't know how tabs
could be depicted, but ATM tabs can be left while we create a
centralized tab design). But anyway, I'd stay with the grouped-settings
approach, it looks more user-friendly to me than a listing.
Cheers,
Bernat
El dt 22 de 03 de 2011 a les 07:48 -0700, en/na David Lozano va
--
Bernat Foj Capell
bf...@gnuine.com
gnuine
IMHO I prefer the direct edition, but I don't know if the other people
think the same. Any feedback?
Thanks,
Bernat
El dt 22 de 03 de 2011 a les 16:44 +0100, en/na dlozano va escriure:
> Hi Bernat,
> So that way the values will be editable directly on the grouped view or
> you will have to go to the an edit page?
> I thought that it might display too much information for only one page.
> Could be useful a expandable box or a lighwindow instead?
>
> Thanks,
> David
Thanks,
David
On mar, 2011-03-22 at 15:57 +0100, Bernat Foj Capell wrote:
My 2c:
1) ubiquo_setting should provide an interface for plugins to
create/update/delete their settings and shoult not rely on them
knowing about ubiquo_settings internals. (this conflicts with the
selected approach in 3.2).
# This will only initialize these values if they don't already exist
in the database table.
# This interface could be internal and the public one could be a yml file.
# This will return a hash with the initialized values (the ones that
really changed in the db).
Ubiquo::Settings.with_context(:authentication).initialize({ :per_page
=> 10, :ssl = false})
Ubiquo::Settings.with_context(:authentication).initialize do |settings|
settings.per_page = 10
settings.ssl = true
end
This should make it easier to change the settings internals without
fear of breaking everything.
2) About the API for settings I think it would be cool integrate what
we alreay have in ubiquo_config in the settings API. For example:
Ubiquo::Settings.static.media[:aws_secret_key] = 'KJLL(()FYTRE%&E&%' #
Maybe not needed
Ubiquo::Settings[:email_from] = 'cus...@bar.com' # Default context core
Ubiquo::Settings.design[:sticky_widgets] = true
NOTE: Maybe at this point we could drop the static concept completely
since it would seem it isn't really needed if we do point 1. Ah! and
Settings should be a singleton.
3) About the user interface. If it is intended to be used by ubiquo
end users I think it's not friendly enough (I agree with Bernat) which
it's ok if it's developer oriented.
The settings UI needs to be shown in both superadmin and regular
ubiquo (Users | Roles | Settings | Activity).
In regular ubiquo we should only shown user related config options
and in superadmin we show everything. Obviusly from a code point of
view the UI should be the same.
We should use a grouped-setting approach, as Bernat pointed, Maybe
we could use vertical tabs in the sidebar with the default one being
core I think that would be a clean approach and it would be consistent
with what we plan to do with forms.
Regards
Ramon
P.D I think we need to discuss inheritance to get rid of it or to find
a simple or more appropiate solution.
2011/3/22 David Lozano <dlo...@gnuine.com>:
My thoughts:
1) I think we should probably design the code to support multiple
backends and not assume it will always be a database. Obviusly we only
need to support a database backend for now and this work may seem
irrelevant right now but it will make it easier to change to a
different backend storage (for performance reasons).
2) I dont like having the ubiquo prefix on plugin contexts, I assume
this is to avoid name conflicts with user defined contexts but right
now I don't see much use for those.
3) Some method name proposals for Settings:
self.overriding_enabled? -> self.overridable?
self.enable_overring -> self.overridable = true
self.add_setting -> self.add # Does the proper thing with a Setting
and with a Hash
self.load_from_db -> self.load_from_backend
self.option_nullable? -> self.nullable?
4) If we follow AR conventions shouldn't settings be called Setting?
Settings make more sense to me in this particular case.
5) New proposal for block definition:
Ubiquo::Settings(:design) do |setting|
setting.boolean :sticky_widgets, :value => true, possible_values =>
nil # Default options should be well thought.
end
6) Block definition in a plugin register
Ubiquo::Plugin.register(:design) do |setting|
setting.boolean :sticky_widgets, :value => true, possible_values =>
nil # Default options should be well thought.
end
7) Single definition and data retrieval
Ubiquo::Settings.design[:sticky_widgets] = true
Ubiquo::Settings.design[:sticky_widgets]
I would also provide another option for data retrieval something like this:
Ubiquo::Settings.sticky_widgets
And if we remove the Ubiquo prefix altogether (I am not sure about this):
Settings.sticky_widgets
I thinks this changes would make it more pleasant to use in application code.
Regards
Ramon
2011/4/14 David Lozano <dlo...@gnuine.com>:
On vie, 2011-04-15 at 08:43 +0200, Ramon Salvadó wrote:
Hi David,
>
> My thoughts:
>
> 1) I think we should probably design the code to support multiple
> backends and not assume it will always be a database. Obviusly we only
> need to support a database backend for now and this work may seem
> irrelevant right now but it will make it easier to change to a
> different backend storage (for performance reasons).
>
>
This was, indeed, proposed and accepted. I should have reflected it in
the doc :|
2) I dont like having the ubiquo prefix on plugin contexts, I assume
> this is to avoid name conflicts with user defined contexts but right
> now I don't see much use for those.
>
>
3) Some method name proposals for Settings:
>
> self.overriding_enabled? -> self.overridable?
> self.enable_overring -> self.overridable = true
> self.add_setting -> self.add # Does the proper thing with a Setting
> and with a Hash
> self.load_from_db -> self.load_from_backend
> self.option_nullable? -> self.nullable?
>
Much better. All were long names to try to avoid collision, but the user
should have a explicit clear naming schema.
> 4) If we follow AR conventions shouldn't settings be called Setting?
> Settings make more sense to me in this particular case.
>
>
The naming was chosen to differenciate the model and the class that
actually handles all. The model for the database backend should better
be renamed.
5) New proposal for block definition:
>
> Ubiquo::Settings(:design) do |setting|
> setting.boolean :sticky_widgets, :value => true, possible_values =>
> nil # Default options should be well thought.
> end
>
> About the boolean call
The differences between setting types (validation mostly) were only
planned to be applied when the settings were defined on a backend. In
this case in a plugin definition, we should apply validation constraints
or give freedom to the developer?
6) Block definition in a plugin register
>
> Ubiquo::Plugin.register(:design) do |setting|
> setting.boolean :sticky_widgets, :value => true, possible_values =>
> nil # Default options should be well thought.
> end
>
> 7) Single definition and data retrieval
>
> Ubiquo::Settings.design[:sticky_widgets] = true
> Ubiquo::Settings.design[:sticky_widgets]
>
> I would also provide another option for data retrieval something like
this:
>
> Ubiquo::Settings.sticky_widgets
>
> And if we remove the Ubiquo prefix altogether (I am not sure about
this):
>
> Settings.sticky_widgets
>
So all this will be supported?
Ubiquo::Settings.context(:BASE)[:default_locale] = :en
Ubiquo::Settings[:default_locale] = :en
Ubiquo::Settings.default_locale = :en
Ubiquo::Settings.context(:design)[:sticky_widgets] = true
assert Ubiquo::Settings[:design][:sticky_widgets]
# We will look for the first value in all context with the desired key
# Also raise error if more than one?
Ubiquo::Settings.sticky_widgets = :en
# Unnecessary?
assert_equal {sticky_widget => {:value => true, :options =>{} },
Ubiquo::Settings.design
Thanks,
David
Answers below:
2011/4/15 dlozano <dlo...@gnuine.com>:
I would try be consitent here and always apply the constraints. Maybe
we could add a untyped type without constraints to make it explicit at
least.
>
> 6) Block definition in a plugin register
>>
>> Ubiquo::Plugin.register(:design) do |setting|
>> setting.boolean :sticky_widgets, :value => true, possible_values =>
>> nil # Default options should be well thought.
>> end
>>
>> 7) Single definition and data retrieval
>>
>> Ubiquo::Settings.design[:sticky_widgets] = true
>> Ubiquo::Settings.design[:sticky_widgets]
>>
>> I would also provide another option for data retrieval something like
> this:
>>
>> Ubiquo::Settings.sticky_widgets
>>
>> And if we remove the Ubiquo prefix altogether (I am not sure about
> this):
>>
>> Settings.sticky_widgets
>>
> So all this will be supported?
>
> Ubiquo::Settings.context(:BASE)[:default_locale] = :en
This one is only need for compatibility reasons right? I mean it would
be deprecated in future versions...
> Ubiquo::Settings[:default_locale] = :en
> Ubiquo::Settings.default_locale = :en
>
Yes those make sense. I see no problem implementing just one of the
options. I would just implement:
Settings[:default_locale]
Settings.design[:sticky_widgets]
Or
Settings.default_locale
Settings.design.sticky_widgets
> Ubiquo::Settings.context(:design)[:sticky_widgets] = true
> assert Ubiquo::Settings[:design][:sticky_widgets]
> # We will look for the first value in all context with the desired key
> # Also raise error if more than one?
> Ubiquo::Settings.sticky_widgets = :en
I understand this looks for sticky_widgets in the default context only.
Ubiquo::Settings.design.sticky_widgets
This would look inside the design context only (except if inheritable,
then it would look in the default context).
>
> # Unnecessary?
> assert_equal {sticky_widget => {:value => true, :options =>{} },
> Ubiquo::Settings.design
>
>
>
> Thanks,
> David
>