Module: Rapid::Web::Bootstrap
- Defined in:
- lib/rapid/web/bootstrap.rb
Instance Method Summary collapse
- #bootstrap_body(&block) ⇒ Object
- #bootstrap_flash ⇒ Object
- #bootstrap_head ⇒ Object
- #bootstrap_scripts ⇒ Object
- #bootstrap_stylesheets ⇒ Object
- #bootstrap_topnav ⇒ Object
Instance Method Details
#bootstrap_body(&block) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/rapid/web/bootstrap.rb', line 23 def bootstrap_body &block = bootstrap_topnav << capture_html(&block) << bootstrap_scripts body = tag :body, :content => , "data-spy" => "scroll", "data-target" => ".subnav", "data-offset" => "50" concat_content body end |
#bootstrap_flash ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/rapid/web/bootstrap.rb', line 79 def bootstrap_flash = "" notice = session.delete :notice if notice << tag(:div, :content => notice, :class => 'alert alert-success') end error = session.delete :error if error << tag(:div, :content => error, :class => 'alert alert-error') end end |
#bootstrap_head ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rapid/web/bootstrap.rb', line 6 def bootstrap_head = "" << tag(:meta, :charset => "UTF-8") << tag(:meta, :name => "description", :content => @description) if @description << tag(:meta, :name => "author", :content => @author) if @author << tag(:title, :content => (@title.to_s if @title) || "Rapid Development") << bootstrap_stylesheets << %(<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements --> <!--[if lt IE 9]> <script src='http://html5shim.googlecode.com/svn/trunk/html5.js'></script> <![endif]-->) tag :head, :content => end |
#bootstrap_scripts ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/rapid/web/bootstrap.rb', line 47 def bootstrap_scripts = "" << tag(:script, :content => "", :src => '/rapid/core/jquery-1.7.1.js') << tag(:script, :content => "", :src => '/rapid/core/prettify.js') << tag(:script, :content => "", :src => '/rapid/core/bootstrap-collapse.js') if public_path && File.exists?(File.join(public_path, 'application.js')) << tag(:script, :content => "", :src => "/rapid/#{rapid_name}/application.js") end end |
#bootstrap_stylesheets ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rapid/web/bootstrap.rb', line 33 def bootstrap_stylesheets = "" << tag(:link, :href => "/rapid/core/bootstrap.min.css", :rel => "stylesheet") << tag(:link, :href => "/rapid/core/bootstrap-responsive.min.css", :rel => "stylesheet") << tag(:link, :href => "/rapid/core/prettify.css", :rel => "stylesheet") if public_path && File.exists?(File.join(public_path, 'application.css')) << tag(:link, :href => "/rapid/#{rapid_name}/application.css", :rel => "stylesheet") end end |
#bootstrap_topnav ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/rapid/web/bootstrap.rb', line 61 def bootstrap_topnav %(<div class="navbar"> <div class="navbar-inner"> <div class="container"> <a href="#" class="brand">Rapid</a> <div class="nav-collapse"> <ul class="nav pull-right"> <li> <a href="#">Link</a> </li> <li class="divider-vertical"></li> </ul> </div> </div> </div> </div>) end |