Sha256: b4bdac215f86035d245f4426a74cc62926e253713d2ed27608d69b699532ca21

Contents?: true

Size: 577 Bytes

Versions: 9

Compression:

Stored size: 577 Bytes

Contents

module Templates::ControllerExtensions
  def self.included(base)
    base.class_eval {
      before_filter :load_template, :only => [:new, :edit]
    }
  end
  
  def load_template
    unless params[:template].blank?
      case params[:template].to_i
        when 0
          @page.template = @content_template = nil
          params[:page][:template_id] = nil if params[:page]
        else
          @page.template = @content_template = Template.find(params[:template])
          params[:page][:template_id] = @content_template.id if params[:page]
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
radiant-templates-extension-1.0.8 lib/templates/controller_extensions.rb
radiant-templates-extension-1.0.7 lib/templates/controller_extensions.rb
radiant-templates-extension-1.0.6 lib/templates/controller_extensions.rb
radiant-templates-extension-1.0.5 lib/templates/controller_extensions.rb
radiant-templates-extension-1.0.4 lib/templates/controller_extensions.rb
radiant-templates-extension-1.0.3 lib/templates/controller_extensions.rb
radiant-templates-extension-1.0.2 lib/templates/controller_extensions.rb
radiant-templates-extension-1.0.1 lib/templates/controller_extensions.rb
radiant-templates-extension-1.0.0 lib/templates/controller_extensions.rb