haml语法 - 嵌套部分属性

时间:2009-12-13 13:21:55

标签: ruby arrays haml staticmatic

我想要的是一种嵌套部分属性的方法,这似乎有点长篇大论:

= partial('frames/tabs_a', :locals => {:tabs_title => 'semi-dynamic-tabs',
  :tabs_id => 'p001',
  :panel_a => 'views/article-highlights_a',
  :a_id => 'p_002_0',
  :a_ft => '123 More in highlights',
  :a_tt => 'panel a', 
  :a_c => 'magazine', 
  :panel_b => 'views/thumbnail-list_a', 
  :b_id => 'b_id',
  :b_ft => 'testing tt', 
  :b_tt => 'panel b', 
  :b_c => 'opportunities', 
  :b_c => 'opportunities', 
  :panel_c => 'views/thumbnail-list_a', 
  :c_id => 'b_id', 
  :c_ft => 'testing tt',
  :c_tt => 'panel c',
  :c_c => 'community', 
  :panel_d => 'views/article-highlights_a',
  :d_id => 'p_002_0',
  :d_ft => '123 More in highlights',
  :d_tt => 'panel d', 
  :d_c => 'magazine'
})

我正在使用静电。

2 个答案:

答案 0 :(得分:2)

这是写一个帮手的好地方。

答案 1 :(得分:0)

感谢nex3,你是对的,我可能最终会这样做,但是为了防止任何人,我确实找到了将数组添加到哈希的语法。

=partial('_views/sub-nav', :locals => {:id => "x007", :menu_title => "Magazine", :selected_li => "Donkeys", :ul => ['Articles', 'Donkeys', 'Camels']})