标签标签内的Haml超链接

时间:2012-01-16 05:53:12

标签: ruby-on-rails haml

在我的.haml文件中,我有

  

= employee.label:tos_confirmation,'我同意服务条款。',:class => '宽'

如何使服务条款成为超链接?

2 个答案:

答案 0 :(得分:2)

= link_to employee.label(:tos_confirmation, 
                         'I agree to the Terms of Service.', 
                         :class => 'wide'), 
          'http://example.com/tos'

答案 1 :(得分:2)

我正在寻找的答案是这样的:

  %label.wide{:for => "tos_confirmation"}
    I agree to the 
    %a{:href => "/tos"} Terms of Service
    and
    = succeed "." do
      %a{:href => "/privacy_policy"} Privacy Policy

我唯一缺少的是"员工"部分,这不太重要。