forked from saurabh/orbit4-5
44 lines
959 B
Ruby
44 lines
959 B
Ruby
|
class HomeController < ApplicationController
|
||
|
|
||
|
before_filter :get_key
|
||
|
layout :get_layout
|
||
|
|
||
|
def index
|
||
|
@manifest = @key
|
||
|
@dataApi = "data"
|
||
|
if !params[:name]
|
||
|
@file = File.join(Rails.root, 'app', 'templates', "#{@key}", '/home/index.html.erb')
|
||
|
else
|
||
|
module_name = params[:name]
|
||
|
@file = File.join(Rails.root, 'app', 'templates', "#{@key}", "modules/#{module_name}/index.html.erb")
|
||
|
end
|
||
|
render @file
|
||
|
end
|
||
|
|
||
|
def show
|
||
|
@manifest = @key
|
||
|
@dataApi = "data"
|
||
|
if params[:name]
|
||
|
module_name = params[:name]
|
||
|
@file = File.join(Rails.root, 'app', 'templates', "#{@key}", "modules/#{module_name}/show.html.erb")
|
||
|
else
|
||
|
@file = File.join(Rails.root, 'app', 'templates', "#{@key}", '/home/index.html.erb')
|
||
|
end
|
||
|
render @file
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def get_key
|
||
|
@key = Template::KEY
|
||
|
end
|
||
|
|
||
|
def get_layout
|
||
|
if params[:name]
|
||
|
File.join("../../templates", "#{@key}", '/home/page.html.erb')
|
||
|
else
|
||
|
false
|
||
|
end
|
||
|
end
|
||
|
end
|