Rails:有没有办法在 yml 中包含多个 link_to?
我想稍微澄清一下我的观点。目前我不确定 yml 的语法以及是否有办法在 yml 语句中包含 link_to 方法。一种没有 link_to 方法的解决方案如下,但如果有办法的话,我想让它更简单。我不喜欢将 css 类和其他链接参数放在 yml 文件中。由于我对 ruby on Rails 还很陌生,所以我不确定是否有比这更聪明的解决方案。
erb:
<%= raw(t('registration.terms')) %>
yml:
en:
registration:
terms: |
<label for="registration_terms">I accept the</label> <a href='#terms_of_service' class='simple_link' rel='facebox'>Terms of Services</a>
<label for="registration_terms">and the</label> <a href='/non/i18n/supported/path' class='simple_link' rel='facebox'>Terms of Privacy</a> <label for="registration_terms">...</label>.
I would like to clean up my views a little bit. Currently I am not sure about the syntax of yml and if there is a way to include link_to methods in a yml statement. One solution without link_to methods is the following, but I would like to keep it more simple if there is a way to do so. I don't like putting my css classes and other link params in the yml file. Since I'm quiet new to ruby on rails, I'm not sure if there is a smarter solution than that.
erb:
<%= raw(t('registration.terms')) %>
yml:
en:
registration:
terms: |
<label for="registration_terms">I accept the</label> <a href='#terms_of_service' class='simple_link' rel='facebox'>Terms of Services</a>
<label for="registration_terms">and the</label> <a href='/non/i18n/supported/path' class='simple_link' rel='facebox'>Terms of Privacy</a> <label for="registration_terms">...</label>.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论