Skip to content

Instantly share code, notes, and snippets.

@lastobelus
Created January 21, 2009 21:33
Show Gist options
  • Save lastobelus/50215 to your computer and use it in GitHub Desktop.
Save lastobelus/50215 to your computer and use it in GitHub Desktop.
self._template_roots = self._template_roots.
push([self._template_root / "theme", :template_location_with_portal_app_and_theme])
class << self
def signup_controller_for_portal_app_and_theme(portal_app, theme)
return self.controller_name if self.subclasses_list.empty?
unless theme.nil?
controller_name = "#{portal_app.name}_#{theme.name}_signup"
return controller_name if self.subclasses_list.include?(controller_name.classify)
end
controller_name = "#{portal_app.name}_signup"
return controller_name if self.subclasses_list.include?(controller_name.classify)
return self.controller_name
end
end
def portal_app
@portal_app ||= PortalApp.portal_app_from_params(params)
end
def theme
return nil if portal_app.nil?
@theme ||= self.portal_app.theme_from_params(params)
end
def template_location_with_portal_app(context, type, controller)
return _template_location(context, type, controller) if self.portal_app.nil?
controller = 'sage_users' unless controller == 'layout' # subclasses should use the themed view mechanism
template_base = _conditionally_append_extension(controller ? "#{controller}/#{context}" : "#{context}", type)
"#{self.portal_app.name}/#{template_base}"
end
def template_location_with_portal_app_and_theme(context, type, controller)
return template_location_with_portal_app(context, type, controller) if self.theme.nil?
controller = 'sage_users' unless controller == 'layout'# subclasses should use the themed view mechanism
_conditionally_append_extension(controller ? "#{controller}/#{context}" : "#{context}", type)
"#{self.portal_app.name}/#{self.theme.name}/#{template_base}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment