[英]simple_form hints as tooltip
我試圖將我的simple_form
提示顯示為twitter-bootstrap工具提示,以便僅在用戶選擇輸入字段或將其懸停在其上時顯示提示。
表單項看起來像(以haml為單位):
:ruby
title = <<TITLE
This text is normally hidden and pops up as a bootstrap tooltip
only when the user hovers on the input field.
TITLE
= f.input :opt_out, hint: title
我的用於simple_form提示的CSS和Javascript很普通,所以我認為我必須修改config/initializers/simple_form.rb
初始化程序文件:
b.use :hint, :wrap_with => { :tag => :span, :class => :hint }
我是這樣解決的:
:ruby
title = <<TIT
This text is normally hidden and pops up as a bootstrap tooltip
only when the user hovers on the input field.
TIT
link = link_to "what's this?", "", rel: "tooltip", title: title, data: {placement: "right"}
label = "Opt out #{link}"
= f.input :opt_out, label: raw(label)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.