Module: Content::Manager

Defined in:
lib/content/manager.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.load_content_item(params) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/content/manager.rb', line 3

def self.load_content_item(params)
  url = params["content_item_url"]
  unless url.nil?
    if url.is_a? Array
      url = "/#{url.join('/')}"
    end
    if url.match(/^(.+)\.([a-z]+)$/i)
      params[:format] = $2
      url = $1
    end
    params["content_item_url"] = url
    Content::Item.find_by_url(url)
  end
end

Instance Method Details

#showObject



18
19
20
21
22
23
24
# File 'lib/content/manager.rb', line 18

def show
  render404 and return if current_content_item.nil? or current_content_item.template.nil? or current_content_item.template.sublayout.nil?
  respond_to do |format|
    format.html { prerender_containers and render :template => "sublayouts/#{current_content_item.template.sublayout}", :layout => false }
    format.xml  { render :xml => current_content_item }
  end
end