开发者

Customizable Widget Dashboard In Rails

I'm currently working on a Rails app that allows users to add "Widgets" to the homepage of the app when logged in. These widgets will consist of twitter feeds, flickr feeds, other rss feeds, etc...There will also be an administration area where admins can add/manage what widgets are available for users to add. Also, each app needs it's own custom set of options that the user will be required to enter when ad开发者_StackOverflowding that widget (e.g for twitter, a twitter username is required).

For days I've been trying to figure out how the logic behind this should work. At first My thought was to dynamically build the widget on the fly and store all widgets / widget configuration information in database tables like:

Widgets
   - name
   - description
   - feed_url

Widgets Settings
   - widget_id
   - name 
   - field type (text, textarea, etc...)
   - required

User Widgets
   - user_id
   - widget_id

User Widget Settings
   - user_id
   - widget_id
   - widget_setting_id
   - value

So, basically the admins would add widgets to the Module table (e.g Twitter) Then add configuration fields for that module in the Widget Settings table (twitter_username). But how to associate the config options to the widget when constructing them is where I'm having issues.

Another option would be to hardcode everything and stick it in the lib/ directory. But that would kill all flexibility / dynamic functionality.

Does any of this sound like it could work?

Any advice would be very much appreciated!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜