变量+ HTML到Button + Ruby on Rails视图 [英] Variable + HTML to Button + Ruby on Rails views
本文介绍了变量+ HTML到Button + Ruby on Rails视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到问题了.
<%= link_to "<button>Add</button>".html_safe, new_admin_course_path, :id=>"open-contacts-dialog-btn", :class=>"inbox-sf-add-btn tip" %>
如果我想添加一个ruby变量和一些普通文本按钮,该怎么办?例如$ 25,-(其中$和,-是固定的,而25变量...我对此很陌生...很抱歉,如果这太容易了,但是很挣扎.我尝试了很多选择,并且用了很长时间的Google搜索.
What if I want to add a ruby variable and some normal text the button? e.g. $25,- (where the $ and ,- are fixed and the 25 variable...I am quite new to this...sorry if this is too easy, but struggling. I tried a lot of options and googled for long time.
推荐答案
您可能会喜欢
amount = 25 #amount是红宝石变量
amount = 25 #amount is the ruby variable
<%= link_to "<button>Add $#{amount}</button>".html_safe, new_admin_course_path, :id=>"open-contacts-dialog-btn", :class=>"inbox-sf-add-btn tip" %>
,而且我个人不添加< button></button>
到链接中,而是使用CSS来获得外观
and I personally dont add <button></button>
to the link and I rather use CSS to get the look and feel
这篇关于变量+ HTML到Button + Ruby on Rails视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文