first evented steps
This commit is contained in:
@@ -14,7 +14,7 @@ class ApplicationController < ActionController::Base
|
||||
def layout_by_resource
|
||||
if devise_controller?
|
||||
case session[:user_return_to]
|
||||
when /\/user\// then 'phone'
|
||||
when /\/user\// then ''
|
||||
when /obtain_token/ then 'obtain_token'
|
||||
else 'theme1'
|
||||
end
|
||||
@@ -49,4 +49,10 @@ class ApplicationController < ActionController::Base
|
||||
message = args.first || ''
|
||||
{ok: true, message: message}.merge(options).to_json
|
||||
end
|
||||
|
||||
def broadcast_user(uid, event, data = {})
|
||||
message = {channel: channel, data: {event: event, data: data}}
|
||||
uri = URI.parse("http://localhost:9292/faye")
|
||||
Net::HTTP.post_form(uri, :message => message.to_json)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -87,6 +87,9 @@ class SupplierController < ApplicationController
|
||||
def close_list
|
||||
@list = List.find_by_supplier_id_and_id(current_supplier.id, params[:list_id])
|
||||
@list.close!
|
||||
for user_id in @list.user_ids
|
||||
broadcast_user user_id, 'list_closed', @list
|
||||
end
|
||||
render nothing: true
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user