Let use choose his dagschotel
This commit is contained in:
parent
cfd7f6fc0f
commit
bbc8901353
4 changed files with 26 additions and 2 deletions
|
@ -15,8 +15,13 @@ class ApplicationController < ActionController::Base
|
|||
protected
|
||||
|
||||
def configure_permitted_parameters
|
||||
devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:nickname, :name, :last_name, :password, :password_confirmation, :current_password, :avatar) }
|
||||
devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:password, :password_confirmation, :current_password, :avatar) }
|
||||
devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(
|
||||
:nickname, :name, :last_name, :password, :password_confirmation,
|
||||
:current_password, :avatar
|
||||
) }
|
||||
devise_parameter_sanitizer.for(:account_update) { |u| u.permit(
|
||||
:password, :password_confirmation, :current_password, :avatar
|
||||
) }
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -14,4 +14,10 @@ class UsersController < ApplicationController
|
|||
redirect_to users_path
|
||||
end
|
||||
|
||||
def dagschotel
|
||||
user = User.find(params[:user_id])
|
||||
user.dagschotel = Product.find(params[:product_id])
|
||||
user.save
|
||||
redirect_to edit_user_registration_path(user)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,3 +17,15 @@
|
|||
|
||||
<%= f.submit "Update", class: 'btn btn-primary' %>
|
||||
<% end %>
|
||||
|
||||
<% if current_user.dagschotel.present? %>
|
||||
<h3>Current Dagschotel:</h3>
|
||||
<div>
|
||||
<%= image_tag current_user.dagschotel.avatar %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<h4>Choose new Dagschotel:</h4>
|
||||
<% Product.all.each do |p| %>
|
||||
<%= link_to image_tag(p.avatar), user_dagschotel_path(current_user, p) %>
|
||||
<% end %>
|
||||
|
|
|
@ -8,6 +8,7 @@ Rails.application.routes.draw do
|
|||
resources :orders, only: [:new, :create, :index] do
|
||||
end
|
||||
get 'quickpay' => 'orders#quickpay'
|
||||
get 'dagschotel/:product_id' => 'users#dagschotel', as: "dagschotel"
|
||||
end
|
||||
|
||||
resources :products
|
||||
|
|
Loading…
Reference in a new issue