Skip to content
Extraits de code Groupes Projets
posts_controller.rb 1005 octets
Newer Older
  • Learn to ignore specific revisions
  • 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
    
      skip_before_filter :set_contacts_notifications_unread_count_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
    
        @post = Post.where(:id => params[:id], :public => true).includes(:author, :comments => :author).first
    
    maxwell's avatar
    maxwell a validé
        if @post
    
    maxwell's avatar
    maxwell a validé
          @landing_page = true
    
          @person = @post.author
    
    maxwell's avatar
    maxwell a validé
          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
    
    maxwell's avatar
    maxwell a validé
      end
    end