tap/app/views/users/_sidebar.html.erb
2015-09-01 17:40:18 +02:00

32 lines
1.4 KiB
Text

<div class="col-sm-3">
<div>
<h2>
<%= @user.nickname %>
<% if can? :edit, @user %>
<%= link_to content_tag(:small, content_tag(:span, "", class: "glyphicon glyphicon-cog")), edit_user_path(@user) %>
<% end %>
</h2>
</div>
<%= content_tag :div, image_tag(@user.avatar, class: "img-circle img-thumbnail center"), class: "user_avatar center" %>
<ul class="list-group">
<li class="list-group-item text-muted">Orders</li>
<li class="list-group-item"><strong>Orders placed</strong><span class="badge"><%= @user.orders_count %></span></li>
<li class="list-group-item"><strong>Products ordered</strong><span class="badge"><%= @products.map(&:count).sum %></span></li>
<% if can? :create, @user.orders.build %>
<li class="list-group-item"><%= link_to "Place new order", new_user_order_path(@user), class: "btn btn-default btn-block" %></li>
<% end %>
</ul>
<% if can? :edit, @user %>
<ul class="list-group">
<li class="list-group-item text-muted">
<% if @user.dagschotel %>
Huidige dagschotel
<%= image_tag @user.dagschotel.avatar %>
<%= link_to "Change dagschotel", user_edit_dagschotel_path(@user), class: "btn btn-default btn-block" %>
<% else %>
<%= link_to "Set dagschotel", user_edit_dagschotel_path(@user), class: "btn btn-default btn-block" %>
<% end %>
</li>
</ul>
<% end %>
</div>