Skip to content
Extraits de code Groupes Projets
application_controller.rb 723 octets
Newer Older
Raphael Sofaer's avatar
Raphael Sofaer a validé
class ApplicationController < ActionController::Base
  protect_from_forgery :except => :receive
Raphael Sofaer's avatar
Raphael Sofaer a validé
  layout 'application'
  before_filter :set_friends_and_status, :count_requests
danielvincent's avatar
danielvincent a validé

  layout :layout_by_resource

  def layout_by_resource
    if devise_controller?
      "session_wall"
    else
      "application"
    end
  end
  def set_friends_and_status
    @groups = current_user.groups
maxwell's avatar
maxwell a validé
    @friends = current_user.friends if current_user
    @latest_status_message = StatusMessage.newest_for(current_user) if current_user
    @group = params[:group] ? Group.first(:id => params[:group]) : Group.first
  end

  def count_requests
    @request_count = Request.for_user(current_user).size if current_user
Raphael Sofaer's avatar
Raphael Sofaer a validé
end