Ruby on rails 在RubyonRails中的新行上显示确认框文本
我这里的代码运行良好。我关心的一行是:confirm=>Ruby on rails 在RubyonRails中的新行上显示确认框文本,ruby-on-rails,internationalization,Ruby On Rails,Internationalization,我这里的代码运行良好。我关心的一行是:confirm=> <%= link_to I18n.t('helpers.links.remove_from_your_page'), '#', :confirm => I18n.t('helpers.links.confirmation'), :remote_url => reject_review_path(review), :class => 'btn
<%= link_to I18n.t('helpers.links.remove_from_your_page'), '#',
:confirm => I18n.t('helpers.links.confirmation'),
:remote_url => reject_review_path(review),
:class => 'btn btn-danger remove_page_button_pos remove-from-your-page',
:id => "remove_from_your_page_#{review.id}" %>
因此,当该人员单击按钮时,在继续之前,他们会看到带有“确定吗?”的确认框,以及“取消”和“确定”按钮-按计划工作
问题是我想在确认框的行之间加空格。例如,我想要:
Are you sure?
If you do this, that might happen.
If you do that, this might happen.
Cancel OK
我原以为我下面的方法行得通,但行不通:
(注意:确认等中的“原始”)
raw I18n.t('helpers.links.confirmation'),
:remote_url=>拒绝_review_路径(review),
:class=>“btn btn危险删除\页面\按钮\位置从页面中删除”,
:id=>“从您的页面删除”{review.id}“%>
在我的报告中,我有:
Helpers:
links:
confirmation: "Are you sure?<br/>If you do this, that might happen. <br/>If you do that, this might happen."
帮助程序:
链接:
确认:“你确定吗?
如果你这样做,这可能会发生。
如果你这样做,这可能会发生。”
但是我有一个语法错误。知道我怎样才能让它工作吗?谢谢 您将无法生成HTML标记,但您肯定可以:
记住要注意空格和制表符。YAML对于间距的一致性非常具体。标准是两个空格缩进,没有制表符。您找到解决方案了吗?可能是重复的
<%= link_to I18n.t('helpers.links.remove_from_your_page'), '#',
:confirm => raw I18n.t('helpers.links.confirmation'),
:remote_url => reject_review_path(review),
:class => 'btn btn-danger remove_page_button_pos remove-from-your-page',
:id => "remove_from_your_page_#{review.id}" %>
Helpers:
links:
confirmation: "Are you sure?<br/>If you do this, that might happen. <br/>If you do that, this might happen."
Helpers:
links:
confirmation: |
Are you sure?
If you do this, that might happen.
If you do that, this might happen."
I18n.t('confirmation') #=> "Are you sure?\nIf you do this, that might happen.\nIf you do that, this might happen.\n"