63 lines
1.6 KiB
Ruby
63 lines
1.6 KiB
Ruby
class ClientsController < ApplicationController
|
|
|
|
include ClientHelper
|
|
include UsersHelper
|
|
|
|
|
|
AUTHED = %W{friend}
|
|
|
|
def scripts
|
|
_index
|
|
render :layout => 'scripts', content_type: 'text/javascript'
|
|
end
|
|
|
|
def index
|
|
_index
|
|
render :layout => 'client'
|
|
end
|
|
|
|
def latency_tester
|
|
render :layout => 'client'
|
|
end
|
|
|
|
def auth_action
|
|
if current_user
|
|
session.delete(:return_to) if session[:return_to] =~ /authed/
|
|
# FIXME: implement auth-action on a per-case basis
|
|
redirect_to(client_url) and return
|
|
else
|
|
if AUTHED.include?(params[:authed])
|
|
session[:return_to] = auth_action_url(:authed => params[:authed], :data => params[:data])
|
|
else
|
|
session.delete(:return_to) if session[:return_to] =~ /authed/
|
|
end
|
|
redirect_to client_url
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def _index
|
|
enable_olark
|
|
gon.olark_box_start_hidden = true
|
|
|
|
# we want to enforce that /client is always the client view prefix
|
|
# this is a side effect of setting root path to '/'; soon we can remove this when we implement the new home page
|
|
if request.path == '/'
|
|
redirect_to client_url
|
|
return
|
|
end
|
|
|
|
if current_user
|
|
@is_guitar_center = false #current_user.is_guitar_center?
|
|
gon.user_id = current_user.id
|
|
gon.user_email = current_user.email
|
|
gon.user_name = current_user.name
|
|
end
|
|
|
|
@in_client_page = true
|
|
@minimal_curtain = Rails.application.config.minimal_curtain
|
|
gon.recurly_tax_estimate_jam_track_plan = Rails.application.config.recurly_tax_estimate_jam_track_plan
|
|
end
|
|
end
|