Sha256: f1c4a9009979b6f0928c99283bc54b188d7c941b6d1c1f86a17e37433620b173

Contents?: true

Size: 1015 Bytes

Versions: 12

Compression:

Stored size: 1015 Bytes

Contents

class FrontEndController < ApplicationController

  include PushType::Filterable

  before_action :load_node,         only: :show
  before_action :load_preview_node, only: :preview
  before_action :build_presenter
  node_filters

  def show
    render *@node.template_args
  end

  def preview
    response.headers['X-Robots-Tag'] = 'none'
    show
  end

  private  

  def load_node
    @node = PushType::Node.exposed.published.find_by_path permalink_path
  end

  def load_preview_node
    @node = PushType::Node.exposed.find_by_base64_id params[:id]
  end

  def build_presenter
    if @node
      instance_variable_set "@#{ @node.type.underscore }", @node.present!(view_context)
    else
      raise_404
    end
  end

  def raise_404
    if home_path?
      render template: 'push_type/setup', layout: nil, status: 404
    else
      raise ActiveRecord::RecordNotFound
    end
  end

  def home_path?
    request.fullpath == ( main_app.respond_to?(:home_node_path) ? main_app.home_node_path : '/' )
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
push_type_core-0.12.1 app/controllers/front_end_controller.rb
push_type_core-0.12.0 app/controllers/front_end_controller.rb
push_type_core-0.12.0.beta.1 app/controllers/front_end_controller.rb
push_type_core-0.11.2 app/controllers/front_end_controller.rb
push_type_core-0.11.1 app/controllers/front_end_controller.rb
push_type_core-0.11.0.beta.2 app/controllers/front_end_controller.rb
push_type_core-0.11.0.beta.1 app/controllers/front_end_controller.rb
push_type_core-0.10.4 app/controllers/front_end_controller.rb
push_type_core-0.10.3 app/controllers/front_end_controller.rb
push_type_core-0.10.2 app/controllers/front_end_controller.rb
push_type_core-0.10.1 app/controllers/front_end_controller.rb
push_type_core-0.10.0 app/controllers/front_end_controller.rb