### Step 1:
修改navbar内容,做如下替换
```ruby app/views/common/_navbar.html.erb
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<a class="navbar-brand" href="/"><strong> MONSOON </strong></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<%= link_to("商品", products_path) %>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">分类浏览
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<% @categories.each do |group| %>
<% group.last.each do |sub_category| %>
<li class="list-group-item"><a href="<%= category_path(sub_category) %>"><%= sub_category.title %></a></li>
<% end %>
<% end %>
</ul>
</li>
<li><%= link_to "服务", static_pages_help_path %></li>
<li><%= link_to "关于", static_pages_about_path %></li>
</ul>
<!-- 搜索框 -->
<%= form_tag search_products_path, method: :get, class: "navbar-form navbar-left" do %>
<div class="form-group">
<% if @category %>
<input type="hidden" name="category_id" value="<%= @category.id %>" />
<% end %>
<input type="text" name="w" value="<%= params[:w] %>" class="form-control search-input" placeholder="<%= @category ? "在 #{@category.title} 下搜索.." : '搜索整站商品..' %>">
</div>
<button type="submit" class="btn btn-default">搜索</button>
<% end %>
<ul class="nav navbar-nav navbar-right">
<li>
<%= link_to carts_path do %>
购物车 <i class="fa fa-shopping-cart"> </i> ( <%= current_cart.products.count %> )
<% end %>
</li>
<% if !current_user %>
<li><a href="#" data-toggle="modal" data-target="#signup-modal">注册</a></li>
<li><a href="#" data-toggle="modal" data-target="#login-modal">登入</a></li>
<% else %>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Hi!, <%= current_user.email %>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<% if current_user.admin? %>
<li>
<%= link_to('后台管理<span class="glyphicon glyphicon-stats pull-right">'.html_safe,
admin_root_path) %>
</li>
<li role="separator" class="divider"></li>
<li> <%= link_to('我的订单 <span class="glyphicon glyphicon-envelope pull-right"></span>'.html_safe, account_orders_path) %> </li>
<li> <%= link_to('我的收货地址<span class="glyphicon glyphicon-home pull-right"></span>'.html_safe,"#") %> </li>
<li> <%= link_to('我收藏的商品<span class="glyphicon glyphicon-heart pull-right"></span>'.html_safe, "#") %> </li>
<li role="separator" class="divider"></li>
<li><%= link_to('用户中心 <span class="glyphicon glyphicon-cog pull-right"></span>'.html_safe, edit_account_user_path(current_user)) %></li>
<li role="separator" class="divider"></li>
<% end %>
<li> <%= link_to(content_tag(:i, '登出', class: 'fa fa-sign-out'), destroy_user_session_path, method: :delete) %> </li>
</ul>
</li>
<% end %>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<!-- 以下代码实现登入登出的弹窗效果 -->
<div class="modal fade" id="login-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog" role="document">
<div class="loginmodal-container">
<h2>Log in</h2>
<%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="form-inputs">
<%= f.input :email, required: false, autofocus: true %>
<%= f.input :password, required: false %>
<%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %>
</div>
<div class="form-actions">
<%= f.button :submit, "Log in" %>
</div>
<% end %>
</div>
</div>
</div>
<div class="modal fade" id="signup-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="loginmodal-container">
<h2>Sign up</h2>
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :email, required: true, autofocus: true %>
<%= f.input :password, required: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %>
<%= f.input :password_confirmation, required: true %>
</div>
<div class="form-actions">
<%= f.button :submit, "Sign up" %>
</div>
<% end %>
</div>
</div>
</div>