tap/app/views/users/_sidebar.html.haml

38 lines
1.8 KiB
Text
Raw Normal View History

2015-09-17 14:05:33 +02:00
.col-sm-3
%div
2016-02-04 23:28:13 +01:00
%h2.float-right
= content_tag :div, image_tag(@user.avatar, class: "img-circle img-thumbnail center"), class: "user_avatar center"
%h2.center
2015-09-17 14:05:33 +02:00
= @user.name
%ul.list-group
%li.list-group-item.text-muted Orders
%li.list-group-item
%strong Orders placed
%span.badge= @user.orders_count
%li.list-group-item
%strong Products ordered
%span.badge= @user.products_group_by_id.map(&:count).sum
- if can? :create, @user.orders.build
%li.list-group-item= link_to "Place new order", new_user_order_path(@user), class: "btn btn-default btn-block"
= render 'errors', object: @user
2015-09-17 14:05:33 +02:00
- if can? :edit, @user
%ul.list-group
%li.list-group-item.text-muted
- if @user.dagschotel
2016-02-04 23:28:13 +01:00
.center
%p= image_tag @user.dagschotel.avatar, title: "Huidige dagschotel"
2015-09-17 14:05:33 +02:00
\#{link_to "Change dagschotel", edit_dagschotel_user_path(@user), class: "btn btn-default btn-block"}
- else
= link_to "Set dagschotel", edit_dagschotel_user_path(@user), class: "btn btn-default btn-block"
2016-02-04 23:28:13 +01:00
%li.list-group-item.text-muted
%p Orders can be placed on koelkast for every public account. Private accounts can only order products by logging in here.
// = link_to "Go #{if @user.private then "public" else "private" end}", toggle_privacy_user_path(@user), class: "btn btn-default btn-block"
= f_form_for @user do |f|
.hidden
= f.check_box :private, checked: !@user.private
= f.submit "Go #{@user.private ? "public" : "private"}", class: "btn btn-default btn-block"
%li.list-group-item.text-muted
= f_form_for @user do |f|
= f.file_field :avatar
= f.submit "Change avatar", class: "btn btn-default btn-block"