开发者

parent object specific layouts

I'm developing a rails app with a model consisting of items that belong to companies.

There are multiple users for this system and I want any user who logs in a开发者_高级运维nd looks for a specific item (belonging to a company) to see the company logo and letter head etc. as background.

i.e. each item knows his layout via the company parent object association, item belongs_to company

What do you suggest is the best and most elegant approach for modeling this in rails?

Cheers,


How customizable do you want the layouts?

At the high end, I suggest using the Liquid template library. It enables you and your integrators to safely change any aspect of the layout on a per company basis.

Flow: If the company has a liquid template stored in your system, then use it. Otherwise use a default template.

The other ways of doing things where you enable individual uploads of logo, letter head, plus css (to enable the right fonts for the company), etc etc, quickly becomes limiting.

Sooner rather than later, a company will insist on yet another change for their view and you'll need to add it. Instead, just make it all flexible by enabling per-company templates.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜