Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (31 sloc) 1.05 KB
# Controller que dirige toda la aplicación siguiendo las instrucciones
# definidas en los objetos TornusConfig
#
class TornusController < BaseController
before_filter :toogle_config
# root :to=>'tornus#get_resource', :resource_path=>''
# match '*resource_path', :to=>'tornus#get_resource'
#
def get_resource
@resource_path = params[:resource_path].split('/')
node = site.sitemap.node_from_resource_path(@resource_path)
not_found! unless node.is_a?(Tornus::Node)
@resource = node.resource
not_found! unless @resource.is_a?(Tornus::Resource)
end
protected
# si se recibe el param toogle_config se cambia el estado de
# configuración
def toogle_config
if params.has_key?('toogle_config')
if config_mode?
session['cfgmode'] = nil
else
session['cfgmode'] = true
end
redirect_to(request.fullpath.gsub('toogle_config', ''))
end
end
attr_reader(:resource, :resource_path)
helper_method(:resource, :resource_path)
end # class TornusController