move towards mobile deployable app
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
class UserController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
before_filter :allow_mobile #, :authenticate_user!
|
||||
layout 'phone'
|
||||
|
||||
alias :list :active_list
|
||||
|
||||
def allow_mobile
|
||||
headers['Access-Control-Allow-Origin'] = '*'
|
||||
headers['Access-Control-Request-Method'] = '*'
|
||||
end
|
||||
|
||||
def home
|
||||
handle_message_params
|
||||
end
|
||||
@@ -159,13 +164,17 @@ class UserController < ApplicationController
|
||||
def list_info
|
||||
respond_to do |format|
|
||||
format.json do
|
||||
if !list.try(:active?)
|
||||
current_user.list_is_closed!
|
||||
render json: {list_active: false}
|
||||
return
|
||||
if list.present?
|
||||
if !list.try(:active?)
|
||||
current_user.list_is_closed!
|
||||
render json: {list_active: false}
|
||||
return
|
||||
else
|
||||
list_obj = list.as_json.merge(list_active: list.active? ).merge(list.join_requests_as_json)
|
||||
render json: list_obj
|
||||
end
|
||||
else
|
||||
list_obj = list.as_json.merge(list_active: list.active? ).merge(list.join_requests_as_json)
|
||||
render json: list_obj
|
||||
render json: {not_present: true}
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -223,7 +232,7 @@ class UserController < ApplicationController
|
||||
format.html do
|
||||
end
|
||||
format.json do
|
||||
render json: @list.with_orders_as_json
|
||||
render json: @list.with_orders_as_json.merge(supplier_name: @list.supplier.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user