[英]add links into haml template
I implemented a template named "_list_two_lines" 我实现了一个名为“ _list_two_lines”的模板
%ul{:style=>"padding-top: 0; margin-top: 0"}
- content.each do |element|
%li{:style=>"font-family: Roboto, sans-serif; color: #333;font-weight: 300; font-size: 14px; "}
✓
= render :partial => _text, :locals => {:inline =>true, :content => element[0] , :weight => bold_weight_email}
%br
= render :partial => _text, :locals => {:inline =>true, :content => element[1]}
Here I call it in the html.haml: 在这里,我在html.haml中称它为:
= render :partial => _list_two_lines, :locals => {:content => [["welcome to this forum","You need sign up first")]]}
How could I add a link to "sign up"? 如何添加链接以“注册”? How could I achieve by modifying the template? 如何通过修改模板来实现? So people will be redirect to another url clicking on sign up. 这样,人们将被重定向到另一个URL,然后单击“注册”。
You could use the a
tag: 您可以使用a
标签:
%a{href: '/sign_up'}
Sign up
Obviously replacing the href value with whatever link you have. 显然用任何链接替换href值。 If you are using haml inside rails you may (or should) use the built in link_to
methods: 如果您在导轨内部使用haml,则可以(或应该)使用内置的link_to
方法:
=link_to sign_up_path
or something like that. 或类似的东西。
(Also - it is considered bad style to have inline CSS like that. Move it to a CSS file and include it in your page header and add a class or id to the element you want to style.) (此外-具有这样的内联CSS被认为是不好的样式。将其移动到CSS文件中并将其包含在页面标题中,并向要设置样式的元素添加类或ID。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.