class SiteController < ApplicationController
  def index
    @pages = PublishedPage.where('type_of != 3').order('priority ASC')
    @adm = Admin.all
  end

  def show
    pages_get
    @page = PublishedPage.where('id = ? OR slug = ?',params[:id],params[:id]).first
    if @page.blank?
      redirect_to '/404.html'
    end
  end

  def kontakt
    pages_get
  end

  def preview
    pages_get
    if params[:id]
      @page = AllPage.where('id = ? OR slug = ?',params[:id],params[:id]).first
    end
    if @page.blank?
      redirect_to '/404.html'
    end
  end

  def send_email

  end


  def pages_get
    @pages = PublishedPage.where('type_of != 3').order('priority ASC')
  end
end
