Skip to content
Extraits de code Groupes Projets
posts_controller.rb 992 octets
Newer Older
maxwell's avatar
maxwell a validé
#   Copyright (c) 2010, Diaspora Inc.  This file is
#   licensed under the Affero General Public License version 3 or later.  See
#   the COPYRIGHT file.

class PostsController < ApplicationController
maxwell's avatar
maxwell a validé
  skip_before_filter :set_contacts_notifications_and_status
maxwell's avatar
maxwell a validé
  skip_before_filter :count_requests
  skip_before_filter :set_invites
  skip_before_filter :set_locale
  skip_before_filter :which_action_and_user
  skip_before_filter :set_grammatical_gender
maxwell's avatar
maxwell a validé

  def show
Raphael's avatar
Raphael a validé
    @post = Post.where(:id => params[:id], :public => true).includes(:person, :comments => :person).first
maxwell's avatar
maxwell a validé

maxwell's avatar
maxwell a validé
    if @post
maxwell's avatar
maxwell a validé
      @landing_page = true
      @person = @post.person
      if @person.owner_id
        I18n.locale = @person.owner.language
        render "posts/#{@post.class.to_s.underscore}", :layout => true
      else
        flash[:error] = "that post does not exsist!"
        redirect_to root_url
      end
maxwell's avatar
maxwell a validé
    else
      flash[:error] = "that post does not exsist!"
maxwell's avatar
maxwell a validé
      redirect_to root_url
Raphael's avatar
Raphael a validé
    end
maxwell's avatar
maxwell a validé
  end
end