negos_app/app/controllers/public/reseauxes_controller.rb
2018-08-16 21:14:18 +02:00

46 lines
1.0 KiB
Ruby
Executable File

class Public::ReseauxesController < ApplicationController
layout "public"
before_filter :auth_customer, :except => :find_sub_domain
def index
@reseauxes = current_customer.own_reseauxes.order(:name)
if @reseauxes.count == 1
redirect_to public_reseaux_path(@reseauxes.first)
end
end
def show
@reseaux_layout = true
@reseaux = current_customer.own_reseauxes.find(params[:id])
@reseaux_chief_layout = true
#@reseaux = Reseaux.find(params[:id])
end
def products
#@reseaux = Reseaux.find(params[:id])
end
def find_sub_domain
if ["negos.pro", "localhost.qz"].include?(request.domain(1))
sub_domain = request.domain(2).split(".")[0]
@reseaux = Reseaux.where(:sub_domain => sub_domain.to_s).first
if request.domain(1) == "localhost.qz"
redirect_to "http://localhost:3000/public/customers_auths/new?p="+@reseaux.token.to_s
else
render :inline => @reseaux.id.to_s
end
end
end
end