开发者

rails 3: looking for simple solution to adding 3 tabs to a report view (need css to draw tabs)

I've seen various solutions for adding tabbed navigation to a rails 3 app, but what I need is much simpler (in theory)...

On one of my views, I have three short reports: the 'overview' section, 'detail 1' and 'detail 2'

Right now my view (HAML) displays them sequentially:

%h1 Sales Summary
(haml to display about 15 lines of summary data)

%h1 Sales by Region
(haml to display 15-20 lines about widget sales sorted one way)

%h1 Sales by Product
(haml to display 15-20 lines sorted a different way)

I'd like instead to have the three headings be in 3 reasonably attractive horizontal tabs, and simply hide/show the appropriate d开发者_JS百科ata based on which tab they click.

I would prefer a non-js approach (that works with browsers with javascript disabled), meaning I'm fine with re-drawing the page based on a url param such as "view=tab1"

I can see how to do it as a table, but I can't get that to look very 'tab like'.


This could comes in handy: http://unraveled.com/publications/css_tabs/

Still the no js constraint seems anachronistic so I encourage you to check jQuery's tabs: http://jqueryui.com/demos/tabs/

It's straight to include in your code and compatible with almost all browsers.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜