Add toggle_chat_privilege to aspect controller

This commit is contained in:
Lukas Matt 2014-11-13 11:24:07 +01:00
parent 4d14e7d3ba
commit ae582e4543

View file

@ -78,6 +78,14 @@ class AspectsController < ApplicationController
render :json => { :id => @aspect.id, :name => @aspect.name }
end
def toggle_chat_privilege
@aspect = current_user.aspects.where(:id => params[:aspect_id]).first
@aspect.chat_enabled = !@aspect.chat_enabled
@aspect.save
render :nothing => true
end
def toggle_contact_visibility
@aspect = current_user.aspects.where(:id => params[:aspect_id]).first
@ -102,6 +110,6 @@ class AspectsController < ApplicationController
end
def aspect_params
params.require(:aspect).permit(:name, :contacts_visible, :order_id)
params.require(:aspect).permit(:name, :contacts_visible, :chat_enabled, :order_id)
end
end