Merge pull request #60 from ZeusWPI/user_show_styling

User show styling
This commit is contained in:
benji 2015-09-01 16:27:26 +02:00
commit db6f29b0e5
2 changed files with 47 additions and 37 deletions

View file

@ -58,25 +58,19 @@
} }
} }
.stats{ #user_info {
width: 60%; h4 {
margin: auto; text-transform: uppercase;
} font-family: monospace;
background-color: #333;
color: white;
padding: 5px 10px;
margin-top: 15px;
}
.stats h4 { ul {
text-transform: uppercase; list-style-type: none;
font-family: monospace; padding: 0 0 0 15px;
background-color: #333; margin: 0px;
color: white; }
padding: 5px 10px;
margin-top: 15px;
}
.stats ul {
list-style-type: none;
padding: 0 0 0 15px;
margin: 0px;
}
.stats li {
} }

View file

@ -1,35 +1,50 @@
<%= render partial: 'flash' %> <%= render partial: 'flash' %>
<div class="row"> <div class="row">
<div class="user_info"> <div class="col-sm-3">
<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>
<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 %> <% if can? :edit, @user %>
<h5> <ul class="list-group">
<%= link_to "[Edit dagschotel]" , user_edit_dagschotel_path(@user) %> <li class="list-group-item text-muted">
<%= link_to "[Edit profile]" , edit_user_path(@user) %> <% if @user.dagschotel %>
</h5> 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 %> <% end %>
<h2><%= @user.nickname %></h2>
<div class="actions">
<%= link_to "PLACE ORDER!", new_user_order_path(@user) if current_user == @user %>
<span>DEBT: <%= euro(@user.debt) %></span>
</div>
</div> </div>
<div id="user_info" class="col-sm-9">
<% if @orders.any? %> <% if @orders.any? %>
<div class="stats"> <h4>Previously ordered</h4>
<h4>Total products</h4>
Total: Total:
<ul> <ul>
<li> <li>
<%= @categories.map{|c| pluralize(c.count, c.category)}.to_sentence %> <%= @categories.map{|c| pluralize(c.count, c.category)}.to_sentence %>
</li> </li>
</ul> </ul>
Specifics: Specifics:
<%= content_tag :ul do %> <%= content_tag :ul do %>
<% @products.each do |p| %> <% @products.each do |p| %>
<%= content_tag :li, pluralize(p.count, p.name) %> <%= content_tag :li, pluralize(p.count, p.name) %>
<% end %>
<% end %> <% end %>
<% end %>
<h4>All orders (<%= @user.orders_count %>)</h4> <h4>All orders (<%= @user.orders_count %>)</h4>
<table class="orders"><%= render @orders %></table> <table class="orders"><%= render @orders %></table>
@ -37,3 +52,4 @@
</div> </div>
<% end %> <% end %>
</div> </div>
</div>