2015-01-06 20:33:11 +01:00
|
|
|
<%= render partial: 'flash' %>
|
2014-11-09 22:53:39 +01:00
|
|
|
<div class="row">
|
2015-09-01 14:52:20 +02:00
|
|
|
<div class="col-sm-3">
|
2015-09-01 16:51:21 +02:00
|
|
|
<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" %>
|
2015-09-01 14:52:20 +02:00
|
|
|
<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>
|
2015-09-01 16:21:43 +02:00
|
|
|
<li class="list-group-item"><strong>Products ordered</strong><span class="badge"><%= @products.map(&:count).sum %></span></li>
|
2015-09-01 14:52:20 +02:00
|
|
|
<% 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>
|
2015-08-31 14:33:15 +02:00
|
|
|
<% if can? :edit, @user %>
|
2015-09-01 14:52:20 +02:00
|
|
|
<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>
|
2015-03-19 18:04:58 +01:00
|
|
|
<% end %>
|
2015-01-09 19:15:48 +01:00
|
|
|
</div>
|
2015-09-01 14:52:20 +02:00
|
|
|
<div id="user_info" class="col-sm-9">
|
|
|
|
<% if @orders.any? %>
|
|
|
|
<h4>Previously ordered</h4>
|
2015-08-31 14:33:15 +02:00
|
|
|
Total:
|
2015-03-19 17:38:59 +01:00
|
|
|
<ul>
|
2015-08-31 14:33:15 +02:00
|
|
|
<li>
|
2015-09-01 14:52:20 +02:00
|
|
|
<%= @categories.map{|c| pluralize(c.count, c.category)}.to_sentence %>
|
2015-08-31 14:33:15 +02:00
|
|
|
</li>
|
2015-03-19 17:38:59 +01:00
|
|
|
</ul>
|
2015-03-02 16:10:54 +01:00
|
|
|
|
2015-08-31 14:33:15 +02:00
|
|
|
Specifics:
|
|
|
|
<%= content_tag :ul do %>
|
|
|
|
<% @products.each do |p| %>
|
2015-09-01 14:52:20 +02:00
|
|
|
<%= content_tag :li, pluralize(p.count, p.name) %>
|
2015-08-31 14:33:15 +02:00
|
|
|
<% end %>
|
2015-09-01 14:52:20 +02:00
|
|
|
<% end %>
|
2015-08-31 14:33:15 +02:00
|
|
|
|
2015-02-19 15:41:12 +01:00
|
|
|
<h4>All orders (<%= @user.orders_count %>)</h4>
|
2015-03-12 13:25:11 +01:00
|
|
|
<table class="orders"><%= render @orders %></table>
|
2015-02-09 13:23:38 +01:00
|
|
|
<%= will_paginate @orders %>
|
2015-01-09 19:15:48 +01:00
|
|
|
</div>
|
|
|
|
<% end %>
|
2014-11-23 21:12:31 +01:00
|
|
|
</div>
|
2015-09-01 14:52:20 +02:00
|
|
|
</div>
|