haml syntax - nesting partial properties
-
19-09-2019 - |
Question
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.
Solution
This is a great place to write a helper.
OTHER TIPS
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']})
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow