haml 语法 - 嵌套部分属性

发布于 2024-08-14 07:20:22 字数 840 浏览 5 评论 0原文

我想要的是一种嵌套部分属性的方法,这似乎有点啰嗦:

= 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'
})

我正在使用静态。

what i want is a way of nesting partial properties, this seems a tad long winded:

= 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'
})

I'm using staticmatic.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时光无声 2024-08-21 07:20:22

这是编写助手的好地方。

This is a great place to write a helper.

迷乱花海 2024-08-21 07:20:22

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

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

Thanks nex3, you are right, I'll probably end up doing that, however just in case this helps anybody, I did find the syntax for adding arrays to a hash.

=partial('_views/sub-nav', :locals => {:id => "x007", :menu_title => "Magazine", :selected_li => "Donkeys", :ul => ['Articles', 'Donkeys', 'Camels']})
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文