diff --git a/app/assets/stylesheets/profile.css.scss b/app/assets/stylesheets/profile.css.scss index b6e7ca2..1118857 100644 --- a/app/assets/stylesheets/profile.css.scss +++ b/app/assets/stylesheets/profile.css.scss @@ -1,14 +1,40 @@ /* User profile */ +.user_info { + text-align: center; +} .user_info h2 { line-height: 45px; text-align: center; } - + .user_info h5 { - margin-right: 10px; - text-align: right; + margin-right: 10px; + text-align: right; +} + +.user_info .button_to input[type="submit"] { + font-size: 16px; + color: #FFF; + padding: 12px 50px 12px 50px; + border: 1px solid #999; + width: 60%; + font-family: monospace; + + text-shadow: 0px 1px 1px #666; + text-decoration: none; + + border-radius: 4px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + + background: #64a724; + background: -moz-linear-gradient(top, #64a724 0%, #579727 50%, #58982a 51%, #498c25 100%); + background: -webkit-gradient(linear, left top, left bottom, from(#64a724), to(#498c25), color-stop(0.4, #579727), color-stop(0.5, #58982a), color-stop(.9, #498c25), color-stop(0.9, #498c25)); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#64a724', endColorstr='#498c25', GradientType=0 ); + + cursor: pointer; } .balance { @@ -18,6 +44,7 @@ font-size: 16px; width: 60%; margin: auto; + margin-top: 10px; background-color: #FF7F00; color: white; } diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb index f092be6..8c72e73 100644 --- a/app/controllers/orders_controller.rb +++ b/app/controllers/orders_controller.rb @@ -6,6 +6,7 @@ class OrdersController < ApplicationController def new @user = User.find(params[:user_id]) redirect_to root_path, flash: { error: "Koelkast can't order things." } if @user.koelkast? + redirect_to root_path, flash: { error: "Please don't order stuff for other people" } unless current_user.koelkast? || current_user == @user @order = @user.orders.build # products = @user.products.select("products.*", "sum(order_items.count) as count").group(:product_id).order("count desc") @@ -16,6 +17,7 @@ class OrdersController < ApplicationController def create @user = User.find(params[:user_id]) redirect_to root_path, flash: { error: "Koelkast can't order things." } if @user.koelkast? + redirect_to root_path, flash: { error: "Please don't order stuff for other people" } unless current_user.koelkast? || current_user == @user @order = @user.orders.build(order_params) diff --git a/app/models/ability.rb b/app/models/ability.rb index 29403fa..41b711a 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -11,6 +11,7 @@ class Ability elsif user[:id] can :read, :all can :update, User + can :create, Order end end end diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 702a432..9ba552f 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -3,22 +3,21 @@
<%= link_to "[Edit profile]" , edit_user_registration_path if current_user == @user%>

<%= @user.nickname %> (<%= @user.full_name %>)

+ <%= button_to "PLACE ORDER!", new_user_order_path(@user), method: :get %>
BALANCE: <%= euro(@user.balance) %>
- + <% if @user.orders.any? %> -
-

Total products

- Total:
-
- Specifics:
- <%= render partial: "products/product_row", collection: @products, as: :product %> - +
+

Total products

+ Total:
+
+ Specifics:
+ <%= render partial: "products/product_row", collection: @products, as: :product %> +

All orders (<%= @user.orders_count %>)

<%= render @orders %> <%= will_paginate @orders %>
<% end %> - -