Add ordering form sidebar

This commit is contained in:
tl3ilaxu 2016-03-02 18:51:04 +01:00
parent 536d4c44ae
commit d99304b065
5 changed files with 34 additions and 7 deletions

View file

@ -44,3 +44,11 @@ div.out-of-stock {
.expand {
overflow: hidden;
}
.dagschotel-edit-image {
margin: auto;
max-height: 65px;
}
.dagschotel-edit {
max-height: 250px;
}

View file

@ -6,4 +6,6 @@
- if current_user.dagschotel != product
= button_to "Make dagschotel", { controller: 'users', action: 'update', "user[dagschotel_id]" => product.id }, method: :put, class: "btn btn-default"
- else
= button_to "Current dagschotel", { controller: 'users', action: 'update', "user[dagschotel_id]" => "nil" }, method: :put, class: "btn btn-success"
#remove_dagschotel
= button_to "Current dagschotel", { controller: 'users', action: 'update', "user[dagschotel_id]" => "nil" }, method: :put, class: "btn btn-success"

View file

@ -1,7 +1,6 @@
.col-md-3
.thumbnail.pic
.center
= image_tag product.avatar
.thumbnail.pic.dagschotel-edit
= image_tag product.avatar, :class => "dagschotel-edit-image img-responsive"
.caption
= kcal_tag product.calories
%h4= product.name

View file

@ -13,14 +13,19 @@
%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"
%li.list-group-item
= link_to "Place new order", new_user_order_path(@user), class: "btn btn-default btn-block"
%p.center
%b or
- if @user.dagschotel
= link_to quickpay_user_path(@user), remote: true, data: { quickpay: true, type: "json" }, class: "btn btn-default btn-block" do
%p.center Order dagschotel
= image_tag @user.dagschotel.avatar, title: "Huidige dagschotel"
= render 'errors', object: @user
- if can? :edit, @user
%ul.list-group
%li.list-group-item.text-muted
- if @user.dagschotel
.center
%p= image_tag @user.dagschotel.avatar, title: "Huidige dagschotel"
\#{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"

View file

@ -1,2 +1,15 @@
= content_for :title, "Choose new Dagschotel"
= render 'products/index'
= javascript_tag do
var id = $("#remove_dagschotel").find(".btn");
default_value=id.val();
id.hover(function () {
$(this).toggleClass("btn-success");
$(this).toggleClass("btn-danger");
$(this).val("Remove dagschotel");
}, function(){
$(this).val(default_value);
$(this).toggleClass("btn-success");
$(this).toggleClass("btn-danger");
});