Sha256: 24b1495f12493a579b4bed82efff79da3252780cf22913c47688abf4dd636644

Contents?: true

Size: 973 Bytes

Versions: 6

Compression:

Stored size: 973 Bytes

Contents

class PagesController < ApplicationController
  include Beef::Pages::HelperMethods

  def show
    @page = Page.published.find_by_permalink(params[:id])
    @images = @page.assets.images
    @documents = @page.assets.documents
    
    @page_title = @page.title
    @page_description = @page.description
    @page_keywords = @page.tag_list
    
    render :template => "pages/templates/#{(@page.template || get_template_names.first)}"
  end
  
  def preview
    @page = Page.new(session[:page_preview])
    @images = Asset.images.all(:conditions => {:id => session[:page_preview][:asset_ids] })
    @documents = Asset.documents.all(:conditions => {:id => session[:page_preview][:asset_ids] })
    
    @page.id = 0
    @page.published_at = Time.now
    @page.published_to = nil
    @page.created_by = current_user if @page.created_by.nil?
    session[:page_preview] = nil
    render :template => "pages/templates/#{(@page.template || get_template_names.first)}"
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
beef-pages-0.3.20 app/controllers/pages_controller.rb
beef-pages-0.3.19 app/controllers/pages_controller.rb
beef-pages-0.3.18 app/controllers/pages_controller.rb
beef-pages-0.3.17 app/controllers/pages_controller.rb
beef-pages-0.3.16 app/controllers/pages_controller.rb
beef-pages-0.3.15 app/controllers/pages_controller.rb