Tag: Rails/Bootstrap
gem 'bootstrap', '~> 4.1.1' gem 'jquery-rails'
bundle show |fgrep sprockets-rails
@import "bootstrap";
<!DOCTYPE html> <html> <head> <title>Rails5Bootstrap4Demo</title> <%= csrf_meta_tags %> <%= csp_meta_tag %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> </head> <body> <div class="container"> <%= yield %> </div> </body> </html>
gem 'bootstrap-sass', '~> 3.3.6' gem 'font-awesome-sass' gem 'jquery-rails'
bundle install --path vendor/bundle
@import "bootstrap-sprockets"; @import "bootstrap"; @import "font-awesome-sprockets"; @import "font-awesome";
//= require jquery //= require bootstrap-sprockets
bundle exec rails g scaffold book title:string author:string summary:text bundle exec rake db:migrate
<nav class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="/"><i class="fa fa-home"></i>Home</a> </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li><a href="http://www.google.com/" target="_blank">Google</a></li> <li><a href="http://www.yahoo.co.jp/" target="_blank">Yahoo! Japan</a></li> </ul> <ul class="nav navbar-nav navbar-left"> <div class="form-group"> <%= form_tag('/books', method: 'get', class: 'navbar-form navbar-right') do %> <%= text_field_tag(:q, params[:q], class: 'form-control', style: 'width: 200px;', placeholder: 'Search') %> <% end %> </div> </ul> </div> </div><!-- /.container-fluid --> </nav> <div class="container"> <!-- flash messages --> <%= yield %> <hr> <footer> <p>© src256</p> </footer> </div>
bundle exec rails g kaminari:views bootstrap3