我现在有这么两个 haml 文件,需要在另外一个 B.haml 调用(或者说是嵌套)A.haml 这个是 A.haml
- chinese_name ||= nil
= content_for :footer do
<script language="javascript" type="text/javascript" src="http://chinese.biodinfo.org/audioplayer/swfobject.js"></script>
<script language="javascript" type="text/javascript" src="http://chinese.biodinfo.org/audioplayer/embswf.js"/></script>
<script type="text/javascript">var name=$("#flashContent").attr("name");setSwf(name); alert("dddd");</script>
- unless chinese_name.blank?
#flashPlayer{:style => 'height:18px;width:20px'}
#flashContent{name:chinese_name}
这个是 B.haml
- names_by_language = common_names_by_language(@common_names, current_language.id).uniq
- if names_by_language.blank?
.empty
%p= I18n.t(:names_common_empty)
- else
%h3.assistive= I18n.t(:names_common_list_by_language_assistive_header)
%p.help_text
= raw(I18n.t(:name_preferred_for_language_help_tip,
:icon => image_tag("v2/icon_required.png", :alt => I18n.t(:name_preferred_for_language_yes), :class => 'indicator')))
- names_by_language.each_with_index do |language_names_pair, index|
- language = language_names_pair[0]
- names = language_names_pair[1]
%h4= language
%table.standard.common_names
%thead
%tr
%th= I18n.t(:names_name_column_header)
%th= "Pronunciation"
%th= I18n.t(:names_sources_column_header)
%th= I18n.t(:names_status_column_header)
%tbody
- names.each do |name|
%tr
%td{:class => name.preferred ? 'preferred' : nil,
:title => name.preferred ? I18n.t(:name_preferred_for_language_yes) : nil}
= (defined?(language) && language == 'English') ? raw(name.name_string.capitalize_all_words) : raw(name.name_string)
%td
我要在这个地方把A插入进来
%td
= raw(common_name_display_attribution(name))
%td
= name.vetted.label
请问各位,怎么做