1>添加`gem 'bootstrap-sass'
2>HTML的基础navbar、footer
3>welcome
4>增加flashes
5>安装devise
6>放入simple_form(表格)
7>放入font-awesome
1>添加gem 'bootstrap-sass'
bundle install
改css为scss
在scss里面加入:
@import 'bootstrap-sprockets';
@impore 'bootstrap';
2>HTML的基础navbar、footer
mkdir app/views/common
touch app/views/common/_navbar.html.erb
touch app/views/common/_footer.html.erb
这两个前段是抄的。
在layout/application.rb那里
<% div class = "container-fluid" %>
<%= render "common/navbar" %>
<% yield %>
</div>
<%= render "common/footer" %>
3>welcome
rails g controler welcome
touch app/views/welcome/index.html.erb
写入:
<h1>Hello World!</h1>
在routes改为:
root 'welcome#index'
4>增加flashes
在js那里增加:
//= require 'bootstrap/alert';
touch app/views/common/_flashes.html.erb
(代码省略)
touch app/helpers/flashes_helper.rb
在layout/application.rb那里:
<% render common/flashes %>
最后测试:
在welcome.controller.rb
def index
flash[:notice] = "你好!早安”
end```
####5>安装devise
增加gem: `gem 'devise'`
`bundle install`
`rails g devise:install`
`rails g devise user`
`rake db:migrate`
修改navbar(代码省略)
加入js
`//= require 'bootstrap/dropdown'`
####6>放入simple_form(表格)
`gem 'simple_form'`
`bundle install`
`rails g simple_form:install --bootstrap`
####7>放入font-awesome
`gem 'font-awesome-rails'`
在scss:
`@import 'font-awesome';`
然后写入navbar(代码省略)。