Module: FarmTwitterBootstrap

Defined in:
lib/farm_twitter_bootstrap.rb,
lib/farm_twitter_bootstrap/modal.rb,
lib/farm_twitter_bootstrap/version.rb

Constant Summary collapse

VERSION =
"0.0.2"

Instance Method Summary collapse

Instance Method Details

#tb_modal(header_text, footer_content = '', &content) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/farm_twitter_bootstrap/modal.rb', line 3

def tb_modal(header_text, footer_content = '', &content)
  html = "<div id='tb_modal' class='modal fade' aria-hidden='true'>"
  html += "<script type='text/javascript'>"
  html +=   "$('#tb_modal').on('hidden', function(){ $('#tb_modal').detach(); })"
  html += '</script>'

  html += "<div class='modal-header'>"
  html += "<button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>"
  html += "<h3 style='text-align: center'>#{header_text}</h3>"
  html += '</div>'

  html += "<div class='modal-body'>"
  html += capture(&content)
  html += "</div>"
  html += "<div class='modal-footer'>"
  html += footer_content
  #html += "<button class='btn' data-dismiss='modal' aria-hidden='true'>Close</button>"
  html += '</div>'
  html += '</div>'
  html.html_safe
end